前言

之前使用Zabbix被动模式存在单点风险,借助这次Zabbix 4.0 LTS主动模式改造的机会,使用Keepalived搭建Zabbix Server HA双击高可用架构,简单记录下做HA的过程以备参考。

基于Keepalived搭建Zabbix Server HA双机高可用

更新历史

2019年10月24日 - 更新Zabbix本地数据库迁移至远程数据库集群的调整步骤
2019年03月02日 - 初稿

阅读原文 - https://wsgzao.github.io/post/zabbix-ha/

扩展阅读

Zabbix - https://www.zabbix.com/


Zabbix 高可用设计目标

keepalived 服务优先级选择切换机制:对于 zabbix 服务器来说,只要 zabbix 存活和 mysql 存活,就能够正常记录数据,不会丢失数据,php 和 httpd 只是 web 页面的访问而已,所以我在这里定义 mysql 和 zabbix 为主要服务,php 和 httpd 为次要服务,为了实现主要服务存在,次要服务挂了;次要服务器存在,主要服务器挂了,keepalived 会优先选择主要服务存在的一方作为 master,让 keepalived 切换更为更合理。

数据库主主同步:不管切到哪一边都需要保持数据一致性,不可出现丢数据或者数据重复,保证数据库的高可用。

文件双向同步:       

  1. web 文件同步:任何做 web 文件得配置和修改,保证两边一致,确保切换不会发生任何变化。       
  2. zabbix 服务文件同步:对 zabbix_servr 的配置文件做的任何修改,和脚本的修改进行同步,也是为了保证两边的服务一致性,没有落后情况,达到无需人工干预自动切换服务可正常时候。       
  3. 到此完成了 zabbix 得无缝切换,无故障时间!

Zabbix Server

基于官方的LAMP架构,按照最简单的原生方式来部署Zabbix 4.0 LTS,不做任何多余优化

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# 安装必要依赖包
yum install -y httpd mariadb-server mariadb php php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mhash

# 修改apache配置
vim /etc/httpd/conf/httpd.conf
ServerName 192.168.56.103
DirectoryIndex index.html index.php

# 修改php时区
vim /etc/php.ini
date.timezone = Asia/Singapore
memory_limit = 512M

# 优化php参数(可选,建议memory_limit根据内存值调高)
sed -i 's/post_max_size = 8M/post_max_size = 32M/g' /etc/php.ini
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 50M/g' /etc/php.ini
sed -i 's/\;date.timezone =/date.timezone = Asia\/Singapore/' /etc/php.ini
sed -i 's/max_execution_time = 30/max_execution_time = 600/g' /etc/php.ini
sed -i 's/max_input_time = 60/max_input_time = 600/g' /etc/php.ini
sed -i 's/memory_limit = 128M/memory_limit = 512M/g' /etc/php.ini

# 启动 httpd 服务
systemctl start httpd.service
# 启动 mariadb 服务
systemctl start mariadb.service

# 初始化 mysql 数据库,并配置 root 用户密码
mysql_secure_installation

# 万一新版本忘记随机密码可以通过日志获取
grep 'temporary password' /var/log/mysqld.log

# 创建一个测试页,测试 LAMP 是否搭建成功
cat > /var/www/html/index.php << EOF
<?php
phpinfo();
?>
EOF

# 创建zabbix数据库
mysql -uroot -p

mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
mysql> quit;

# 部署zabbix
rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
yum clean all
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

# 配置数据库用户及密码
vim /etc/zabbix/zabbix_server.conf
DBPassword=zabbix

# 修改时区和参数优化
vim /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Singapore
php_value memory_limit 512M

# 启动zabbix并设置自启动服务
systemctl restart zabbix-server zabbix-agent httpd
systemctl enable zabbix-server zabbix-agent httpd mariadb

http://localhost/zabbix
Admin/zabbix

Zabbix配置优化

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Zabbix默认原始配置
grep -Ev '^$|#' /etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000

# 修改zabbix_server.conf,通常可以追加在末尾
CacheSize=8G
TrendCacheSize=2G
Timeout=30
StartPollers=500
StartPollersUnreachable=100
StartPingers=50
HousekeepingFrequency=0

