zabbix 3.4升級到4.4出現
[Z3005] query failed: [1091] Can't DROP 'escalations_1'; check that column/key exists [drop index escalations_1 on escalations]
處理
alter table escalations add index escalations_1(escalationid);
然後看到
show index from escalations;
+-------------+------------+---------------+--------------+--------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+-------------+------------+---------------+--------------+--------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| escalations | 0 | PRIMARY | 1 | escalationid | A | 247 | NULL | NULL | | BTREE | | |
| escalations | 0 | escalations_1 | 1 | triggerid | A | 247 | NULL | NULL | YES | BTREE | | |
| escalations | 0 | escalations_1 | 2 | itemid | A | 247 | NULL | NULL | YES | BTREE | | |
| escalations | 0 | escalations_1 | 3 | escalationid | A | 247 | NULL | NULL | | BTREE | | |
| escalations | 1 | escalations_2 | 1 | eventid | A | 247 | NULL | NULL | YES | BTREE | | |
| escalations | 1 | escalations_3 | 1 | nextcheck | A | 247 | NULL | NULL | | BTREE | | |
+-------------+------------+---------------+--------------+--------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
報錯2:
[Z3005] query failed: [1170] BLOB/TEXT column 'params' used in key specification without a key length [alter table `item_preproc` modify `params` text not null]
百度一下,是要扔掉索引字段params持索引,參考https://blog.csdn.net/u012069924/article/details/28858337
MariaDB [zabbix]> alter table `item_preproc` modify `params` text not null;
ERROR 1170 (42000): BLOB/TEXT column 'params' used in key specification without a key length
MariaDB [zabbix]> show index from item_preproc;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id: 1255
Current database: zabbix
+--------------+------------+----------------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+--------------+------------+----------------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| item_preproc | 0 | PRIMARY | 1 | item_preprocid | A | 30764 | NULL | NULL | | BTREE | | |
| item_preproc | 1 | item_preproc_1 | 1 | itemid | A | 30764 | NULL | NULL | | BTREE | | |
| item_preproc | 1 | item_preproc_1 | 2 | step | A | 30764 | NULL | NULL | | BTREE | | |
| item_preproc | 1 | idx_step | 1 | step | A | 19 | NULL | NULL | | BTREE | | |
| item_preproc | 1 | idx_type | 1 | type | A | 1 | NULL | NULL | | BTREE | | |
| item_preproc | 1 | idx_params | 1 | params | A | 51 | NULL | NULL | | BTREE | | |
| item_preproc | 1 | idx_itp_it | 1 | item_preprocid | A | 30764 | NULL | NULL | | BTREE | | |
| item_preproc | 1 | idx_itp_it | 2 | itemid | A | 30764 | NULL | NULL | | BTREE | | |
+--------------+------------+----------------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
8 rows in set (0.06 sec)
MariaDB [zabbix]> alter table item_preproc drop index idx_params;
Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [zabbix]> alter table `item_preproc` modify `params` text not null;
Query OK, 0 rows affected (0.00 sec)
Records: 0 Duplicates: 0 Warnings: 0
至此升級數據庫的問題解決。