keepalived+nginx配置

孤者浪人 提交于 2020-11-24 18:46:08

1.yum -y install keepalived

2.vi /etc/keepalived/keepalived.conf

vrrp_instance VI_1 {
    state MASTER #从为BACKUP
    interface eth0
    virtual_router_id 51
    priority 100 #MASTER 优先级高
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        192.168.2.199 #VIP
    }
}

3.service keepalived start

4.ip addr show

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:c7:ec:ad brd ff:ff:ff:ff:ff:ff
    inet 192.168.2.235/24 brd 192.168.2.255 scope global eth0
    inet 192.168.2.199/32 scope global eth0
    inet6 fe80::a00:27ff:fec7:ecad/64 scope link 
       valid_lft forever preferred_lft forever

5.nginx常规配置

6.测试

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!