# 如果服务器性能很好可以继续向上调整参数
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
StartPollers=700
StartPreprocessors=100
StartPollersUnreachable=500
StartTrappers=200
StartPingers=500
StartDiscoverers=100
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
CacheSize=8G
StartDBSyncers=64
HistoryCacheSize=2G
HistoryIndexCacheSize=2G
TrendCacheSize=2G
ValueCacheSize=2G
Timeout=30
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000

数据库配置优化

1
2
3
4
5
6
7
8
9
10
11
grep -Ev '^$|#' /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
max_connections=1000
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
!includedir /etc/my.cnf.d

Zabbix Partition 分区表优化

Zabbix >= 3.2, history 30, Trends 120,(‘history’, 30, 24, 14),最多保存 30 天的数据,每隔 24 小时生成一个分区,每次生成 14 个分区

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
DELIMITER $$
CREATE PROCEDURE `partition_create`(SCHEMANAME varchar(64), TABLENAME varchar(64), PARTITIONNAME varchar(64), CLOCK int)
BEGIN
/*
SCHEMANAME = The DB schema in which to make changes
TABLENAME = The table with partitions to potentially delete
PARTITIONNAME = The name of the partition to create
*/
/*
Verify that the partition does not already exist
*/

DECLARE RETROWS INT;
SELECT COUNT(1) INTO RETROWS
FROM information_schema.partitions
WHERE table_schema = SCHEMANAME AND table_name = TABLENAME AND partition_description >= CLOCK;

IF RETROWS = 0 THEN
/*
1. Print a message indicating that a partition was created.
2. Create the SQL to create the partition.
3. Execute the SQL from #2.
*/
SELECT CONCAT( "partition_create(", SCHEMANAME, ",", TABLENAME, ",", PARTITIONNAME, ",", CLOCK, ")" ) AS msg;
SET @sql = CONCAT( 'ALTER TABLE ', SCHEMANAME, '.', TABLENAME, ' ADD PARTITION (PARTITION ', PARTITIONNAME, ' VALUES LESS THAN (', CLOCK, '));' );
PREPARE STMT FROM @sql;
EXECUTE STMT;
DEALLOCATE PREPARE STMT;
END IF;
END$$
DELIMITER ;
DELIMITER $$
CREATE PROCEDURE `partition_drop`(SCHEMANAME VARCHAR(64), TABLENAME VARCHAR(64), DELETE_BELOW_PARTITION_DATE BIGINT)
BEGIN
/*
SCHEMANAME = The DB schema in which to make changes
TABLENAME = The table with partitions to potentially delete
DELETE_BELOW_PARTITION_DATE = Delete any partitions with names that are dates older than this one (yyyy-mm-dd)
*/
DECLARE done INT DEFAULT FALSE;
DECLARE drop_part_name VARCHAR(16);

/*
Get a list of all the partitions that are older than the date
in DELETE_BELOW_PARTITION_DATE. All partitions are prefixed with
a "p", so use SUBSTRING TO get rid of that character.
*/
DECLARE myCursor CURSOR FOR
SELECT partition_name
FROM information_schema.partitions
WHERE table_schema = SCHEMANAME AND table_name = TABLENAME AND CAST(SUBSTRING(partition_name FROM 2) AS UNSIGNED) < DELETE_BELOW_PARTITION_DATE;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;

/*
Create the basics for when we need to drop the partition. Also, create
@drop_partitions to hold a comma-delimited list of all partitions that
should be deleted.
*/
SET @alter_header = CONCAT("ALTER TABLE ", SCHEMANAME, ".", TABLENAME, " DROP PARTITION ");
SET @drop_partitions = "";

/*
Start looping through all the partitions that are too old.
*/
OPEN myCursor;
read_loop: LOOP
FETCH myCursor INTO drop_part_name;
IF done THEN
LEAVE read_loop;
END IF;
SET @drop_partitions = IF(@drop_partitions = "", drop_part_name, CONCAT(@drop_partitions, ",", drop_part_name));
END LOOP;
IF @drop_partitions != "" THEN
/*
1. Build the SQL to drop all the necessary partitions.
2. Run the SQL to drop the partitions.
3. Print out the table partitions that were deleted.
*/
SET @full_sql = CONCAT(@alter_header, @drop_partitions, ";");
PREPARE STMT FROM @full_sql;
EXECUTE STMT;
DEALLOCATE PREPARE STMT;

