Upgrade zabbix to 3.2.1 report database upgrade failure error
A problem description
Upgrade zabbix server and zabbix proxy to 3.2.1 today. First stop zabbix server, then upgrade zabbix proxy one by one, and then upgrade zabbix server. There are no errors in the upgrade of zabbix proxy and it can proceed smoothly. However, the following error was reported when upgrading zabbix server:
4250 required mandatory version 20161010 using configuration file: / opt/app/zabbix/conf/zabbix_server.conf 4250 required mandatory version 20161010 current database version 001506.980 query failed: [1091] Can't DROP 'history_log_2'; check that column/key exists [drop index history_log_2 on history_log] 4250 database upgrade failed 201610 database upgrade failed
I have done table partitioning on zabbix database before.
Second problem solving
Check zabbix problem feedback because zabbix 3.2 requires the drop history_log_2 index when upgrading, and if not, an error will be reported.
DROP TABLE history_log;DROP TABLE history_text CREATE TABLE `history_ log` (`id` BIGINT (20) UNSIGNED NOT NULL, `itemid` BIGINT (20) UNSIGNED NOT NULL, `clock` INT (11) NOT NULL DEFAULT '0mm, `timestamp` INT (11) NOT NULL DEFAULT' 0mm, `source`VARCHAR (64) NOT NULL DEFAULT''COLLATE' utf8_bin', `accounity` INT (11) NOT NULL DEFAULT '0mm, `value`TEXT NOT NULL COLLATE' utf8_bin', `logeventid` INT (11) NOT NULL DEFAULT '0mm, `ns`INT (11) NOT NULL DEFAULT' 0parentiy KEY (`id`), UNIQUE INDEX `history_log_ 2` (`itemid`, `id`) INDEX `history_log_ 1` (`itemid`, `clock`) COLLATE='utf8_bin'ENGINE=InnoDB CREATE TABLE `history_ text` (`id` BIGINT (20) UNSIGNED NOT NULL, `itemid` BIGINT (20) UNSIGNED NOT NULL, `clock` INT (11) NOT NULL DEFAULT '0mm, `timestamp` INT (11) NOT NULL DEFAULT' 0mm, `source`VARCHAR (64) NOT NULL DEFAULT''COLLATE' utf8_bin', `valuity` INT (11) NOT NULL DEFAULT '0mm, `value`TEXT NOT NULL COLLATE' utf8_bin', `logeventid` INT (11) NOT NULL DEFAULT '0mm, `ns`INT (11) NOT NULL DEFAULT' 0parentiy KEY (`id`), UNIQUE INDEX `history_text_ 2` (`itemid`, `id`) INDEX `history_text_ 1` (`itemid`, `clock`) COLLATE='utf8_bin'ENGINE=InnoDB
After the upgrade is complete, because history_text and history_log are recreated, the original partition script cannot partition the two tables directly
Manual partitioning is required before the script can be used
Http://john88wang.blog.51cto.com/2165294/1771557
Reference documentation:
Http://john88wang.blog.51cto.com/2165294/1771082
Https://zabbix.com/forum/showthread.php?p=189543
Https://support.zabbix.com/browse/ZBX-11203