LOAD DATA INFILE '/var/lib/mysql-files/history_text.csv' IGNORE INTO TABLE history_text FIELDS TERMINATED BY ',' ESCAPED BY '"' LINES TERMINATED BY '\n' SELECT * INTO OUTFILE '/var/lib/mysql-files/history_text.csv' FIELDS TERMINATED BY ',' ESCAPED BY '"' LINES TERMINATED BY '\n' FROM history_text_old LOAD DATA INFILE '/var/lib/mysql-files/history_log.csv' IGNORE INTO TABLE history_log FIELDS TERMINATED BY ',' ESCAPED BY '"' LINES TERMINATED BY '\n' SELECT * INTO OUTFILE '/var/lib/mysql-files/history_log.csv' FIELDS TERMINATED BY ',' ESCAPED BY '"' LINES TERMINATED BY '\n' FROM history_log_old LOAD DATA INFILE '/var/lib/mysql-files/history_str.csv' IGNORE INTO TABLE history_str FIELDS TERMINATED BY ',' ESCAPED BY '"' LINES TERMINATED BY '\n' SELECT * INTO OUTFILE '/var/lib/mysql-files/history_str.csv' FIELDS TERMINATED BY ',' ESCAPED BY '"' LINES TERMINATED BY '\n' FROM history_str_old LOAD DATA INFILE '/var/lib/mysql-files/history_uint.csv' IGNORE INTO TABLE history_uint FIELDS TERMINATED BY ',' ESCAPED BY '"' LINES TERMINATED BY '\n' SELECT * INTO OUTFILE '/var/lib/mysql-files/history_uint.csv' FIELDS TERMINATED BY ',' ESCAPED BY '"' LINES TERMINATED BY '\n' FROM history_uint_old LOAD DATA INFILE '/var/lib/mysql-files/history.csv' IGNORE INTO TABLE history FIELDS TERMINATED BY ',' ESCAPED BY '"' LINES TERMINATED BY '\n'
Migrate history data from old tables to new ones: SELECT * INTO OUTFILE '/var/lib/mysql-files/history.csv' FIELDS TERMINATED BY ',' ESCAPED BY '"' LINES TERMINATED BY '\n' FROM history_old Tweak DB performance to speed up data migration and avoid timeout errors: SET SESSION SQL_LOG_BIN=0 SET SESSION bulk_insert_buffer_size= 1024 * 1024 * 256 SET MAX_STATEMENT_TIME=0 Note that this step is optional if you do not need the old data from the history tables (you always have data from the trends tables).Ĭreate a temporary directory to use to export and import history data (delete it after the import): mkdir /var/lib/mysql-files & chmod 777 /var/lib/mysql-filesĬonnect to the MySQL/MariaDB server: mysql -u root -p rootDBpass zabbix
#Postgresql count upgrade#
Check the upgrade progress with the command “ cat /var/log/zabbix/zabbix_server.log | grep database“: # cat /var/log/zabbix/zabbix_server.log | grep databaseġ794:20200408:200607.700 current database version (mandatory/optional): 05040000/05040002ġ794:20200408:200607.700 starting automatic database upgradeġ794:20200408:200607.706 completed 1% of database upgradeġ794:20200408:200608.804 completed 10% of database upgradeġ794:20200408:200613.111 completed 98% of database upgradeġ794:20200408:200613.123 completed 100% of database upgradeġ794:20200408:200613.123 database upgrade fully completedġ794:20200408:200613.136 database could be upgraded to use primary keys in history tablesĭatabase upgrade is completed successfully when you receive the message “ database upgrade fully completed” in the Zabbix server log file.Ĭheck out section “ Learn about common upgrade errors” if you receive error “ query failed: Row size too large“. Luckily, upgrade of the Zabbix database is the easy part, just start the Zabbix service and it will automatically do the upgrade: systemctl start zabbix-serverĭatabase upgrade can last from 1 minute to hours depending on database size. Note, this guide is for upgrading Zabbix while guides for installing Zabbix 6.0 or 6.2 from scratch on various Linux distribution can be found on these links: CentOS/AlmaLinux/RockyLinux/OracleLinux/RHEL, Ubuntu, Debian, Rasbian (Raspberry Pi). Here are the minimum database versions that new Zabbix supports:Ĭheck your database version and if it does not meet the requirements, you will first need to upgrade it before continuing with this guide or use override by setting AllowUnsupportedDBVersions=1 in Zabbix server configuration file at your own risk. In addition to dropping support for older PHP versions, Zabbix 6.0 has tightened requirements for the database.
CentOS 8 / RHEL 8 / Oracle Linux 8 / Alma Linux 8 / Rocky Linux 8.Ubuntu 22.04 LTS (Jammy Jellyfish) / Ubuntu 20.04 (Focal).Newer operating systems support PHP 7.2.5 so you can upgrade to 6.0 without any difficulties on these Linux distributions: Zabbix 6.0 will no longer support PHP versions older than 7.2.5. However, I have to mention the new changes in PHP and database requirements that should be taken into account.
Zabbix 6 brings a lot of new features, you can read about them on the official site so I won’t write about it.