Zabbix - db not persist

Hello,

I’ve an issue with my compose file. I explain me about this issue. This is my docker-compose.yml file :

version: '3.1'

services:
  db:
    image: mysql:8.0.30
    restart: always
    environment:
     - MYSQL_ROOT_PASSWORD=my_password
     - MYSQL_DATABASE=zabbix
     - MYSQL_USER=zabbix_user
     - MYSQL_PASSWORD=my_password
    ports:
      - "3306:3306"
    volumes:
      - mysql-data:/var/lib/mysql

  zabbix_server:
    image: zabbix/zabbix-server-mysql:latest
    restart: always
    environment:
    - DB_SERVER_HOST=db
    - MYSQL_USER=zabbix_user
    - MYSQL_DATABASE=zabbix
    - MYSQL_PASSWORD=my_password
    ports:
      - "10051:10051"

  zabbix_frontend:
    image: zabbix/zabbix-web-apache-mysql:latest
    restart: always
    depends_on:
      - db
    environment:
      - DB_SERVER_HOST=db
      - MYSQL_USER=zabbix_user
      - MYSQL_PASSWORD=my_password
      - ZBX_SERVER_HOST=zabbix
      - PHP_TZ=Europe/Brussels
    ports:
      - "80:8080"
      - "443:8443"

volumes:
  mysql-data:
    external: false

So, when i’m use this command : docker-compose up -d,
I saw this when i run my script file :

Creating network "documents_default" with the default driver
Creating volume "documents_mysql-data" with default drive

Of course, i’ve been created my volume “mysql-data” before run docker-compose.

I think my databse is not persistent, but i don’t know why… Can you help me to solve this issue ?

Thank you verry much

If you create it outside compose, you should not use

I personally prefer to persist data in a bind mount, a simple folder on host. Then even if you accidentally run Docker commands that delete a Docker volume, the data is still there.

More precisely, since you have an external volume, the boolean value should be true, not false.

Hello,

Thanks everyone ! I have an issue with database, I guess.

When I check logs, i saw this :

zabbix_server_1    | Starting Zabbix Server. Zabbix 7.0.4 (revision f383737).
zabbix_server_1    | Press Ctrl+C to exit.
zabbix_server_1    |
zabbix_server_1    |      1:20241020:102513.818 Starting Zabbix Server. Zabbix 7.0.4 (revision f383737).
zabbix_server_1    |      1:20241020:102513.818 ****** Enabled features ******
zabbix_server_1    |      1:20241020:102513.818 SNMP monitoring:           YES
zabbix_server_1    |      1:20241020:102513.818 IPMI monitoring:           YES
zabbix_server_1    |      1:20241020:102513.818 Web monitoring:            YES
zabbix_server_1    |      1:20241020:102513.818 VMware monitoring:         YES
zabbix_server_1    |      1:20241020:102513.818 SMTP authentication:       YES
zabbix_server_1    |      1:20241020:102513.818 ODBC:                      YES
zabbix_server_1    |      1:20241020:102513.818 SSH support:               YES
zabbix_server_1    |      1:20241020:102513.818 IPv6 support:              YES
zabbix_server_1    |      1:20241020:102513.818 TLS support:               YES
zabbix_server_1    |      1:20241020:102513.818 ******************************
zabbix_server_1    |      1:20241020:102513.818 using configuration file: /etc/zabbix/zabbix_server.conf
zabbix_server_1    |      1:20241020:102513.822 cannot use database "zabbix": its "users" table is empty (is this the Zabbix proxy database?

I check on db docker, and see the tables are empty. Why ?

Thank a lot.

Hello,

Thank to help me !

I’ve another issue with my db. I think, its not create properly…

Starting Zabbix Server. Zabbix 7.0.4 (revision f383737).
Press Ctrl+C to exit.

     1:20241020:122916.137 Starting Zabbix Server. Zabbix 7.0.4 (revision f383737).
     1:20241020:122916.137 ****** Enabled features ******
     1:20241020:122916.137 SNMP monitoring:           YES
     1:20241020:122916.137 IPMI monitoring:           YES
     1:20241020:122916.137 Web monitoring:            YES
     1:20241020:122916.137 VMware monitoring:         YES
     1:20241020:122916.137 SMTP authentication:       YES
     1:20241020:122916.137 ODBC:                      YES
     1:20241020:122916.137 SSH support:               YES
     1:20241020:122916.137 IPv6 support:              YES
     1:20241020:122916.137 TLS support:               YES
     1:20241020:122916.137 ******************************
     1:20241020:122916.137 using configuration file: /etc/zabbix/zabbix_server.conf
     1:20241020:122916.141 cannot use database "zabbix": its "users" table is empty (is this the Zabbix proxy data 

I understood, the zabbix have a script to create the database. But i don’t why this failed.

That seems to be an application issue, not related to Docker.

Check the application doc, maybe you need to create an initial user first.

1 Like

It’s like @bluepuma77 writes: it is an application issue.

This issue in the zabbix forum confirms it:

https://www.zabbix.com/forum/zabbix-help/484427-cannot-use-database-zabbix-its-users-table-is-empty

But honestly, the recommendation in the refered post does not realy help to understand what needs to be done. I’d suggest trying in the zabbix forum, as it’s more likely to find zabbix users that run it using a compose project, rather than finding zabbix users on the docker forum.

1 Like