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