centos7上把zabbix升级3.2升级到4.4

概述

考虑升级之前,必须要看升级文档. 有的软件升级是不可以跨大版本直接升级,需要升级到最后一个小版本才可以升级大版本, zabbix没有这样的问题.官方文档有一句话. Direct upgrade to Zabbix 4.4.x is possible from Zabbix 4.2.x, 4.0.x, 3.4.x, 3.2.x, 3.0.x, 2.4.x, 2.2.x and 2.0.x.

备份

凡是变更,备份是必须的.

  1. 进行虚拟机备份,如果有.
  2. 进行文件和mysql的备份.
cp -a /etc/zabbix /tmp/bakup/
cp -a /etc/httpd/conf.d /tmp/bakup/
cp -a /usr/share/zabbix /tmp/bakup/share/
cp -a /usr/share/doc/zabbix-* /tmp/bakup/share/

安装升级用的yum源

rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm
yum clean all
yum list

升级

停止服务

systemctl stop zabbix-server.service
systemctl stop zabbix-agent.service
yum upgrade zabbix-server-mysql zabbix-web-mysql zabbix-agent
systemctl start zabbix-server.service
systemctl start zabbix-agent.service

注: 这里可能要重复执行很多次,毕竟是外国的源,实在不行,就去阿里云的源上手动下载安装.

刚升级完会发现并不会马上页面可以打开,需要等十来分钟,查看日志,后台数据库升级中

[root@zabbix1 zabbix]# tailf /var/log/zabbix_server.log
 25649:20200321:145657.939 starting automatic database upgrade
 25649:20200321:145657.966 completed 0% of database upgrade
 25649:20200321:145658.057 completed 1% of database upgrade
 25649:20200321:145658.318 completed 2% of database upgrade
 25649:20200321:145658.535 completed 3% of database upgrade
 25649:20200321:145700.882 completed 4% of database upgrade
 25649:20200321:145705.482 completed 5% of database upgrade
 25649:20200321:145720.801 slow query: 15.292289 sec, "alter table `alerts` add `p_eventid` bigint unsigned"
 25649:20200321:145736.241 slow query: 15.436423 sec, "alter table `alerts` add constraint c_alerts_5 foreign key (`p_eventid`) references `events` (`eventid`) on delete cascade"
 25649:20200321:145736.244 completed 6% of database upgrade

系统启动后,验证监控,邮件,微信,故障自愈脚本这些是否正常.

编写ansible play-book,把客户端进行升级.

你可能感兴趣的:(centos7上把zabbix升级3.2升级到4.4)