我正在开发Zabbix服务器的docker集群(基于mysql
和数据库的容器,以及zabbix-server
和zabbix-front
容器)。
mysql
服务器的运行行是:
docker run --name zabbix-db --network zabbixnet -e MYSQL_ROOT_PASSWORD="password" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="zabbix" -e MYSQL_DATABASE="zabbix" -d mysql
到zabbix集装箱的线路如下:
docker run --name zabbix-server --network zabbixnet -e DB_SERVER_HOST="zabbix-db" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="zabbix" -d zabbix/zabbix-server-mysql
docker run --name zabbix-front --network zabbixnet --link zabbix-server -p80:8080 -e DB_SERVER_HOST="zabbix-db" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="zabbix" -e PHP_TZ="Europe/Madrid" -d zabbix/zabbix-web-apache-mysql
当我启动zabbix服务器容器时,日志是:
** Preparing Zabbix server
** Using MYSQL_USER variable from ENV
** Using MYSQL_PASSWORD variable from ENV
********************
* DB_SERVER_HOST: zabbix-db
* DB_SERVER_PORT: 3306
* DB_SERVER_DBNAME: zabbix
********************
** Database 'zabbix' already exists. Please be careful with database COLLATE!
** Creating 'zabbix' schema in MySQL
** Preparing Zabbix server configuration file
** Updating '/etc/zabbix/zabbix_server.conf' parameter "ListenIP": ''...removed
** Updating '/etc/zabbix/zabbix_server.conf' parameter "ListenPort": ''...removed
** Updating '/etc/zabbix/zabbix_server.conf' parameter "ListenBacklog": ''...removed
** Updating '/etc/zabbix/zabbix_server.conf' parameter "SourceIP": ''...removed
** Updating '/etc/zabbix/zabbix_server.conf' parameter "LogType": 'console'...updated
** Updating '/etc/zabbix/zabbix_server.conf' parameter "LogFile": ''...removed
** Updating '/etc/zabbix/zabbix_server.conf' parameter "LogFileSize": ''...removed
[...]
** Updating '/etc/zabbix/zabbix_server.conf' parameter "ProxyDataFrequency": ''...removed
** Updating '/etc/zabbix/zabbix_server.conf' parameter "SSLCertLocation": '/var/lib/zabbix/ssl/certs/'...updated
** Updating '/etc/zabbix/zabbix_server.conf' parameter "SSLKeyLocation": '/var/lib/zabbix/ssl/keys/'...updated
** Updating '/etc/zabbix/zabbix_server.conf' parameter "SSLCALocation": '/var/lib/zabbix/ssl/ssl_ca/'...updated
** Updating '/etc/zabbix/zabbix_server.conf' parameter "LoadModulePath": '/var/lib/zabbix/modules/'...updated
** Updating '/etc/zabbix/zabbix_server.conf' parameter "HANodeName": ''...removed
** Updating '/etc/zabbix/zabbix_server.conf' parameter "NodeAddress": ''...removed
** Updating '/etc/zabbix/zabbix_server.conf' parameter "User": 'zabbix'...updated
Starting Zabbix Server. Zabbix 6.2.2 (revision 3545586).
Press Ctrl+C to exit.
7:20220913:082616.221 Starting Zabbix Server. Zabbix 6.2.2 (revision 3545586).
7:20220913:082616.221 ****** Enabled features ******
7:20220913:082616.221 SNMP monitoring: YES
7:20220913:082616.221 IPMI monitoring: YES
7:20220913:082616.221 Web monitoring: YES
7:20220913:082616.221 VMware monitoring: YES
7:20220913:082616.221 SMTP authentication: YES
7:20220913:082616.221 ODBC: YES
7:20220913:082616.221 SSH support: YES
7:20220913:082616.221 IPv6 support: YES
7:20220913:082616.221 TLS support: YES
7:20220913:082616.221 ******************************
7:20220913:082616.221 using configuration file: /etc/zabbix/zabbix_server.conf
7:20220913:082616.223 cannot use database "zabbix": its "users" table is empty (is this the Zabbix proxy database?)
实际上,该表是空的:
mysql> select * from users;
Empty set (0.00 sec)
我做错了什么吗?我错过了什么重要的步骤吗?日志中的zabbix-server
-as不是应该创建整个数据库模式吗?
发布于 2022-09-14 09:37:27
这是我在测试期间使用的代码:唯一的区别是排序规则/集,以及使用mariadb映像而不是mysql。我还为mysql数据使用了一个坞卷。
docker run --name zabbix-db -t \
-p 3306:3306 \
-e MYSQL_DATABASE="zabbix" \
-e MYSQL_USER="zabbix" \
-e MYSQL_PASSWORD="zabbix_pwd" \
-e MYSQL_ROOT_HOST="%" \
-e MYSQL_ROOT_PASSWORD="root_pwd" \
--network=zabbixnet \
-v mysql-data22:/var/lib/mysql \
--restart unless-stopped \
--cap-add=sys_nice \
-d mariadb \
--character-set-server=utf8 \
--collation-server=utf8_bin \
--default-authentication-plugin=mysql_native_password \
--disable-log-bin
https://stackoverflow.com/questions/73706165
复制相似问题