MySQL双主+Keepalived高可用4
本帖最后由 巴黎的灯光下 于 2019-2-2 10:12 编辑四 安装Keepalived4.1 下载https://common.cnblogs.com/images/copycode.gif
1 # wget http://www.keepalived.org/software/keepalived-1.3.6.tar.gz2 # tar -zvxf keepalived-1.3.6.tar.gz -C /tmp/3 # cd /tmp/keepalived-1.3.64 # ./configure --prefix=/usr/local/keepalived/ --sysconf=/etc --with-init=SYSV5 #注:(upstart|systemd|SYSV|SUSE|openrc) #根据你的系统选择对应的启动方式6 # make && make install7 # ln -s /usr/local/keepalived/sbin/keepalived /sbin8 # chmod u+x /etc/init.d/keepalived9 # chkconfig --add keepalived 10 # chkconfig --level 35 keepalived onhttps://common.cnblogs.com/images/copycode.gif
注意:Master02上也需要如上操作。若出现以下提示,需要执行:yum -y install openssl-devel。https://img2018.cnblogs.com/blog/680719/201811/680719-20181105120734326-927708711.png提示:也可采用yum install -y keepalived安装(个人不建议)。4.2 Master01配置Keepalived默认情况下keepalived启动时会去/etc/keepalived目录下找配置文件。https://common.cnblogs.com/images/copycode.gif
1 # vim /etc/keepalived/keepalived.conf2 ! Configuration File for keepalived3 global_defs {4 notification_email {5 x120952576@126.com6 #表示keepalived在发生诸如切换操作时发送Email给哪些地址,邮件地址可以多个,每行一个。7 }8 notification_email_from Alexandre.Cassen@firewall.loc9 smtp_server 172.24.8.10 10 smtp_connect_timeout 30 11 router_id LVS_DEVEL 12 } 13 vrrp_instance VI_1 { 14 state BACKUP 15 interface eth0 16 virtual_router_id 51 17 #这里设置VRID,这里非常重要,相同的VRID为一个组,他将决定多播的MAC地址 18 priority 100 19 advert_int 1 20 nopreempt 21 #不抢占,只在优先级高的机器上设置即可,优先级低的机器不设置 22 authentication { 23 auth_type PASS 24 auth_pass 1111 25 } 26 track_script { 27 check_mysqld #执行定义的监控脚本 28 } 29 virtual_ipaddress { 30 172.24.8.12 31 } 32 } 33 vrrp_script check_mysqld { 34 script"/etc/keepalived/mysqlcheck/keepalived_check_mysql.sh " 35 interval 2 36 }https://common.cnblogs.com/images/copycode.gif
页:
[1]