环境是Ubuntu 22.04 + mysql + nginx(系统不同升级命令不同,具体命令详见官方文档)
1、更新APT源
wget https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_latest+ubuntu22.04_all.deb
2、安装zabbix源
dpkg -i zabbix-release_latest+ubuntu22.04_all.deb
3、更新源信息
apt-get update
4、升级Zabbix组件
apt-get install --only-upgrade zabbix-server-mysql zabbix-frontend-php zabbix-agent
备注:
(1) 如果使用PostgreSQL,将命令中的 mysql 替换为 pgsql 
(2) 升级代理时,将命令中的 server 替换为 proxy 
(3) 如果升级Zabbix agent 2,需要将命令中的 zabbix-agent 替换为 zabbix-agent2 zabbix-agent2-plugin-* 
升级过程中会出现关于 Zabbix server(或 proxy)配置的提示:
Configuration file '/etc/apt/sources.list.d/zabbix.list'
==> Deleted (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ?  Your options are:
Y or I  : install the package maintainer's version    # Y 或 I  : 安装包维护者的版本
N or O  : keep your currently-installed version       # N 或 O  : 保留当前已安装的版本
D       : show the differences between the versions   # D       : 显示版本之间的差异
Z       : start a shell to examine the situation      # Z       : 启动 shell 来检查情况
The default action is to keep your current version.
*** zabbix.list (Y/I/N/O/D/Z) [default=N] ?

建议选N保留配置

5、启动 Zabbix 进程

systemctl start zabbix-server
systemctl start zabbix-proxy
systemctl start zabbix-agent
systemctl start zabbix-agent2

一般到此处已经升级完成,但是此次版本升级连带着mysql数据也升级了,就会出现如下报错

The Zabbix database version does not match current requirements. Your database version: 6050035. Required version: 7000000. Please contact your system administrator.
尝试过修改数据库的mandatory值去匹配也是不行的
6、使用tail命令查看zabbix-server日志
tail -f /var/log/zabbix/zabbix_server.log

发现有如下的报错信息:

query failed: [1419] You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) 
[create trigger proxy_insert after insert on proxy
7、登录mysq
查看参数
mysql> SHOW VARIABLES LIKE 'log_bin_trust_function_creators';
log_bin_trust_function_creators 值为OFF
修改参数
mysql> SET GLOBAL log_bin_trust_function_creators = 1;
再次查看参数
log_bin_trust_function_creators 值为ON
8、重启zabbix-server
systemctl restart zabbix-server.service
9、完成升级
Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