zabbix高可用配置

两台实施环境规划
代码块
步骤需要在两台zabbix上完成
思路: 两台zabbix共用一个mysql, zabbix通过vip方法连接到mysql读取zabbix存储的数据
同时,在数据需要高可用时,可以通过部署mysql主从,mha等方式实现数据安全
服务器
作用
说明
192.168.10.21
zabbix-server1
zabbixserver
192.168.10.22
zabbix-server2
zabbixserver
192.168.10.200
vip
虚拟IP地址
部署192.168.10.21-zabbix-server-1
代码块
~]# hostnamectl set-hostname zabbix-server-1
~]# rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
~]# sed -i 's#http://repo.zabbix.com#http://mirrors.tuna.tsinghua.edu.cn/zabbix#g' /etc/yum.repos.d/zabbix.repo
~]# yum clean all
~]# yum -y install zabbix-server-mysql zabbix-web-mysql mariadb-server sshpass
~]# systemctl enable mariadb.service
~]# systemctl restart mariadb.service
~]# systemctl status mariadb.service
关闭selinux,iptables,firewalld
systemctl stop firewalld
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
setenforce 0
reboot
导入zabbix数据
代码块
mysql -e "create database zabbix character set utf8 collate utf8_bin;"
mysql -e "grant all on zabbix.* to zabbix@'localhost' identified by 'zabbix123';"
ls /usr/share/doc/zabbix-server-mysql-4.0.43
zcat /usr/share/doc/zabbix-server-mysql-4.0.43/create.sql.gz |mysql -uzabbix -p'zabbix123' zabbix