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:// /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
可以查看系统要求的参数,如果不符合根据提示修改
按照提示完成配置即可
原文:http://blog.51cto.com/m51cto/2051888
来源: http://www.bubuko.com/infodetail-2433713.html