您的位置:首页 > 数据库

升级zabbix到3.2.1报数据库升级失败的错误

2016-10-10 00:38 537 查看
一 问题描述

今天把zabbix server和zabbix proxy升级到3.2.1。先停掉zabbix server然后挨个升级zabbix proxy最后再升级zabbix server。zabbix proxy升级的时候没有错误,可以顺利进行。但是升级zabbix server的时候报出以下错误:
4250:20161010:001506.980 using configuration file: /opt/app/zabbix/conf/zabbix_server.conf
4250:20161010:001506.998 current database version (mandatory/optional): 03000000/03000000
4250:20161010:001506.998 required mandatory version: 03020000
4250:20161010:001506.998 starting automatic database upgrade
4250:20161010:001507.010 [Z3005] query failed: [1091] Can't DROP 'history_log_2'; check that column/key exists [drop index history_log_2 on history_log]
4250:20161010:001507.011 database upgrade failed
之前是对zabbix的数据库做过表分区

二 问题解决
查看zabbix问题反馈是由于zabbix 3.2在升级的时候需要drop history_log_2这个索引,如果没有就会报错。

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 '0',
`timestamp` INT(11) NOT NULL DEFAULT '0',
`source` VARCHAR(64) NOT NULL DEFAULT '' COLLATE 'utf8_bin',
`severity` INT(11) NOT NULL DEFAULT '0',
`value` TEXT NOT NULL COLLATE 'utf8_bin',
`logeventid` INT(11) NOT NULL DEFAULT '0',
`ns` INT(11) NOT NULL DEFAULT '0',
PRIMARY 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 '0',
`timestamp` INT(11) NOT NULL DEFAULT '0',
`source` VARCHAR(64) NOT NULL DEFAULT '' COLLATE 'utf8_bin',
`severity` INT(11) NOT NULL DEFAULT '0',
`value` TEXT NOT NULL COLLATE 'utf8_bin',
`logeventid` INT(11) NOT NULL DEFAULT '0',
`ns` INT(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE INDEX `history_text_2` (`itemid`, `id`),
INDEX `history_text_1` (`itemid`, `clock`)
)
COLLATE='utf8_bin'
ENGINE=InnoDB
;


升级完成以后,由于history_text和history_log重新创建了,原来的分区脚本不能直接对这两个表分区
需要先手动分区后脚本才能使用
http://john88wang.blog.51cto.com/2165294/1771557

参考文档:
http://john88wang.blog.51cto.com/2165294/1771082
https://zabbix.com/forum/showthread.php?p=189543
https://support.zabbix.com/browse/ZBX-11203
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mysql zabbix
相关文章推荐