Ad Widget

Collapse

How to upgrade Zabbix docker appliance 4.0 LTS using local database?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Cloud8x4
    Junior Member
    • Dec 2013
    • 24

    #1

    How to upgrade Zabbix docker appliance 4.0 LTS using local database?

    Hi,

    I have a Zabbix Docker appliance 4.0 LTS running un Ubuntu Server 18.
    It uses a MariaDB database on the host located in /var/lib/mysql.

    A colleague installed it years ago.
    Unfortunately I don't know how exactly.
    In console history I can find
    Code:
    sudo docker run -td -p 127.0.0.1:8880:80 -p 0.0.0.0:10051:10051 -e "DB_SERVER_HOST=172.17.0.1" <... other parameters ...> -t zabbix/zabbix-appliance:alpine-4.0-latest
    My main question is: how exactly can I upgrade to v5.0?

    Test using docker appliance 4.0 LTS

    I wanted to test on a new local server:
    • Download an Ubuntu 18 server image, boot up and install.
    • Installed MariaDB with an admin user which has all permissions.
    • Create a database zabbix and a user zabbix which has all permissions on zabbix database except grant.
    • Install docker
    • Run
      Code:
      sudo docker run -td -p 127.0.0.1:8880:80 -p 0.0.0.0:10051:10051 -e "DB_SERVER_HOST=172.17.0.1" -e MYSQL_DATABASE="zabbix" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="zabbix" -t zabbix/zabbix-appliance:alpine-4.0-latest
    It doesn't work. I don't know why.

    [CODE]docker logs zabbix-server[CODE]
    **** MySQL server is not available. Waiting 5 seconds..
    Try an alternative

    Test using docker compose and the latest Zabbix release

    I watched https://www.youtube.com/watch?v=ScKlF0ICVYA&ab_channel=Zabbix and learned a lot.

    I noticed port 443 / 8433 is not working? The web UI only works using port 80 (apache) or 8443 (nginx).

    I copied docker-compose_v3_alpine_mysql_latest.yaml to docker-compose_test.yaml and only kept the services zabbix-server, zabbix-web-nginx-mysql, zabbix-agent, mysql-server and db_data_mysql.

    This works fine. Nice.

    Now I want to use the database in /var/lib/mysql.

    In the yaml file, I changed volumes:
    - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw
    to
    - /var/lib/mysql:/var/lib/mysql:rw

    Docker kill and bring up. Then I get a warning:
    WARNING: Service "mysql-server" is using volume "/var/lib/mysql" from the previous container. Host mapping "/var/lib/mysql" has no effect. Remove the existing containers (with `docker-compose rm mysql-server`) to use the host volu...
    So I killed again, removed that docker and brought up again. No warning now. Ok.

    docker logs zabbixdocker_zabbix-server: MySQL server is not available. Waiting 5 seconds.

    Now I can still access my local database with my admin user but when accessing the zabbix database, I get 1018 - Can't read dir of '.zabbix/' (errno: 13 "Permission denied").

    I can't seem to get past this. Should be easy but I'm stuck. Getting desperate.

    A clear, short procedure how to use local mysql database with Zabbix container would be great.

    Please help, thanks!
    Last edited by Cloud8x4; 12-03-2021, 15:10.
  • Cloud8x4
    Junior Member
    • Dec 2013
    • 24

    #2
    After a lot of trial and errors, a phew months ago, we managed to upgrade from the Zabbix Docker Appliance 4.0 LTS to 2 dockers Zabbix server mysql and zabbix web nginx mysql.

    Here are the commands:

    ZABBIX_SERVER_PASSWORD=*****
    ZABBIX_SERVER_ROOT_PASSWORD=*****

    docker run \
    --name zabbix-server-mysql -t \
    -e DB_SERVER_HOST="172.17.0.1" \
    -e MYSQL_DATABASE="zabbix" \
    -e MYSQL_PASSWORD=$ZABBIX_SERVER_PASSWORD \
    -e MYSQL_ROOT_PASSWORD=$ZABBIX_SERVER_ROOT_PASSWORD \
    -p 10051:10051 \
    -e "ZBX_CACHESIZE=256M" \
    -e "ZBX_VALUECACHESIZE=64M" \
    --restart always \
    -d zabbix/zabbix-server-mysql:alpine-5.0-latest

    docker run --name zabbix-web-nginx-mysql -t \
    -e ZBX_SERVER_HOST="172.17.0.2" \
    -e DB_SERVER_HOST="172.17.0.1" \
    -e MYSQL_DATABASE="zabbix" \
    -e MYSQL_USER="zabbix" \
    -e MYSQL_PASSWORD=$ZABBIX_SERVER_PASSWORD \
    -e MYSQL_ROOT_PASSWORD=$ZABBIX_SERVER_ROOT_PASSWORD \
    -p 127.0.0.1:8880:8080 \
    -e "ZBX_CACHESIZE=256M" \
    -e "ZBX_VALUECACHESIZE=64M" \
    --restart always \
    -d zabbix/zabbix-web-nginx-mysql:alpine-5.0-latest

    Simple enough when you know the answer.

    Comment

    Working...