CentOS6.5下Zabbix3.0升级到4.0
CentOS6.5下Zabbix3.4至Zabbix4.0的升级步骤
一、查看当前各软件版本号
OS层面
操作系统版本为centos6.5
[root@vm172-31-0-21 share]# cat /etc/redhat-release CentOS release 6.5 (Final)
内核版本为2.6.32,64bit
[root@vm172-31-0-21 share]# uname -a Linux vm172-31-0-21.ksc.com 2.6.32-504.30.3.el6.x86_64 #1 SMP Wed Jul 15 10:13:09 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
应用层面
PHP版本:5.6.40
[root@vm172-31-0-21 share]# php -v PHP 5.6.40 (cli) (built: Jan 12 2019 09:19:57) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
Nginx版本和编译模块
[root@vm172-31-0-21 share]# nginx -V nginx version: nginx/1.16.1 built by gcc 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC) built with OpenSSL 1.0.1e-fips 11 Feb 2013 TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie'
PHP-FPM版本
[root@vm172-31-0-21 share]# php-fpm -v PHP 5.6.40 (fpm-fcgi) (built: Jan 12 2019 09:22:33) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
业务层面
[root@vm172-31-0-21 share]# zabbix_server -V zabbix_server (Zabbix) 3.0.30 Revision f25037a887 24 February 2020, compilation time: Feb 27 2020 04:25:44 Copyright (C) 2020 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. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/). Compiled with OpenSSL 1.0.1e-fips 11 Feb 2013 Running with OpenSSL 1.0.1e-fips 11 Feb 2013 [root@vm172-31-0-21 share]#
二、备份
1、备份数据库
数据库全备时间比较长且文件交大,建议压缩或者使用xtrabackup, 此处采用mysqldump。
mysqldump -uzabbix -pzabbix --opt --skip-lock-tables --database zabbix | gzip > zabbix_`date +'%Y%m%d%H%M%S'`.sql.gz
2、备份应用配置
mkdir /data/web-backup/ #创建一个空文件 cp /etc/php.ini /data/web-backup/ #PHP配置文件 cp /etc/php-fpm.d/www.conf /data/web-backup/ #PHP-fpm配置文件 cp /etc/nginx/nginx.conf /data/web-backup/ #Nginx配置文件
3、备份业务配置
mkdir /data/zabbix-backup/ #创建一个空文件 cp /etc/zabbix/zabbix_server.conf /data/zabbix-backup/ cp -R /usr/share/zabbix/ /data/zabbix-backup/ cp -R /usr/share/doc/zabbix-* /data/zabbix-backup/
三、升级Zabbix
1、停止服务
service zabbix-server stop service zabbix-agent stop service nginx stop
2、升级zabbix源
rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/6/x86_64/zabbix-release-4.0-2.el6.noarch.rpm
3、升级zabbix
yum clean all yum upgrade zabbix-sender zabbix-agent zabbix-proxy-mysql zabbix-java-gateway
注意:由于centOS6在zabbix4.0版本上无法直接yum upgrade,有些包在yum仓库里面放入了deprecated文件,具体原因也未知,所以需要下载下来进行安装。
可以直接一键升级:
rpm -Uvh zabbix-server-mysql-4.0.18-1.el6.x86_64.rpm zabbix-web-4.0.18-1.el6.noarch.rpm zabbix-web-mysql-4.0.18-1.el6.noarch.rpm
4、启动服务
service zabbix-server start service zabbix-agent start service nginx start
5、升级后验证
6、升级过程中遇到的问题
a、curl: (35) SSL connect error
解决方式:
yum -y update nss ldconfig
b、libevent-1.4.so.2()(64bit) is needed by zabbix-proxy-mysql-4.0.18-1.el6.x86_64
c、升级rpm包
rpm -Uvh zabbix-web-4.0.18-1.el6.noarch.rpm zabbix-web-mysql-4.0.18-1.el6.noarch.rpm
rpm -Uvh zabbix-server-mysql-4.0.18-1.el6.x86_64.rpm
d、字体修改
yum install wqy-microhei-fonts -y cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/zabbix/assets/fonts/graphfont.ttf