ksaitoの日記

日々試したことの覚え書き

zabbix1.6のmysqlデータベースをzabbix1.8にマイグレーションする

移転しました。

自動的にリダイレクトします。

ZABBIX-JPのドキュメントマイグレーションの方法があり試してみました。

パッチ適用の準備

下記を実行とあります。

alter table dhosts drop index dhosts_1;
alter table dservices drop index dservices_1;
alter table httptest drop index httptest_2;
alter table httptest drop index httptest_3;
alter table history_log drop index history_log_2;
alter table history_text drop index history_text_2;
alter table actions drop index actions_1;
alter table escalations drop index escalations_2;
alter table graphs_items drop index graphs_items_1;
alter table graphs_items drop index graphs_items_2;
alter table services drop index services_1;

バージョンが微妙に違うのか幾つかエラーが出ます。

$ mysql -u root -p zabbix
Enter password: 
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1693
Server version: 5.1.41-3ubuntu12.1 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> alter table dhosts drop index dhosts_1;
ERROR 1091 (42000): Can't DROP 'dhosts_1'; check that column/key exists
mysql> alter table dservices drop index dservices_1;
ERROR 1091 (42000): Can't DROP 'dservices_1'; check that column/key exists
mysql> alter table httptest drop index httptest_2;
ERROR 1091 (42000): Can't DROP 'httptest_2'; check that column/key exists
mysql> alter table httptest drop index httptest_3;
ERROR 1091 (42000): Can't DROP 'httptest_3'; check that column/key exists
mysql> alter table history_log drop index history_log_2;
Query OK, 0 rows affected (0.46 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> alter table history_text drop index history_text_2;
Query OK, 0 rows affected (0.25 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> alter table actions drop index actions_1;
ERROR 1091 (42000): Can't DROP 'actions_1'; check that column/key exists
mysql> alter table escalations drop index escalations_2;
ERROR 1091 (42000): Can't DROP 'escalations_2'; check that column/key exists
mysql> alter table graphs_items drop index graphs_items_1;
Query OK, 837 rows affected (0.31 sec)
Records: 837  Duplicates: 0  Warnings: 0

mysql> alter table graphs_items drop index graphs_items_2;
Query OK, 837 rows affected (0.31 sec)
Records: 837  Duplicates: 0  Warnings: 0

mysql> alter table services drop index services_1;
ERROR 1091 (42000): Can't DROP 'services_1'; check that column/key exists
mysql> 

パッチ適用

エラーは、出ましたが、そのままパッチを当ててみました。

$ zcat /usr/share/doc/zabbix-server-mysql/examples/patch.sql.gz | mysql -u root -p zabbix
Enter password: 
$

zabbixサーバの起動

サーバを起動してブラウザでアクセスするとエラーはなくなり過去データも残っていました。
グラフの日本語が文字化けしているようです。
これで、しばらく様子を見ます。

$ sudo /etc/init.d/zabbix-server start
 * Starting Zabbix server zabbix_server
   ...done.
$