企業の Zabbix 高負荷シナリオでの使用を想定しています。
1. 独立したデータベースサーバー (11.0.1.52) を用意し MariaDB をインストールする#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
[root@db02 ~]#yum -y install mariadb-server
[root@db02 ~]#systemctl enable mariadb --now
[root@db02 ~]#mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.68-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.02 sec)
MariaDB [(none)]> create user 'zabbix'@'%' identified by 'zabbix';
Query OK, 0 rows affected (0.10 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to 'zabbix'@'%';
Query OK, 0 rows affected (0.00 sec)
|
2. Zabbix サーバーから zabbix データベースをエクスポートし、新しいデータベースへインポートする#
1
2
|
[root@zabbix ~]# mysqldump -uroot -B zabbix > zabbix.sql
[root@zabbix ~]# cat zabbix.sql |mysql -h 172.16.1.52 -uzabbix -pzabbix zabbix
|
3. Web UI のデータベース接続を設定する#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
[root@zabbix ~]# systemctl stop mariadb
[root@zabbix ~]# cat /etc/zabbix/web/zabbix.conf.php
<?php
// Zabbix GUI configuration file.
global $DB;
$DB['TYPE'] = 'MYSQL';
$DB['SERVER'] = '172.16.1.52';
$DB['PORT'] = '0';
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = 'zabbix';
[root@zabbix ~]# grep ^DB /etc/zabbix/zabbix_server.conf
DBHost=172.16.1.52
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
|
4. サービスを再起動する#
1
|
[root@zabbix ~]# systemctl restart zabbix-server httpd
|