美文网首页
Centos系统zabbix-4.2.6升级zabbix-5.0

Centos系统zabbix-4.2.6升级zabbix-5.0

作者: 苏米西 | 来源:发表于2021-02-23 15:46 被阅读0次

    Centos系统zabbix-4.2.6升级zabbix-5.0

    一、环境

    • 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

    image.png

    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时区
    vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
    php_value[date.timezone] = Asia/Shanghai
    
    image.png
    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。。。。


    image.png

    解决方法:

    #修改字符集
    # 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";
    

    复制输出结果,并执行语句

    image.png
    2、Database history tables upgraded
    image.png
    #修改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
    上传电脑上的字体。并修改上述文件。
    

    更换字体,

    image.png

    相关文章

      网友评论

          本文标题:Centos系统zabbix-4.2.6升级zabbix-5.0

          本文链接:https://www.haomeiwen.com/subject/prnrfltx.html