Zabbix版本升级方案测试,4.0版本升级至5.4版本

Posted 我的紫霞辣辣

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Zabbix版本升级方案测试,4.0版本升级至5.4版本相关的知识,希望对你有一定的参考价值。

注:此方案会导致zabbix的web页面会有一些监控项不兼容现象,只适用于项目平缓过度阶段,后期还是建议agent和server的版本一致。

Zabbix升级方案物理资源

Zabbix升级方案

注意:zabbix server与zabbix proxy版本必须一致,agent可以是低版本。

基础环境配置

主机名IP说明
zabbix01192.168.15.201zabbix agent 4.0版本
zabbix02192.168.15.202zabbix server 4.0版本
zabbix05192.168.15.205zabbix proxy 4.0版本
zabbix 03192.168.15.203zabbix server 5.4版本
zabbix 04192.168.15.204zabbix proxy 5.4版本

所有主机的都配置hosts解析

vim /etc/hosts
192.168.15.201 zabbix01
192.168.15.202 zabbix02
192.168.15.205 zabbix05
192.168.15.203 zabbix03
192.168.15.204 zabbix04

安装zabbix server4.0版本

1. 获取zabbix官方源
rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm

2. zabbix默认的源默认是在国外的源,将国外的zabbix源地址替换成阿里云的地址
sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#' /etc/yum.repos.d/zabbix.repo

3. 清空缓存
yum clean all
yum makecache

4. 安装zabbix server和agent
yum -y install zabbix-server-mysql zabbix-agent 

5. 删除系统默认自带的php5.4版本
rpm -qa |grep php
yum -y remove php* &>/dev/null
rpm -qa |grep php

5.1 更改yum源
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm   
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

5.2 安装php7.2版本和各种扩展
yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml

6. 修改zabbix-frontend前端源,开启enabled参数
vim /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/$basearch/
enabled=1	# 修改这里
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE59

7. 下载zabbix前端环境
yum install zabbix-web-mysql zabbix-apache-conf -y

8. 在下zabbix所需的数据库,直接用centos自带的mariadb
yum install mariadb-server -y

9. 启动数据库并设置开机自启
systemctl enable --now mariadb

10. 初始化数据库,设置root密码
mysql_secure_installation

# 输入当前root密码(直接回车)
# Enter current password for root (enter for none):

# 设置root密码
# Set root password? [Y/n] y
# New password: 
# Re-enter new password:

# 是否移除匿名用户
# Remove anonymous users? [Y/n] y

# 是否禁止root远程登陆
# Disallow root login remotely? [Y/n] n

# 是否移除测试数据库
# Remove test database and access to it? [Y/n] y

# 是否刷新授权表
# Reload privilege tables now? [Y/n] y

11. 使用root用户登陆mariadb,建立zabbix数据库,这里的编码设置,非常重要,否则zabbix无法安装
mysql -uroot -p123
# 创建一个zabbix库,并且设置zabbix的字符编码(utf-8)
create database zabbix character set utf8 collate utf8_bin;
# 创建一个zabbix用户
create user zabbix@localhost identified by '123';
# zabbix用户在zabbix库中的所有表,授予所有的权限
grant all privileges on zabbix.* to zabbix@localhost;
# 刷新授权表
flush privileges;
# 退出
exit

12. 使用zabbix-mysql命令,导入数据库信息
# mysql -u用户名 -p密码 库名
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

13. 修改zabbix server配置文件,修改数据库的密码
vim /etc/zabbix/zabbix_server.conf 
...
DBPassword=123

14. 修改zabbix的php配置文件中的时区
vim /etc/httpd/conf.d/zabbix.conf
...
php_value[date.timezone] = Asia/Shanghai

15. 修改php配置文件
vim /etc/php.ini
...
post_max_size = 500M
max_execution_time = 500
max_input_time = 500
date.timezone = Asia/Shanghai

16. 启动zabbix服务器,设置开机自启
systemctl restart zabbix-server zabbix-agent httpd php-fpm
systemctl enable zabbix-server zabbix-agent httpd php-fpm

安装zabbix proxy 4.0版本

1. 获取zabbix官方源
rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm

2. zabbix默认的源默认是在国外的源,将国外的zabbix源地址替换成阿里云的地址
sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#' /etc/yum.repos.d/zabbix.repo

3. 清空缓存
yum clean all
yum makecache

4. 安装proxy 和 数据库
yum -y install zabbix-proxy-mysql zabbix-get mariadb-server mariadb