SELECT CONCAT(SCHEMANAME, ".", TABLENAME) AS `table`, @drop_partitions AS `partitions_deleted`;
ELSE
/*
No partitions are being deleted, so print out "N/A" (Not applicable) to indicate
that no changes were made.
*/
SELECT CONCAT(SCHEMANAME, ".", TABLENAME) AS `table`, "N/A" AS `partitions_deleted`;
END IF;
END$$
DELIMITER ;
DELIMITER $$
CREATE PROCEDURE `partition_maintenance`(SCHEMA_NAME VARCHAR(32), TABLE_NAME VARCHAR(32), KEEP_DATA_DAYS INT, HOURLY_INTERVAL INT, CREATE_NEXT_INTERVALS INT)
BEGIN
DECLARE OLDER_THAN_PARTITION_DATE VARCHAR(16);
DECLARE PARTITION_NAME VARCHAR(16);
DECLARE OLD_PARTITION_NAME VARCHAR(16);
DECLARE LESS_THAN_TIMESTAMP INT;
DECLARE CUR_TIME INT;

CALL partition_verify(SCHEMA_NAME, TABLE_NAME, HOURLY_INTERVAL);
SET CUR_TIME = UNIX_TIMESTAMP(DATE_FORMAT(NOW(), '%Y-%m-%d 00:00:00'));

SET @__interval = 1;
create_loop: LOOP
IF @__interval > CREATE_NEXT_INTERVALS THEN
LEAVE create_loop;
END IF;

SET LESS_THAN_TIMESTAMP = CUR_TIME + (HOURLY_INTERVAL * @__interval * 3600);
SET PARTITION_NAME = FROM_UNIXTIME(CUR_TIME + HOURLY_INTERVAL * (@__interval - 1) * 3600, 'p%Y%m%d%H00');
IF(PARTITION_NAME != OLD_PARTITION_NAME) THEN
CALL partition_create(SCHEMA_NAME, TABLE_NAME, PARTITION_NAME, LESS_THAN_TIMESTAMP);
END IF;
SET @__interval=@__interval+1;
SET OLD_PARTITION_NAME = PARTITION_NAME;
END LOOP;

SET OLDER_THAN_PARTITION_DATE=DATE_FORMAT(DATE_SUB(NOW(), INTERVAL KEEP_DATA_DAYS DAY), '%Y%m%d0000');
CALL partition_drop(SCHEMA_NAME, TABLE_NAME, OLDER_THAN_PARTITION_DATE);

END$$
DELIMITER ;
DELIMITER $$
CREATE PROCEDURE `partition_verify`(SCHEMANAME VARCHAR(64), TABLENAME VARCHAR(64), HOURLYINTERVAL INT(11))
BEGIN
DECLARE PARTITION_NAME VARCHAR(16);
DECLARE RETROWS INT(11);
DECLARE FUTURE_TIMESTAMP TIMESTAMP;

/*
* Check if any partitions exist for the given SCHEMANAME.TABLENAME.
*/
SELECT COUNT(1) INTO RETROWS
FROM information_schema.partitions
WHERE table_schema = SCHEMANAME AND table_name = TABLENAME AND partition_name IS NULL;

/*
* If partitions do not exist, go ahead and partition the table
*/
IF RETROWS = 1 THEN
/*
* Take the current date at 00:00:00 and add HOURLYINTERVAL to it. This is the timestamp below which we will store values.
* We begin partitioning based on the beginning of a day. This is because we don't want to generate a random partition
* that won't necessarily fall in line with the desired partition naming (ie: if the hour interval is 24 hours, we could
* end up creating a partition now named "p201403270600" when all other partitions will be like "p201403280000").
*/
SET FUTURE_TIMESTAMP = TIMESTAMPADD(HOUR, HOURLYINTERVAL, CONCAT(CURDATE(), " ", '00:00:00'));
SET PARTITION_NAME = DATE_FORMAT(CURDATE(), 'p%Y%m%d%H00');

-- Create the partitioning query
SET @__PARTITION_SQL = CONCAT("ALTER TABLE ", SCHEMANAME, ".", TABLENAME, " PARTITION BY RANGE(`clock`)");
SET @__PARTITION_SQL = CONCAT(@__PARTITION_SQL, "(PARTITION ", PARTITION_NAME, " VALUES LESS THAN (", UNIX_TIMESTAMP(FUTURE_TIMESTAMP), "));");

