1. 程式人生 > >zabbix3.2.6.1升級3.4.4圖文心得

zabbix3.2.6.1升級3.4.4圖文心得

zabbix zabbix升級 zabbix3.4.4

為了在升級過程中將停機時間和數據丟失降低到最小,建議先停機升級Zabbix server,然後再逐個停機升級和啟動Zabbix proxy。當所有的Proxy升級完畢後,再啟動Zabbix Server。在Zabbix server的停機期間,運行狀態的Proxy將會持續收集和存儲數據,並在Zabbix server啟動運行時,將這些數據發送給Zabbix server。在Zabbix server停機期間的任何問題(problems)的通知(notifications),只會在升級完後的server啟動後再生成。

1、首先備份yum源,備份zabbix server的配置文件,備份zabbix,升級zabbix yum源

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

2、停掉zabbix server,如果升級zabbix proxy,也需要停掉zabbix proxy

# systemctl stop zabbix-server
# systemctl stop zabbix-proxy

3、備份zabbix web資料夾

cp -R /data/www/zabbix ~/zabbixbak/    #備份zabbix web配置

4、升級zabbix

首先查詢安裝了哪些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

5、根據需要,我們升級主要的服務:

yum upgrade zabbix-proxy-mysql zabbix-web-mysql zabbix-server-mysql zabbix-web zabbix-agent

6、等待升級完成

7、拷貝zabbix web 3.44到web目錄,修改zabbix web的目錄屬組

cp -R /usr/share/zabbix /data/www/
chown -R apache:apache /data/www/zabbix

修復趨勢圖中文字體,我之前使用的微軟雅黑,所以直接copy備份中的字體,如果沒有請copy上傳windows系統中的中文字體

# 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');

8、重啟zabbix

# systemctl start zabbix-server
# systemctl start zabbix-proxy
# systemctl start zabbix-agent

9、打開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

可以查看系統要求的參數,如果不符合根據提示修改

技術分享圖片

按照提示完成配置即可

技術分享圖片

zabbix3.2.6.1升級3.4.4圖文心得