5. 启动数据库,配置数据库用户,存储zabbix-agent2信息数据
systemctl start mariadb
mysql -uroot -p
create database zabbix_proxy character set utf8 collate utf8_bin;
grant all privileges on zabbix_proxy.* to zabbix@"localhost" identified by "zabbix";
flush privileges;
exit

6. 导入zabbix数据库信息
rpm -ql zabbix-proxy-mysql		# 查询sql文件在哪
zcat /usr/share/doc/zabbix-proxy-mysql-4.0.37/schema.sql.gz | mysql -uzabbix -pzabbix zabbix_proxy

7. 修改zabbix-proxy配置文件,链接数据库的信息
sed -i.ori "162a DBPassword=zabbix" /etc/zabbix/zabbix_proxy.conf
sed -i "s#Server=127.0.0.1#Server=192.168.15.202#" /etc/zabbix/zabbix_proxy.conf		# 服务端ip
sed -i "s#Hostname=Zabbix proxy#Hostname=zabbix05#" /etc/zabbix/zabbix_proxy.conf		# 代理服务器的主机名

8. 检查zabbix-proxy的配置文件信息
grep "^[a-Z]" /etc/zabbix/zabbix_proxy.conf
# Server=192.168.15.202
# Hostname=zabbix05
# LogFile=/var/log/zabbix/zabbix_proxy.log
# LogFileSize=0
# PidFile=/var/run/zabbix/zabbix_proxy.pid
# SocketDir=/var/run/zabbix
# DBPassword=zabbix
# DBName=zabbix_proxy
# DBUser=zabbix
# SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
# Timeout=4
# ExternalScripts=/usr/lib/zabbix/externalscripts
# LogSlowQueries=3000

9. 启动代理服务
systemctl restart zabbix-proxy 

安装zabbix agentd4.0版本

1. 获取zabbix官方源
rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm

2. zabbix默认的源默认是在国外的源,将国外的zabbix源地址替换成阿里云的地址
sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#' /etc/yum.repos.d/zabbix.repo

3. 清空缓存
yum clean all
yum makecache

4. 安装agent2
yum -y install zabbix-agent

5. 查看配置文件和启动命令
# 配置文件
ll  /etc/zabbix/zabbix_agentd.conf 
# 启动命令
ll /usr/sbin/zabbix_agentd

6. 启动agents并设置开启自启
systemctl enable --now zabbix-agent.service

7. 检查agents的端口号
netstat -lntp | grep agentd
tcp        0      0 0.0.0.0:10050           0.0.0.0:*               LISTEN      17507/zabbix_agentd 
tcp6       0      0 :::10050                :::*                    LISTEN      17507/zabbix_agentd 

8. 查看systemctl管理的单元文件
cat /lib/systemd/system/zabbix-agent.service 

9. 修改agents配置文件,修改如下,添加zabbix-server主机ip和主机名
vim /etc/zabbix/zabbix_agentd.conf 
...
Server=192.168.15.205			# 改成proxy地址
ServerActive=192.168.15.205		# 改成proxy地址
Hostname=zabbix01			# 修改成当前客户端的主机名

