爲了在升級過程當中將停機時間和數據丟失下降到最小,建議先停機升級Zabbix server,而後再逐個停機升級和啓動Zabbix proxy。當全部的Proxy升級完畢後,再啓動Zabbix Server。在Zabbix server的停機期間,運行狀態的Proxy將會持續收集和存儲數據,並在Zabbix server啓動運行時,將這些數據發送給Zabbix server。在Zabbix server停機期間的任何問題(problems)的通知(notifications),只會在升級完後的server啓動後再生成。php
一、首先備份yum源,備份zabbix server的配置文件,備份zabbix,升級zabbix yum源
java
cp /etc/yum.repos.d/zabbix.repo /etc/yum.repos.d/zabbix.repo.bak #備份yum源 cp /etc/zabbix/zabbix_server.conf ~/zabbixbak/ #備份zabbix配置 cp /etc/httpd/conf.d/zabbix.conf ~/zabbixbak/ #備份apache中zabbix配置 mysqldump -uroot --single-transaction --default-character-set=utf8 -ppassword zabbix > zabbixbak2017.sql #備份zabbix庫 [root@zabbix bin]# rpm -Uvh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm #升級zabbix的yum 源 Preparing... ################################# [100%] Updating / installing... 1:zabbix-release-3.4-2.el7 ################################# [100%] [root@zabbix bin]# yum makecache fast
二、停掉zabbix server,若是升級zabbix proxy,也須要停掉zabbix proxymysql
# systemctl stop zabbix-server # systemctl stop zabbix-proxy
三、備份zabbix web資料夾web
cp -R /data/www/zabbix ~/zabbixbak/ #備份zabbix web配置
四、升級zabbixsql
首先查詢安裝了哪些zabbix應用數據庫
[root@zabbix ~]# rpm -qa | grep zabbix zabbix-proxy-mysql-3.2.6-1.el7.x86_64 zabbix-sender-3.2.6-1.el7.x86_64 zabbix-web-mysql-3.2.6-1.el7.noarch zabbix-web-3.2.6-1.el7.noarch zabbix-get-3.2.6-1.el7.x86_64 zabbix-server-mysql-3.2.6-1.el7.x86_64 zabbix-release-3.4-2.el7.noarch zabbix-agent-3.2.6-1.el7.x86_64 zabbix-java-gateway-3.2.6-1.el7.x86_64
五、根據須要,咱們升級主要的服務:apache
yum upgrade zabbix-proxy-mysql zabbix-web-mysql zabbix-server-mysql zabbix-web zabbix-agent
六、等待升級完成
windows
七、拷貝zabbix web 3.44到web目錄,修改zabbix web的目錄屬組centos
cp -R /usr/share/zabbix /data/www/ chown -R apache:apache /data/www/zabbix
修復趨勢圖中文字體,我以前使用的微軟雅黑,因此直接copy備份中的字體,若是沒有請copy上傳windows系統中的中文字體bash
# cp /data/www/zabbixbak/fonts/msy* /data/www/zabbix/fonts/
修改php字體的配置
# sed -i 's/graphfont/msyh/g' /data/www/zabbix/include/defines.inc.php | grep msyh
define('ZBX_GRAPH_FONT_NAME', 'msyh'); // font file name define('ZBX_FONT_NAME', 'msyh');
八、重啓zabbix
# systemctl start zabbix-server # systemctl start zabbix-proxy # systemctl start zabbix-agent
九、打開zabbix web網址 http://<ip>/zabbix/setup.php
能夠經過setup檢測和從新配置,檢測從新配置後建議移除setup.php
若是提示database問題,請查看日誌
# tail -n 100 /var/log/zabbix/zabbix_server.log
48397:20171215:233509.873 enabling SNMP agent checks on host "10.1.254.19": host became available 48342:20171215:234424.931 Got signal [signal:15(SIGTERM),sender_pid:58214,sender_uid:0,reason:0]. Exiting ... 48342:20171215:234426.933 syncing history data... 48342:20171215:234426.934 syncing history data done 48342:20171215:234426.934 syncing trend data... 48342:20171215:234431.010 syncing trend data done 48342:20171215:234431.010 Zabbix Server stopped. Zabbix 3.4.4 (revision 74338). 58349:20171215:234703.850 Starting Zabbix Server. Zabbix 3.4.4 (revision 74338). 58349:20171215:234703.850 ****** Enabled features ****** 58349:20171215:234703.850 SNMP monitoring: YES 58349:20171215:234703.850 IPMI monitoring: YES 58349:20171215:234703.850 Web monitoring: YES 58349:20171215:234703.850 VMware monitoring: YES 58349:20171215:234703.850 SMTP authentication: YES 58349:20171215:234703.850 Jabber notifications: YES 58349:20171215:234703.850 Ez Texting notifications: YES 58349:20171215:234703.850 ODBC: YES 58349:20171215:234703.851 SSH2 support: YES 58349:20171215:234703.851 IPv6 support: YES 58349:20171215:234703.851 TLS support: YES 58349:20171215:234703.851 ****************************** 58349:20171215:234703.851 using configuration file: /etc/zabbix/zabbix_server.conf 58349:20171215:234703.857 current database version (mandatory/optional): 03020000/03040005 58349:20171215:234703.857 required mandatory version: 03040000 58349:20171215:234704.240 server #0 started [main process]
zabbix官網升級說明:
Zabbix server將會自動升級數據庫。開始後,Zabbix server報告當前(強制和非強制的)和須要的數據庫版本。若是當前強制版本低於須要的版本,Zabbix server自動執行所須要的數據庫補丁。數據庫升級的開始和進度信息(百分比)將會寫入Zabbix server的日誌文件中。當升級完成後,將會在日誌文件中寫入一條「database upgrade fully completed」的信息。若是任何升級補丁失敗,Zabbix server將不會啓動,即便數據庫當前強制版本比所需版本高,Zabbix server也不會啓動。只有當數據庫當前的強制版本與須要的強制版本相符時,Zabbix server纔會啓動。
8673:20161117:104750.259 current database version (mandatory/optional): 03040000/03040000 8673:20161117:104750.259 required mandatory version: 03040000
修改數據庫中的配置
[root@zabbix ~]# mysql -uroot -pmysqlpass Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 59371 Server version: 10.1.24-MariaDB MariaDB Server Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> use zabbix; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A MariaDB [zabbix]> update dbversion set mandatory=03040000; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0
能夠查看系統要求的參數,若是不符合根據提示修改
按照提示完成配置便可