原创

安装配置Keepalived

1、准备好Keepalived安装包
2、解压到/usr/local目录
3、安装需要依赖的环境组件

yum install gcc openssl-devel popt-devel -y
4、进入到解压目录,进行编译
./configure --prefix=/usr/local/keepalived
5、编译完成之后,进行安装
make && make install
6、将keepalived的服务注册为系统服务

    cp /usr/local/keepalived-1.4.5/keepalived/etc/init.d/keepalived /etc/init.d/
    mkdir /etc/keepalived
    cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/
    cp /usr/local/keepalived-1.4.5/keepalived/etc/sysconfig/keepalived /etc/sysconfig/
    cp /usr/local/keepalived/sbin/keepalived /usr/sbin/

7、修改配置文件
    cd etc/keepalived/
    vi keepalived.conf
! Configuration File for keepalived
global_defs {
    notification_email {
        acassen@firewall.loc
        failover@firewall.loc
        sysadmin@firewall.loc
}
notification_email_from Alexandre.Cassen@firewall.loc
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id LVS_DEVEL
vrrp_skip_check_adv_addr
vrrp_garp_interval 0
vrrp_gna_interval 0
}
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 100
advert_int 1
authentication {
    auth_type PASS
    auth_pass 1111
}
virtual_ipaddress {
    192.168.85.200/24 dev eth0 label eth0:3:
    }
}
8、启动keepalived

service keepalived start

9、登录验证
mysql -uroot -p123456 -h 192.168.85.100 -P 48066
本文链接地址:http://www.ysxbohui.com/article/54

正文到此结束