Centos系統zabbix-4.2.6升級zabbix-5.0
一菜秦、環(huán)境
Centos-7.6
MySQL-5.7.27
php-7.2(注:5.0版本要求php版本>=7.2.0)
httpd
二恩袱、升級過程
1缤弦、升級簡要
官方升級文檔:https://www.zabbix.com/documentation/5.0/manual/installation/upgrade/packages/rhel_centos
2、升級程序
2.1舍咖、停止zabbix相關進程
# systemctl stop zabbix-server
# systemctl stop zabbix-proxy
# systemctl stop zabbix-agent
2.2祝钢、備份數據庫
# mysqldump -uzabbix -pzabbix --opt --skip-lock-tables zabbix | gzip > /home/backup/zabbix_$(date +%Y%m%d_%H%M%S).sql.gz
2.3、備份二進制文件以及相關配置文件
# mkdir /opt/zabbix-backup/
# cp /etc/zabbix/zabbix_server.conf /opt/zabbix-backup/ 或者備份整個/etc/zabbix/文件夾漓摩。
# cp /etc/httpd/conf.d/zabbix.conf /opt/zabbix-backup/
# cp -R /usr/share/zabbix/ /opt/zabbix-backup/
# cp -R /usr/share/doc/zabbix-* /opt/zabbix-backup/
2.4、更新存儲庫配置包
# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
# vim /etc/yum.repos.d/zabbix.repo
修改 [zabbix-frontend]欄目 enabled=0膊爪,enabled=1
[zabbix-frontend]
...
enabled=1
...
# 如果下面的操作下載很慢自阱,建議用阿里云的倉庫,如下蚁飒。
# vim /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-frontend]
name=Zabbix Official Repository frontend - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/$basearch/frontend
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-debuginfo]
name=Zabbix Official Repository debuginfo - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/$basearch/debuginfo/
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
gpgcheck=0
[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=0
2.5动壤、升級zabbix組件
# yum upgrade zabbix-server-mysql zabbix-web-mysql zabbix-agent -y
2.6萝喘、升級zabbix前端
# 卸載舊前端包
# yum remove zabbix-web-* -y
#安裝SCL存儲庫
# yum install centos-release-scl -y
#安裝新的前端包
# yum install zabbix-web-mysql-scl zabbix-apache-conf-scl -y
#更新php-fpm時區(qū)
vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
php_value[date.timezone] = Asia/Shanghai
2.7淮逻、升級剩余zabbix包
# yum update zabbix-* -y
# rpm -qa|grep zabbix
2.8、啟動
# systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
# systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
三阁簸、問題詳解
1爬早、字符集報錯:
Unsupported charset or collation for tables。启妹。筛严。。
解決方法:
#修改字符集
# ALTER DATABASE `zabbix` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
# 找出字符檢驗集不對的表
#SELECT CONCAT("ALTER TABLE ", TABLE_NAME," CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;") AS ExecuteTheString
FROM information_schema.`COLUMNS`
WHERE table_schema = "zabbix" AND COLLATION_NAME = "utf8_general_ci";
復制輸出結果饶米,并執(zhí)行語句
2桨啃、Database history tables upgraded
#修改php文件
# vim /etc/zabbix/web/zabbix.conf.php
$DB['DOUBLE_IEEE754'] = true;
3、中文字體亂碼
# vim /usr/share/zabbix/include/defines.inc.php
# ll /usr/share/zabbix/assets/fonts
上傳電腦上的字體檬输。并修改上述文件照瘾。
更換字體,