CentOS7.0下Zabbix3.4至Zabbix4.0的升级步骤(Proxy)
一、查看当前各软件版本号
OS层面
操作系统版本为centos6.5
[root@reg zabbix]# cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core)
内核版本为2.6.32,64bit
[root@reg zabbix]# uname -a Linux reg.xuequn.com 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
业务层面
zabbix-proxy版本3.0.3
[root@reg zabbix]# zabbix_proxy -V zabbix_proxy (Zabbix) 3.0.3 Revision 60173 18 May 2016, compilation time: May 23 2016 08:57:57 Copyright (C) 2016 Zabbix SIA License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it according to the license. There is NO WARRANTY, to the extent permitted by law. [root@reg zabbix]#
[root@reg zabbix]# rpm -qa|grep zabbix zabbix-proxy-mysql-3.0.3-1.el7.x86_64 zabbix-get-3.0.30-2.el7.x86_64 zabbix-release-3.0-1.el7.noarch zabbix-agent-3.0.3-1.el7.x86_64 [root@reg zabbix]#
二、备份数据
1、备份数据库
说明:proxy库文件不大,可使用mysqldump方式备份
mysqldump -uzabbix –pzabbix --skip-lock-tables zabbix_proxy > zabbix_proxybak.sql
2、文件备份
主要是备份配置文件,其他可不备份
cat /etc/zabbix/zabbix_proxy.conf
LogFile=/var/log/zabbix/zabbix_proxy.log PidFile=/var/run/zabbix/zabbix_proxy.pid Server=10.11.100.99 Hostname=private-proxy DBName=zabbix_proxy DBUser=zabbix DBPassword=zabbix ProxyLocalBuffer=24 ProxyOfflineBuffer=24 ConfigFrequency=300 DataSenderFrequency=3 StartPollers=100 StartIPMIPollers=2 StartPollersUnreachable=2 StartTrappers=10 StartPingers=15 StartHTTPPollers=3 StartVMwareCollectors=3 VMwareCacheSize=40M StartSNMPTrapper=0 CacheSize=256M StartDBSyncers=4 HistoryCacheSize=256M Timeout=30 LogSlowQueries=10000
三、升级zabbix-proxy
1、停止服务
service zabbix-proxy stop service zabbix-agent stop
2、升级zabbix源
CentOS6
rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/6/x86_64/zabbix-release-4.0-2.el6.noarch.rpm
CentOS7
rpm -Uvh http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
3、升级zabbix
yum clean all yum upgrade zabbix-sender zabbix-agent zabbix-proxy-mysql zabbix-java-gateway
四、升级中遇到的问题
1、Processing Dependency: libpcre.so.0()(64bit) for package
报错信息如下:
yum upgrade zabbix-sender zabbix-agent zabbix-proxy-mysql zabbix-java-gateway
[root@reg zabbix-install]# yum upgrade zabbix-sender zabbix-agent zabbix-proxy-mysql zabbix-java-gateway Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror-hk.koddos.net * epel: mirrors.aliyun.com * extras: mirror-hk.koddos.net * updates: mirror-hk.koddos.net Package(s) zabbix-sender available, but not installed. Package(s) zabbix-java-gateway available, but not installed. Resolving Dependencies --> Running transaction check ---> Package zabbix-agent.x86_64 0:3.0.3-1.el7 will be updated ---> Package zabbix-agent.x86_64 0:4.0.19-1.el6 will be an update --> Processing Dependency: libpcre.so.0()(64bit) for package: zabbix-agent-4.0.19-1.el6.x86_64 ---> Package zabbix-proxy-mysql.x86_64 0:3.0.3-1.el7 will be updated ---> Package zabbix-proxy-mysql.x86_64 0:4.0.19-1.el6 will be an update --> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: zabbix-proxy-mysql-4.0.19-1.el6.x86_64 --> Processing Dependency: libevent-1.4.so.2()(64bit) for package: zabbix-proxy-mysql-4.0.19-1.el6.x86_64 --> Processing Dependency: libmysqlclient.so.16()(64bit) for package: zabbix-proxy-mysql-4.0.19-1.el6.x86_64 --> Processing Dependency: libpcre.so.0()(64bit) for package: zabbix-proxy-mysql-4.0.19-1.el6.x86_64 --> Processing Dependency: libnetsnmp.so.20()(64bit) for package: zabbix-proxy-mysql-4.0.19-1.el6.x86_64 --> Finished Dependency Resolution Error: Package: zabbix-proxy-mysql-4.0.19-1.el6.x86_64 (zabbix) Requires: libpcre.so.0()(64bit) Error: Package: zabbix-agent-4.0.19-1.el6.x86_64 (zabbix) Requires: libpcre.so.0()(64bit) Error: Package: zabbix-proxy-mysql-4.0.19-1.el6.x86_64 (zabbix) Requires: libevent-1.4.so.2()(64bit) Error: Package: zabbix-proxy-mysql-4.0.19-1.el6.x86_64 (zabbix) Requires: libmysqlclient.so.16(libmysqlclient_16)(64bit) Error: Package: zabbix-proxy-mysql-4.0.19-1.el6.x86_64 (zabbix) Requires: libnetsnmp.so.20()(64bit) Error: Package: zabbix-proxy-mysql-4.0.19-1.el6.x86_64 (zabbix) Requires: libmysqlclient.so.16()(64bit) You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest
错误原因:在CentOS7下,安装的zabbix源为CentOS6的
修改yum配置文件,修改为7
[zabbix] name=Zabbix Official Repository - $basearch baseurl=http://repo.zabbix.com/zabbix/4.0/rhel/7/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 [zabbix-debuginfo] name=Zabbix Official Repository debuginfo - $basearch baseurl=http://repo.zabbix.com/zabbix/4.0/rhel/7/$basearch/debuginfo/ enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 gpgcheck=1 [zabbix-deprecated] name=Zabbix Official Repository deprecated - $basearch baseurl=http://repo.zabbix.com/zabbix/4.0/rhel/7/$basearch/deprecated enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 [zabbix-non-supported] name=Zabbix Official Repository non-supported - $basearch baseurl=http://repo.zabbix.com/non-supported/rhel/7/$basearch/ enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX gpgcheck=1
再次升级安装,成功。
yum upgrade zabbix-sender-4.0.18 zabbix-agent-4.0.18 zabbix-proxy-mysql-4.0.18 zabbix-java-gateway-4.0.18
Loaded plugins: fastestmirror zabbix | 2.9 kB 00:00:00 zabbix-non-supported | 951 B 00:00:00 zabbix/x86_64/primary_db | 148 kB 00:00:00 zabbix-non-supported/x86_64/primary | 1.6 kB 00:00:00 Loading mirror speeds from cached hostfile * base: mirror-hk.koddos.net * epel: mirrors.aliyun.com * extras: mirror-hk.koddos.net * updates: mirror-hk.koddos.net zabbix-non-supported 4/4 Package(s) zabbix-sender-4.0.18 available, but not installed. Package(s) zabbix-java-gateway-4.0.18 available, but not installed. Resolving Dependencies --> Running transaction check ---> Package zabbix-agent.x86_64 0:3.0.3-1.el7 will be updated ---> Package zabbix-agent.x86_64 0:4.0.18-1.el7 will be an update ---> Package zabbix-proxy-mysql.x86_64 0:3.0.3-1.el7 will be updated ---> Package zabbix-proxy-mysql.x86_64 0:4.0.18-1.el7 will be an update --> Processing Dependency: libevent-2.0.so.5()(64bit) for package: zabbix-proxy-mysql-4.0.18-1.el7.x86_64 --> Running transaction check ---> Package libevent.x86_64 0:2.0.21-4.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ==================================================================================================================================== Package Arch Version Repository Size ==================================================================================================================================== Updating: zabbix-agent x86_64 4.0.18-1.el7 zabbix 419 k zabbix-proxy-mysql x86_64 4.0.18-1.el7 zabbix 780 k Installing for dependencies: libevent x86_64 2.0.21-4.el7 base 214 k Transaction Summary ==================================================================================================================================== Install ( 1 Dependent package) Upgrade 2 Packages Total download size: 1.4 M Is this ok [y/d/N]: y Downloading packages: Delta RPMs disabled because /usr/bin/applydeltarpm not installed. (1/3): libevent-2.0.21-4.el7.x86_64.rpm | 214 kB 00:00:00 warning: /var/cache/yum/x86_64/7/zabbix/packages/zabbix-agent-4.0.18-1.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY Public key for zabbix-agent-4.0.18-1.el7.x86_64.rpm is not installed (2/3): zabbix-agent-4.0.18-1.el7.x86_64.rpm | 419 kB 00:00:01 (3/3): zabbix-proxy-mysql-4.0.18-1.el7.x86_64.rpm | 780 kB 00:00:01 ------------------------------------------------------------------------------------------------------------------------------------ Total 777 kB/s | 1.4 MB 00:00:01 Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 Importing GPG key 0xA14FE591: Userid : "Zabbix LLC <packager@zabbix.com>" Fingerprint: a184 8f53 52d0 22b9 471d 83d0 082a b56b a14f e591 Package : zabbix-release-4.0-2.el6.noarch (installed) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 Is this ok [y/N]: y Running transaction check Running transaction test Transaction test succeeded Running transaction Warning: RPMDB altered outside of yum. Installing : libevent-2.0.21-4.el7.x86_64 1/5 Updating : zabbix-proxy-mysql-4.0.18-1.el7.x86_64 2/5 warning: /etc/zabbix/zabbix_proxy.conf created as /etc/zabbix/zabbix_proxy.conf.rpmnew Updating : zabbix-agent-4.0.18-1.el7.x86_64 3/5 warning: /etc/zabbix/zabbix_agentd.conf created as /etc/zabbix/zabbix_agentd.conf.rpmnew Cleanup : zabbix-proxy-mysql-3.0.3-1.el7.x86_64 4/5 Cleanup : zabbix-agent-3.0.3-1.el7.x86_64 5/5 Verifying : libevent-2.0.21-4.el7.x86_64 1/5 Verifying : zabbix-agent-4.0.18-1.el7.x86_64 2/5 Verifying : zabbix-proxy-mysql-4.0.18-1.el7.x86_64 3/5 Verifying : zabbix-agent-3.0.3-1.el7.x86_64 4/5 Verifying : zabbix-proxy-mysql-3.0.3-1.el7.x86_64 5/5 Dependency Installed: libevent.x86_64 0:2.0.21-4.el7 Updated: zabbix-agent.x86_64 0:4.0.18-1.el7 zabbix-proxy-mysql.x86_64 0:4.0.18-1.el7 Complete!