zabbix 从5.0升级到5.4

Upgrade procedure
1 停止zabbix-server服务 Stop Zabbix processes

Stop Zabbix server to make sure that no new data is inserted into database.

# systemctl stop zabbix-server

If upgrading the proxy, stop proxy too.

# systemctl stop zabbix-proxy
It is no longer possible to start the upgraded server and have older, yet unupgraded proxies report data to a newer server. This approach, which was never recommended nor supported by Zabbix, now is officially disabled when upgrading to 5.0 (or later) from any version before 4.4, as the server will ignore data from unupgraded proxies.
2 备份历史数据库 Back up the existing Zabbix database

This is a very important step. Make sure that you have a backup of your database. It will help if the upgrade procedure fails (lack of disk space, power off, any unexpected problem).

3 备份配置文件 Back up configuration files, PHP files and Zabbix binaries

Make a backup copy of Zabbix binaries, configuration files and the PHP file directory.

Configuration files:

# mkdir /opt/zabbix-backup/
# cp /etc/zabbix/zabbix_server.conf /opt/zabbix-backup/
# cp /etc/httpd/conf.d/zabbix.conf  /opt/zabbix-backup/

PHP files and Zabbix binaries:

# cp -R /usr/share/zabbix/ /opt/zabbix-backup/
# cp -R /usr/share/doc/zabbix-* /opt/zabbix-backup/

Backup MySQL 

#mysqldump -uroot -p  zabbix >20210830.sql
4 升级zabbix repo源 Update repository configuration package

To proceed with the upgrade your current repository package has to be updated.

# rpm -Uvh https://repo.zabbix.com/zabbix/5.4/rhel/8/x86_64/zabbix-release-5.4-1.el8.noarch.rpm
5 升级zabbix 程序 Upgrade Zabbix components

To upgrade Zabbix components you may run something like:

# yum upgrade zabbix-server-mysql zabbix-web-mysql zabbix-agent

If using PostgreSQL, substitute mysql with pgsql in the command. If upgrading the proxy, substitute server with proxy in the command. If upgrading the agent 2, substitute zabbix-agent with zabbix-agent2 in the command.

To upgrade the web frontend with Apache on RHEL 8 correctly, also run:

# yum install zabbix-apache-conf 

and make the necessary changes to this file.

To upgrade the web frontend on RHEL 7 follow distribution-specific instructions (extra steps are required to install PHP 7.2 or newer).

6 检查组件配置参数 Review component configuration parameters

See the upgrade notes for details on mandatory changes.

7 启动zabbix-server 服务 Start Zabbix processes

Start the updated Zabbix components.

# systemctl start zabbix-server
# systemctl start zabbix-proxy
# systemctl start zabbix-agent
# systemctl start zabbix-agent2
检查状态
导入数据库 Import sql

需要先停止数据库服务

#msyql -uzabbix -p zabbix < 20210830.sql
zabbix5.2版本升级到zabbix5.4版本后打开页面报错,报错内容如下

问题一

Database error
The frontend does not match Zabbix database. Current database version (mandatory/optional): 5010000/5010000. Required mandatory version: 5040000. Contact your system administrator.

(图片来自网络)

解决办法:

进入数据库

mysql> show databases;
mysql> use zabbix;
mysql> update dbversion set mandatory=5040000;
mysql> flush privileges;


重新打开web即可解决

 问题二

zabbix-server 无法启动,查看日志

tail -f /var/log/zabbix/zabbix_server.log

9332:20181010:174337.188 [Z3005] query failed: [1050] Table 'tag_filter' already exists [create table tag_filter (
`tag_filterid` bigint unsigned not null,
`usrgrpid` bigint unsigned not null,
`groupid` bigint unsigned not null,
`tag` varchar(255) default '' not null,
`value` varchar(255) default '' not null,
primary key (tag_filterid)

Fix:

Login mysql

对log中提示的所有表都drop掉,直到提示upgrade 完成,这样在浏览器上就可以正常打开和登陆zabbix

use zabbix;
drop table tag_filter;
8 Clear web browser cookies and cache

After the upgrade you may need to clear web browser cookies and web browser cache for the Zabbix web interface to work properly.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Zabbix 5.0 升级Zabbix 6.0 的过程可以分为几个主要步骤,但请注意,这是一个概括,具体操作可能需要根据你的环境和Zabbix版本的具体差异进行调整。以下是通用的大致步骤: 1. **备份当前环境**: 在开始升级之前,确保对当前Zabbix服务器的数据、配置文件以及相关的日志进行备份,以防升级过程中出现问题。 2. **检查兼容性**: 确认Zabbix 5.0是否满足升级Zabbix 6.0的系统要求,比如操作系统、数据库版本等。 3. **更新软件包**: 使用Zabbix官方提供的升级脚本或者工具(如zabbix-upgrade.sh)更新Zabbix服务器和客户端到最新版本,以准备迁移到新版本。 4. **停机维护**: 在业务低峰期,关闭Zabbix服务器的服务,确保升级过程不会影响监控。 5. **数据库迁移**: 根据官方文档中的指示,更新数据库结构,确保数据兼容性。可能需要手动执行SQL脚本或者使用提供的工具进行迁移。 6. **配置文件迁移**: Zabbix 6.0的配置文件格式可能有所变化,旧的配置文件可能需要手动调整或通过升级脚本来转换。 7. **安装并启动新版本**: 安装新的Zabbix服务器,配置好网络、数据库和其他必要的设置,然后启动服务。 8. **验证新版本功能**: 登录新的Zabbix界面,检查监控和报警是否正常,用户权限和配置是否正确。 9. **迁移旧数据**: 如果需要,将旧版本的监控数据、事件历史等导入到新版本中。 10. **清理和测试**: 清理旧版本的残留文件,进行彻底的测试以确保新版本运行良好。 11. **更新客户端**: 如果有Zabbix客户端也需要升级,更新到Zabbix 6.0的相应版本。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值