Zabbix5.0 upgrade to 6.0 certification training, only need 6 hours (not 5 days) click to sign up .
Thanks to Wang Huixin, the author of this article, ZCP-Zabbix Senior Certified Engineer
Table of contents
1. Solution description
2. Environment description
3. Mysql environment deployment
3.1 mysql installation
3.2 configure mysql
3.3 create zabbix library
4. Zabbix Server upgrade
4.1 Backup before upgrade
4.2 Authorize new database
4.3 Import Zabbix5.0 data structure
4.4 Import old database backup Zabbix configuration data
4.5 Add primary key for new database history table 4.6
Create table partition for new database
4.7 Create event scheduler
4.8 Upgrade Zabbix related services
4.9 Zabbix service check
4.10 failed rollback
plan description
Upgrade target version Zabbix6.0.3. Upgrade plan The server is directly upgraded in the current environment node, and the database uses a new server to deploy the Mysql8.0.28 database to migrate the server configuration information to the new database. Before the upgrade, a snapshot backup of the server service node is required to facilitate rollback in case of failure. Because the upgrade needs to stop the service, no matter whether the upgrade succeeds or fails, part of the monitoring data on the day of the upgrade will be lost.
Environmental description
Preparations before installation
Machine equipment is involved: zabbixdb
System version: CentOS Linux release 8.3.2011
MySQL version: mysql8.0.28 database.
Both SELinux and firewall are turned off by default.
Mysql environment deployment
3.1 mysql installation
1. Create mysql user and disable user login
2. According to the requirements, the database storage directory is /data directory
3. Install the downloaded rpm installation package of mysql
3.2 Configure MySQL
1. Initialize Mysql and specify the data directory
2. Modify the Mysql configuration file
The following configuration belongs to the mysql configuration of zabbix-server. innodb_buffer_pool_size = 16G The size is about 75% of the total memory.
vi /etc/my.cnf
3. Start the service and add boot self-start
4. View the Mysql process
ps -ef | grep mysql
5. Modify the security policy
1. Modify the database root password
grep password /var/log/mysqld.log
mysql>ALTER USER ‘root’@‘localhost’ identified by ‘Zabbix#1234’;
3.3 Create zabbix library
mysql>create database zabbix character set utf8mb4 collate utf8mb4_bin;
Zabbix Server Upgrade
4.1 Backup before upgrade
1.导出Zabbix配置数据#mysqldump -uroot -p zabbix --ignore-table=zabbix.history --ignore-table=zabbix.history_uint --ignore-table=zabbix.history_str --ignore-table=zabbix.history_text --ignore-table=zabbix.history_log --ignore-table=zabbix.trends --ignore-table=zabbix.trends_uint --ignore-table=zabbix.alerts --ignore-table=zabbix.events>/opt/zbx5.0.sql
2. Back up the zabbix configuration file
3. Backup zabbix front end
4. Backup alarm script and custom script
5. Back up the httpd configuration file
4.2 Authorize the new database
1. Create a user and authorize
mysql> create user ‘zabbix’@‘192.18.252.%’ identified by ‘Zabbix#1234’; mysql> create user ‘zabbix’@‘localhost’ identified by ‘Zabbix#1234’; mysql> grant all privileges on zabbix.* to ‘zabbix’@‘192.18.252.%’; mysql> grant all privileges on zabbix.* to ‘zabbix’@‘localhost’; mysql>flush privileges; mysql>alter user ‘zabbix’@‘192.18.252.%’ identified with mysql_native_password by ‘123456’;
mysql>alter user ‘zabbix’@‘192.18.252.%’ identified with mysql_native_password by ‘Zabbix#1234’;
#Mysql8.0 has a high security factor and needs to modify the initial password
4.3 Import zabbix5.0 data structure
1. Import Zabbix5.0 data structure zcat /opt/software/create.sql.gz | mysql -uzabbix -p zabbix
4.4 Import the old database to backup Zabbix configuration data
1. Import the old environment Zabbix configuration data
cat /opt/software/zbx5.0.sql | mysql -uzabbix -p zabbix
4.5 Add a primary key to the new database history table
1. Add a primary key to the Zabbix database history table
mysql -uzabbix -p zabbix < /opt/software/history_pk_prepare.sql
2. Delete the old table
mysql>DROP TABLE history_old; mysql>DROP TABLE history_uint_old; mysql>DROP TABLE history_str_old; mysql>DROP TABLE history_log_old; mysql>DROP TABLE history_text_old;
4.6 Create table partitions for new databases
1. Configuration file preparation
Upload the partition_call.sql stored procedure and partition_all.sql partition to set the retention time. Set the historical data retention period (90 days) and trend data retention period (360 days)
2. Create and import stored procedures
mysql -uzabbix -p zabbix < /opt/software/partition_call.sql
mysql -uzabbix -p zabbix < /opt/software/partition_all.sql
3. Call the stored procedure
mysql -uzabbix -p zabbix -e “call partition_maintenance_all(‘zabbix’)”
4.7 Create an event scheduler
mysql> use zabbix; mysql> create event zabbix_partition on schedule every 1 day starts ‘2022-04-28 2:00:00’ do CALL partition_maintenance_all(‘zabbix’);
4.8 Upgrade Zabbix-related services
1. Stop Zabbix, Agent, PHP, Apache services
systemctl stop zabbix-server zabbix-agent httpd php-fpm
2. Uninstall zabbix5.0.1
rpm -e zabbix-web-deps-5.0.1-1.el8.noarch zabbix-apache-conf-5.0.1-1.el8.noarch zabbix-web-mysql-5.0.1-1.el8.noarch zabbix- agent-5.0.1-1.el8.x86_64 zabbix-server-mysql-5.0.1-1.el8.x86_64 zabbix-web-5.0.1-1.el8.noarch
3. Install zabbix6.0.3
rpm -ivh zabbix-web-deps-6.0.3-1.el8.noarch.rpm zabbix-apache-conf-6.0.3-1.el8.noarch.rpm zabbix-web-mysql-6.0.3-1.el8 .noarch.rpm zabbix-agent-6.0.3-1.el8.x86_64.rpm zabbix-server-mysql-6.0.3-1.el8.x86_64.rpm zabbix-web-6.0.3-1.el8.noarch. rpm
4. Configure zabbix6.0.3 configuration file
Since the zabbix_server.conf configuration file parameters of zabbix5.0 and zabbix6.0.3 are different, it is not possible to directly copy and replace zabbix_server.conf.
View backup zabbix-server configuration
5. Modify the zabbix server configuration file accordingly
vi /etc/zabbix/zabbix_server.conf
6. Start Zabbix, Agent, PHP, Apache services
systemctl start zabbix-server zabbix-agent httpd php-fpm
7. View log files
tail -f /var/log/zabbix/zabbix_server.log tail -f /data/mysql/data/log/mysqld.log
Zabbix server will automatically update the database. After starting, Zabbix server reports current (mandatory and non-mandatory) and required database versions. If the current mandatory version is lower than the required version, Zabbix server automatically performs the required database patch. Database upgrade start and progress information (in percent) will be written to Zabbix server's log file. When the upgrade is complete, a "database upgrade fully completed" message will be written to the log file. If any upgrade patch fails, Zabbix server will not start, even if the current mandatory version of the database is higher than the required version, Zabbix server will not start. Zabbix server will only start if the current mandatory version of the database matches the required mandatory version.
NOTE: Before you start the server:
◆Confirm that the database user has sufficient permissions (create table, delete table, create index, delete index)
◆Make sure you have enough free disk space
Zabbix service check
◆ Check whether the upgraded zabbix is working properly and check the latest data.
◆Check whether the zabbix server log is normal.
1. Web access and check data and alarm conditions
Web access has problems as shown in the figure
2. Modify the front-end connection to the new database information
3. Check the latest data collection
4. Data collection is normal as shown in the figure
4.1 Chinese garbled characters appear to modify the font
mv /usr/share/fonts/dejavu/DejaVuSans.ttf /usr/share/fonts/dejavu/DejaVuSans.ttf_bak20220424
mv /opt/software/msyh.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf
5. Check the alarm information and trigger the action to successfully send the alarm information
fail rollback
1. Roll back the backup files before the server upgrade, and start snapshot recovery if any files are missing
2. Roll back the backup server before the MySQL database upgrade, and point the Server configuration file database to the original address
I wish you all a smooth upgrade!
---- Upgrade Training ----
I have already passed the 5.0 intermediate test, do I still need to attend the 6.0 training for 5 days?
No need for 5 days, only need to participate in 6 hours of intermediate upgrade training,
Less time and less cost.
Students with 5.0ZCP advanced certification only need to participate in 2 hours of upgrade training!
---- Zabbix Conference in July ----
The conference includes customer cases, new feature tips, fun dinners and other exciting activities.
Previous summits included Bank of Communications, Essence Securities, Huawei, China Everbright Bank, Bank of China, China Mobile Online, JD.com, Migu, etc. This summit will continue to be exciting! Scan the QR code to sign up.
If you don’t understand, just ask, what kind of experience is it to participate in the Zabbix China Summit?
Join the technical exchange group
WeChat ID|17502189550
Remarks "use Zabbix years + company + name"
5000+ users have joined!
A person goes fast, a group of people goes far!