-- Run the partitioning query
PREPARE STMT FROM @__PARTITION_SQL;
EXECUTE STMT;
DEALLOCATE PREPARE STMT;
END IF;
END$$
DELIMITER ;

DELIMITER $$
CREATE PROCEDURE`partition_maintenance_all`(SCHEMA_NAME VARCHAR(32))
BEGIN
CALL partition_maintenance(SCHEMA_NAME, 'history', 30, 24, 14);
CALL partition_maintenance(SCHEMA_NAME, 'history_log', 30, 24, 14);
CALL partition_maintenance(SCHEMA_NAME, 'history_str', 30, 24, 14);
CALL partition_maintenance(SCHEMA_NAME, 'history_text', 30, 24, 14);
CALL partition_maintenance(SCHEMA_NAME, 'history_uint', 30, 24, 14);
CALL partition_maintenance(SCHEMA_NAME, 'trends', 120, 24, 14);
CALL partition_maintenance(SCHEMA_NAME, 'trends_uint', 120, 24, 14);
END$$
DELIMITER ;%
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# 导入partition.sql
mysql -u'zabbix' -p'zabbix' zabbix < partition.sql
# 手动后台单次执行
nohup mysql -u'zabbix' -p'zabbix' 'zabbix' -e "CALL partition_maintenance_all('zabbix');" &> /root/partition.log&
tail -f /root/partition.log

# 查看过程逻辑
show create procedure partition_maintenance_all \G;
# 删除存储过程
drop procedure if exists partition_maintenance_all;
# 查看存储过程
show procedure status like 'partition_maintenance%' \G;
# 查看
show create table history

# 创建定时任务脚本
[root@sg-gop-10-65-200-90 wangao]# cat /opt/sa_scripts/zabbix_partitioning.sh
#!/bin/bash

user='zabbix'
password='zabbix'
database='zabbix'

mysql -u${user} -p$password $database -e "CALL partition_maintenance_all('zabbix');"

# 修改执行权限
chmod 755 /opt/sa_scripts/zabbix_partitioning.sh
# 修改crontab
vim /etc/crontab
15 3 * * * root bash /opt/sa_scripts/zabbix_partitioning.sh

Zabbix Proxy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# zabbix proxy的依赖就只有数据库了,用于存储配置信息
yum install -y mariadb-server mariadb
# 启动 mariadb 服务
systemctl start mariadb.service
systemctl enable mariadb.service
# 初始化 mysql 数据库,并配置 root 用户密码
mysql_secure_installation

# 创建zabbix_proxy数据库
mysql -uroot -p

mysql> create database zabbix_proxy character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix_proxy.* to zabbix@localhost identified by 'zabbix';
mysql> quit;

# 部署zabbix_proxy
rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
yum install -y zabbix-proxy-mysql
zcat /usr/share/doc/zabbix-proxy-mysql*/schema.sql.gz | mysql -uzabbix -p zabbix_proxy

# 配置数据库用户及密码
vim /etc/zabbix/zabbix_proxy.conf
Server=192.168.56.103
Hostname=zabbix_proxy
DBName=zabbix_proxy
DBUser=zabbix
DBPassword=zabbix

# 配置Zabbix Server Proxy
Administration -> Proxies -> Create proxy
Proxy name: zabbix_proxy
Proxy mode: Active
Proxy address: 192.168.56.101

# 启动zabbix_proxy
systemctl restart zabbix-proxy

# 修改zabbix_agent配置指向zabbix_proxy
vim /etc/zabbix/zabbix_agentd.conf
Server=192.168.56.101,192.168.56.103
ServerActive=192.168.56.101
Hostname=192.168.56.101

# 设置zabbix_proxy服务
systemctl enable zabbix-proxy

# 在zabbix_server中添加代理主机
Configuration -> Hosts -> Create host
Monitored by proxy: zabbix_proxy

Zabbix Database 迁移

本地迁移

  1. 依次关闭zabbix-server和mariadb数据库
  2. 复制数据库至新的位置
  3. 修改my.cnf配置文件
  4. 修改zabbix相关配置文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# 创建数据库新的path
