除了zabbix_agentd是本地安装之外,MySQL、Zabbix Java Gateway、Zabbix server、zabbix-web-nginx-mysql 使用docker镜像安装。具体安装的指令不说了,都能百度到,使用的系统是ubuntu16.04。
zabbix-web-nginx-mysql的端口是8081,服务器ip:8081应该能到server登陆界面,然而报错“the server does not match zabbix database”
搜了一下,感觉这个答案比较靠谱:
https://stackoverflow.com/questions/36911324/zabbix-error-the-frontend-does-not-match-zabbix-database,特别是这几句话:In this particular case, if you are installing for the first time, then you probably have not imported schema.sql, images.sql, and data.sql files yet. In that case, please consult “Installation from sources” and “Database creation scripts” sections in the online Zabbix documentation.还没有导入sql文件。然而问题来了,可能是版本的问题,zabbix-server-mysql容器内并没有这几个文件。在进入zabbix-server-mysql容器内苦苦搜索之后,终于在/usr/share/doc/zabbix-server-mysql文件夹下找到了类似作用的文件create.sql.gz,在使用指令zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -pzabbix zabbix即可导入数据库。这里又碰到一个小问题,因为zabbix-server-mysql和mysql均为容器,直接操作会报错ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/run/mysqld/mysqld.sock’ (2 “No such file or directory”)。这个问题我选择跳过去,方法就是先从容器zabbix-server-mysql把create.sql.gz导出到主机,再从主机导入到mysql容器,再执行zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -pzabbix zabbix,然后重启相关容器就可以了。