Mysql+keepalived
架构图
1,做Mysql双主架构(略)
2,安装keepalived (主从都要安装)
yum install keepalived
3 ,修改keepalivedp配置文件
vim /etc/keepalived/keepalived.conf
Keepalved 配置文件
! Configuration File for keepalived
global_defs {
router_id MYSQL_MM
}
vrrp_script chk_mysqld3307 {
script "/usr/lib64/nagios/plugins/check_mysql -unagios -p **** -H 192.168.1.31 -P3307" #检测脚本,用来检测3307端口是否存活 192.168.1.32 为本机IP,从要修改成自己的IP
interval 1 # 间隔1秒检测一次
weight -10 # 脚本结果导致的优先级变更,检测失败(脚本返回非0)则优先级 -10
fall 2