mkdir /data
service zabbix-server stop
systemctl stop mariadb.service
cp -r /var/lib/mysql/ /data/
chown -R mysql:mysql /data/mysql

# 修改my.cnf配置或者使用软链接ln方式一步简化
vim /etc/my.cnf

[client]
socket=/data/mysql/mysql.sock

[mysqld]
#datadir=/var/lib/mysql
#socket=/var/lib/mysql/mysql.sock
datadir=/data/mysql
socket=/data/mysql/mysql.sock

# 修改zabbix_server.conf配置
DBSocket=/data/mysql/mysql.sock

# 修改php.ini配置
vim /etc/php.ini
pdo_mysql.default_socket=/data/mysql/mysql.sock
mysql.default_socket = /data/mysql/mysql.sock
mysqli.default_socket = /data/mysql/mysql.sock

# 重启服务观察日志
systemctl start mariadb.service
service zabbix-server start
tailf /var/log/zabbix/zabbix_server.log

# 确认数据库前移位置
mysql -uroot -p

MariaDB [(none)]> select @@datadir;
+--------------+
| @@datadir |
+--------------+
| /data/mysql/ |
+--------------+
1 row in set (0.00 sec)


# 参考文章
https://www.zabbix.com/forum/zabbix-help/52032-move-var-lib-mysql-and-update-my-cnf-zabbix-gui-reports-error?p=363471#post363471

1) /etc/my.cnf configuration file has two sections where I edited directory name for mysql.sock:
- section [mysqld]
socket=/home/mysql/mysql.sock
- section [client]
socket=/home/mysql/mysql.sock

2) /etc/php.ini also has more than one line for mysql.sock:
#grep "mysql.sock" /etc/php.ini
pdo_mysql.default_socket=/home/mysql/mysql.sock
mysql.default_socket = /home/mysql/mysql.sock
mysqli.default_socket = /home/mysql/mysql.sock

3) And zabbix_server.conf also must be edited
# grep "mysql.sock" /etc/zabbix/zabbix_server.conf
# DBSocket=/tmp/mysql.sock
DBSocket=/home/mysql/mysql.sock

本地迁移至远程

从本地数据库localhost迁移至远程的DB Cluster集群

  1. 数据量即使很大一般都会设定保留周期,比如30天
  2. 最简单的方案当然是整个库全部迁移过去,丢失迁移时间段内的数据是可以接受的
  3. 简单分享下Zabbix Server需要修改的地方
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# 修改zabbix_server.conf
vim /etc/zabbix/zabbix_server.conf

DBHost=xxx
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
DBPort=3306

# 修改zabbix web前端
vim /etc/zabbix/web/zabbix.conf.php

<?php
// Zabbix GUI configuration file.
global $DB;

$DB['TYPE'] = 'MYSQL';
$DB['SERVER'] = 'xxx';
$DB['PORT'] = '3306';
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = 'zabbix';

// Schema name. Used for IBM DB2 and PostgreSQL.
$DB['SCHEMA'] = '';

$ZBX_SERVER = 'localhost';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = '';

$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;

# 重启zabbix-server和httpd
service zabbix-server restart
service httpd restart

# 检查zabbix_server日志
tail -f /var/log/zabbix/zabbix_server.log

# 修改crontab定时任务脚本
vim /etc/crontab
15 3 * * * root bash /opt/sa_scripts/zabbix_partitioning.sh

vim /opt/sa_scripts/zabbix_partitioning.sh

#!/bin/bash

host='xxx'
user='zabbix'
password='zabbix'
database='zabbix'
port='3306'

mysql -h${host} -u${user} -p${password} -P${port} $database -e "CALL partition_maintenance_all('zabbix');"

Zabbix HA高可用

基于Keepalived搭建Zabbix HA高可用

【zabbix HA】zabbixHA 高可用的实现
https://www.jianshu.com/p/eecb5e8d1a96

文章目录
  1. 1. 前言
  2. 2. 更新历史
  3. 3. Zabbix 高可用设计目标
  4. 4. Zabbix Server
  5. 5. Zabbix配置优化
  6. 6. 数据库配置优化
  7. 7. Zabbix Partition 分区表优化
  8. 8. Zabbix Proxy
  9. 9. Zabbix Database 迁移
    1. 9.1. 本地迁移
    2. 9.2. 本地迁移至远程
  10. 10. Zabbix HA高可用