10. 查看agents配置文件修改后的内容
grep -Ev "^#|^$" /etc/zabbix/zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=192.168.15.205
ServerActive=192.168.15.205
Hostname=zabbix01
Include=/etc/zabbix/zabbix_agentd.d/*.conf

11. 重启agent
systemctl restart zabbix-agent.service



安装zabbix server5.4版本

Mysql数据库组件安装

# 数据库客户端程序
wget https://downloads.percona.com/downloads/Percona-Server-LATEST/Percona-Server-8.0.23-14/binary/redhat/7/x86_64/percona-server-client-8.0.23-14.1.el7.x86_64.rpm	

# 数据库主程序
wget https://downloads.percona.com/downloads/Percona-Server-LATEST/Percona-Server-8.0.23-14/binary/redhat/7/x86_64/percona-server-server-8.0.23-14.1.el7.x86_64.rpm

# 数据库主程序依赖
wget https://downloads.percona.com/downloads/Percona-Server-LATEST/Percona-Server-8.0.23-14/binary/redhat/7/x86_64/percona-server-shared-8.0.23-14.1.el7.x86_64.rpm

# 数据库主程序依赖
wget https://downloads.percona.com/downloads/Percona-Server-LATEST/Percona-Server-8.0.23-14/binary/redhat/7/x86_64/percona-server-shared-compat-8.0.23-14.1.el7.x86_64.rpm

# MySQL驱动依赖程序包
wget https://downloads.percona.com/downloads/Percona-Server-LATEST/Percona-Server-8.0.23-14/binary/redhat/7/x86_64/percona-server-devel-8.0.23-14.1.el7.x86_64.rpm

# 安装数据库
yum install -y *.rpm
# 数据库初始化
mysqld --defaults-file=/etc/my.cnf --datadir=/data --user=mysql --initialize-insecure
systemctl start mysqld

# 查看数据库密码
cat /var/log/mysqld.log | grep password		

# 登陆数据库
mysql -uroot -p(密码)

# 重新设置数据库管理员密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Na123***' PASSWORD EXPIRE NEVER;

# 创建zabbix服务相关数据
create user zabbix@"%" identified by 'Na123***';

create database zabbix character set utf8 collate utf8_bin;

grant all privileges on zabbix.* to 'zabbix'@'%';

# 刷新授权表
flush privileges;
exit;

# 将mysqld设置为开机自启
systemctl enable mysqld

Zabbix Server安装

# zabbix功能依赖安装
yum install -y libxml2-devel net-snmp-devel libssh2-devel OpenIPMI-devel libevent-devel openldap-devel libcurl-devel gcc gcc-c++ unixODBC-devel

# 下载zabbix5.4.0安装包
wget https://cdn.zabbix.com/zabbix/sources/stable/5.4/zabbix-5.4.0.tar.gz

# 解压
tar -xf zabbix-5.4.0.tar.gz

# 编译安装,激活server和agent所有需要的功能
cd zabbix-5.4.0/
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-net-snmp --with-libcurl --with-libxml2 --with-mysql --with-openipmi --with-ldap --with-ssh2 --with-unixodbc --with-libenvent

# 编译安装
make install

修改zabbix配置文件

# 修改本机的agentd配置文件
vim /usr/local/zabbix/etc/zabbix_agentd.conf
LogFile=/tmp/zabbix_agentd.log
Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=Zabbix server

# 修改本机的zabbix_server配置文件
vim /usr/local/zabbix/etc/zabbix_server.conf
LogFile=/tmp/zabbix_server.log
DBName=zabbix
DBUser=zabbix
DBPassword=Na123***
Timeout=4
LogSlowQueries=3000
StatsAllowedIP=0.0.0.0

# 将zabbix的组件数据导入Mysql数据库
mysql -uzabbix -p"Na123***" zabbix < database/mysql/schema.sql
mysql -uzabbix -p"Na123***" zabbix < database/mysql/images.sql
mysql -uzabbix -p"Na123***" zabbix < database/mysql/data.sql

添加zabbix-server的systemctl管理

# 服务启动脚本
vim /usr/lib/systemd/system/zabbix-server.service
[Unit]
Description=Zabbix Server
After=syslog.target
After=network.target
After=mysql.service
After=mysqld.service
After=mariadb.service
After=postgresql.service

[Service]
Environment="CONFFILE=/usr/local/zabbix/etc/zabbix_server.conf"
Type=forking
Restart=on-failure
PIDFile=/tmp/zabbix_server.pid
KillMode=control-group
ExecStart=/usr/local/zabbix/sbin/zabbix_server -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
TimeoutSec=0

[Install]
WantedBy=multi-user.target

添加zabbix-server的systemctl管理

# Agent启动脚本
vim /usr/lib/systemd/system/zabbix-agent.service 
[Unit]
Description=Zabbix Agent
After=syslog.target
After=network.target

[Service]
Environment="CONFFILE=/usr/local/zabbix/etc/zabbix_agentd.conf"
Type=forking
Restart=on-failure
PIDFile=/tmp/zabbix_agentd.pid
KillMode=control-group
ExecStart=/usr/local/zabbix/sbin/zabbix_agentd -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
User=zabbix
Group=zabbix

[Install]
WantedBy=multi-user.target

启动zabbix服务

useradd zabbix
systemctl daemon-reload 
systemctl enable zabbix-agent
systemctl start zabbix-agent
systemctl enable zabbix-server
systemctl start zabbix-server

PHP安装

# libzip版本要求⼤于0.11
wget http://packages.psychotic.ninja/7/plus/x86_64/RPMS/libzip-devel-0.11.2-6.el7.psychotic.x86_64.rpm 		

# libzip版本要求⼤于0.11
wget http://packages.psychotic.ninja/7/plus/x86_64/RPMS/libzip-0.11.2-6.el7.psychotic.x86_64.rpm 		

# 正则依赖包
wget http://mirrors.163.com/centos/7/cloud/x86_64/openstack-queens/Packages/o/oniguruma-6.7.0-1.el7.x86_64.rpm 		

# 正则依赖包
wget http://mirrors.163.com/centos/7/cloud/x86_64/openstack-queens/Packages/o/oniguruma-devel-6.7.0-1.el7.x86_64.rpm 		

# 依赖
yum -y install libzip-devel-0.11.2-6.el7.psychotic.x86_64.rpm libzip-0.11.2-6.el7.psychotic.x86_64.rpm oniguruma-6.7.0-1.el7.x86_64.rpm oniguruma-devel-6.7.0-1.el7.x86_64.rpm

# 依赖
yum -y install libxml2-devel openssl-devel libcurl-devel libjpeg-devel libpng-devel freetype-devel php-ldap openldap-devel sqlite-devel libxslt-devel libdap*

# 安装php-7.4.20.tar.gz
wget http://php.net/distributions/php-7.4.20.tar.gz
tar -xf php-7.4.20.tar.gz
cd php-7.4.20
ln -sv /usr/lib64/libldap* /usr/lib
ln -sv /usr/lib64/libdap* /usr/lib

./configure \\
--prefix=/usr/local/php \\
--with-config-file-path=/usr/local/php \\
--with-curl \\
--with-freetype \\
--enable-gd \\
--with-jpeg \\
--with-gettext \\
--with-kerberos \\
--with-libdir=lib64 \\
--with-libxml \\
--with-mysqli \\
--with-ldap \\
--with-openssl \\
--with-pdo-mysql \\
--with-pear \\
--enable-sockets \\
--with-mhash \\
--with-ldap-sasl \\
--with-xsl \\
--with-zlib \\
--enable-fpm \\
--enable-bcmath \\
--enable-mbregex \\
--enable-mbstring \\
--enable-opcache \\
--enable-pcntl \\
--enable-shmop \\
--enable-soap \\
--enable-sockets \\
--enable-sysvsem \\
--enable-xml \\
--with-zip

vim Makefile
...
EXTRA_LIBS = -lcrypt -lresolv -lcrypt -lrt -lutil -lrt -lm -ldl -lxml2 -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -lsqlite3 -lz -lcurl -lxml2 -lz -lpng15 -ljpeg -lfreetype -lonig -lsqlite3 -lxml2 -lxml2 -lxml2 -lxml2 -lxml2 -lxslt -lz -ldl -lm -lxml2 -lexslt -lxslt -lz -lm -lgcrypt -ldl -lgpg-error -lxml2 -lzip -lz -lz -lssl -lcrypto -lcrypt -ldap_msgfree -llber 

make && make install

cp php.ini-production /usr/local/php/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf

修改php配置文件

vim /usr/local/php/php.ini
...
post_max_size = 16M
max_execution_time = 3000
max_input_time = 3000
date.timezone = Asia/Shanghai
memory_limit = 256M
# 安装zabbix之后登陆报错:Error connecting to database: No such file or directory。
# 需要加上php-fpm连接数据库的sock的配置参数后,重启php-fpm和nginx服务。
mysqli.default_socket = /var/lib/mysql/mysql.sock
vim /usr/local/php/etc/php-fpm.d/www.conf
...
pm.max_children = 30 
pm.start_servers = 10 
pm.min_spare_servers = 10 
pm.max_spare_servers = 24 
pm.max_requests = 500

添加zabbix-server的systemctl管理

# php启动脚本
vim /usr/lib/systemd/system/php-fpm.service
[Unit]
Description=The PHP FastCGI Process Manager
After=network.target

[Service]
Type=simple
PIDFile=/usr/local/php/var/run/php-fpm.pid
ExecStart=/usr/local/php/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

启动php服务

systemctl daemon-reload
systemctl enable php-fpm
systemctl start php-fpm

Nginx安装及初始化

# 下载Nginx安装包
wget http://nginx.org/download/nginx-1.20.1.tar.gz

# 解压
tar -xf nginx-1.20.1.tar.gz

# 下载Nginx依赖包
yum install -y bzip2 pcre-devel zlib-devel

# 编译安装Nginx
cd nginx-1.20.1/

 ./configure --prefix=/usr/local/nginx --with-http_dav_module --with-http_stub_status_module --with-http_addition_module --with-http_sub_module --with-http_ssl_module --with-http_gzip_static_module --with-pcre

make && make install

修改Nginx主配置文件

# Nginx主配置文件模板
vim /usr/local/nginx/conf/nginx.conf
worker_processes 3;
worker_cpu_affinity auto;
error_log /tmp/nginx_error.log warn;
pid logs/nginx.pid;
worker_rlimit_nofile 65535;
events 
 use epoll;
 worker_connections 65535;

http 
 include mime.types;
 default_type application/octet-stream;
 access_log off;
 sendfile on;
  server_names_hash_bucket_size 128;
 client_header_buffer_size 32k;
 large_client_header_buffers 4 32k;
 client_max_body_size 50m;
 tcp_nopush on;
 keepalive_timeout 60;
 tcp_nodelay on;
 fastcgi_cache_path /tmp/nginx_cache levels=1:2 keys_zone=cachephp:30m inactive=1d
max_size=2g;
 fastcgi_cache cachephp;
 fastcgi_cache_key "$request_method://$host$request_uri";
 fastcgi_cache_methods GET HEAD;
 fastcgi_ignore_client_abort on;
 fastcgi_connect_timeout 300;
 fastcgi_send_timeout 300;
 fastcgi_read_timeout 300;
 fastcgi_buffer_size 64k;
 fastcgi_buffers 8 128k;
 fastcgi_busy_buffers_size 128k;
 fastcgi_temp_file_write_size 256k;
 fastcgi_cache_valid 200 302 1h;
 fastcgi_cache_valid 301 1d;
 fastcgi_cache_valid any 1m;
 fastcgi_cache_min_uses 1;
 fastcgi_cache_use_stale error timeout invalid_header http_500;
 open_file_cache max=204800 inactive=20s;
 open_file_cache_min_uses 1;
 open_file_cache_valid 30s;
 gzip on;
 gzip_min_length 1k;
 gzip_buffers 4 16k;
 gzip_http_version 1.0;
 gzip_comp_level 2;
 gzip_types text/plain application/x-javascript text/css application/xml;
 gzip_vary on;
 gzip_proxied expired no-cache no-store private auth;
 gzip_disable "MSIE [1-6]\\.";
 server_tokens off;
 open_file_cache_errors on;
 add_header X-Cache "$upstream_cache_status";
 fastcgi_temp_path /tmp/nginx_tmp;
 fastcgi_pass_header Set-Cookie;
 client_body_temp_path /tmp/client_body_temp;
 uwsgi_temp_path /tmp/uwsgi_temp;
 scgi_temp_path /tmp/scgi_temp;
 proxy_temp_path /tmp/proxy_temp;
 server 
 listen 8080;
 server_name localhost;
 location / 
 root /usr/local/nginx/html;
 index index.php index.html;
 
 location ~ \\.php$ 
 fastcgi_pass 127.0.0.1:9000;
 fastcgi_index index.php;
 fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
 include fastcgi_params;
 
 
 server 
 listen 80;
 server_name 192.168.15.203;
 location / 
 root /usr/local/nginx/html;
 index index.php index.html;
 proxy_redirect off;
 proxy_set_header Host $host;
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 proxy_pass http://127.0.0.1:3000/;
 
 location /admin/ 
 index index.php index.html;
 proxy_redirect off;
 proxy_set_header Host $host;
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 proxy_pass http://127.0.0.1:8080/;
 
 access_log off;
 

# 检查nginx配置文件是否正常 
/usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

添加nginx的systemctl管理

# Nginx启动脚本
vim /usr/lib/systemd/system/nginx.service
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target 

启动nginx服务

systemctl daemon-reload
systemctl restart nginx
systemctl enable nginx

前端文件处理

cd zabbix-5.4.0/
\\cp -r ui/* /usr/local/nginx/html/

配置zabbix连接数据的配置文件

cp /usr/local/nginx/html/conf/zabbix.conf.php.example /usr/local/nginx/html/conf/zabbix.conf.php

vim /usr/local/nginx/html/conf/zabbix.conf.php
...
$DB['TYPE']                             = 'MYSQL';
$DB['SERVER']                   = 'localhost';
$DB['PORT']                             = '3306';
$DB['DATABASE']             

以上是关于Zabbix版本升级方案测试,4.0版本升级至5.4版本的主要内容,如果未能解决你的问题,请参考以下文章

升级PowerShell至4.0版本

zabbix 3.4.x 二进制包升级至 Zabbix 4.0

ZABBIX4.0升级5.0 & ES6.1升级7.0

ZABBIX4.0升级5.0 & ES6.1升级7.0

TiDB集群运维之版本升级

阿里云zabbix镜像从2.4源码升级至3.2.1版本