1. 程式人生 > 其它 >zabbix 從5.0升級到5.4

zabbix 從5.0升級到5.4

Upgrade procedure

1 Stop Zabbix processes

Stop Zabbix server to make sure that no new data is inserted into database.

# systemctl stop zabbix-server

If upgrading the proxy, stop proxy too.

# systemctl stop zabbix-proxy
It is no longer possible to start the upgraded server and have older, yet unupgraded proxies report data to a newer server. This approach, which was never recommended nor supported by Zabbix, now is officially disabled when upgrading to 5.0 (or later) from any version before 4.4, as the server will ignore data from unupgraded proxies.
2 Back up the existing Zabbix database

This is a very important step. Make sure that you have a backup of your database. It will help if the upgrade procedure fails (lack of disk space, power off, any unexpected problem).

3 Back up configuration files, PHP files and Zabbix binaries

Make a backup copy of Zabbix binaries, configuration files and the PHP file directory.

Configuration files:

# mkdir /opt/zabbix-backup/
# cp /etc/zabbix/zabbix_server.conf /opt/zabbix-backup/
# cp /etc/httpd/conf.d/zabbix.conf  /opt/zabbix-backup/

PHP files and Zabbix binaries:

# cp -R /usr/share/zabbix/ /opt/zabbix-backup/
# cp -R /usr/share/doc/zabbix-* /opt/zabbix-backup/

Backup MySQL

  

#mysqldump -uroot -p  zabbix >20210830
.sql
4 Update repository configuration package

To proceed with the upgrade your current repository package has to be updated.

# rpm -Uvh https://repo.zabbix.com/zabbix/5.4/rhel/8/x86_64/zabbix-release-5.4-1.el8.noarch.rpm
5 Upgrade Zabbix components

To upgrade Zabbix components you may run something like:

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

If using PostgreSQL, substitutemysqlwithpgsqlin the command. If upgrading the proxy, substituteserverwithproxyin the command. If upgrading the agent 2, substitutezabbix-agentwithzabbix-agent2in the command.

To upgrade the web frontend with Apacheon RHEL 8correctly, also run:

# yum install zabbix-apache-conf 

and make the necessarychangesto this file.

To upgrade the web frontendon RHEL 7followdistribution-specific instructions(extra steps are required to install PHP 7.2 or newer).

6 Review component configuration parameters

See the upgrade notes for details onmandatory changes.

7 Start Zabbix processes

Start the updated Zabbix components.

# systemctl start zabbix-server
# systemctl start zabbix-proxy
# systemctl start zabbix-agent
# systemctl start zabbix-agent2
Import sql
#msyql -uzabbix -p zabbix < 20210830.sql

zabbix3.2版本升級到zabbix3.4版本後開啟頁面報錯,報錯內容如下

問題一

Database error
The frontend does not match Zabbix database. Current database version (mandatory/optional): 5010000/5010000. Required mandatory version: 5040000. Contact your system administrator.

(圖片來自網路)

解決辦法:

進入資料庫

mysql> show databases;
mysql> use zabbix;
mysql> update dbversion set mandatory=5040000;
mysql> flush privileges;


重新開啟web即可解決

問題二

zabbix-server 無法啟動,檢視日誌

tail -f /var/log/zabbix/zabbix_server.log

9332:20181010:174337.188 [Z3005] query failed: [1050] Table 'tag_filter' already exists [create table tag_filter (
`tag_filterid` bigint unsigned not null,
`usrgrpid` bigint unsigned not null,
`groupid` bigint unsigned not null,
`tag` varchar(255) default '' not null,
`value` varchar(255) default '' not null,
primary key (tag_filterid)

Fix:

Login mysql

對log中提示的所有表都drop掉,直到提示upgrade 完成,這樣在瀏覽器上就可以正常開啟和登陸zabbix

use zabbix;
drop table tag_filter;
8 Clear web browser cookies and cache

After the upgrade you may need to clear web browser cookies and web browser cache for the Zabbix web interface to work properly.

本文來自希曼部落格-www.ximan.tech,作者:希曼部落格,轉載請註明原文連結:https://www.cnblogs.com/lihuaichen/p/15215708.html