install keepalived on RedHat/CentOS to provide IP failover f
Your main configuration directory is located at /usr/local/etc/keepalived and configuration file name is keepalived.conf. First,make backup of existing configuration: # cd /usr/local/etc/keepalived # cp keepalived.conf keepalived.conf.bak Edit keepalived.conf as follows on lb0: vrrp_instance VI_1 { interface eth0 state MASTER virtual_router_id 51 priority 101 authentication { auth_type PASS auth_pass Add-Your-Password-Here } virtual_ipaddress { 202.54.1.1/29 dev eth1 } } Edit keepalived.conf as follows on lb1 (note priority set to 100 i.e. backup load balancer): vrrp_instance VI_1 { interface eth0 state MASTER virtual_router_id 51 priority 100 authentication { auth_type PASS auth_pass Add-Your-Password-Here } virtual_ipaddress { 202.54.1.1/29 dev eth1 } } Save and close the file. Finally start keepalived on both lb0 and lb1 as follows: # /etc/init.d/keepalived start /var/log/messages will keep track of VIP: # tail -f /var/log/messages Feb 21 04:06:15 lb0 Keepalived_vrrp: Netlink reflector reports IP 202.54.1.1 added Feb 21 04:06:20 lb0 Keepalived_vrrp: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth1 for 202.54.1.1 Verify that VIP assigned to eth1: # ip addr show eth1 Sample outputs: 3: eth1: mtu 1500 qdisc pfifo_fast qlen 10000 link/ether 00:30:48:30:30:a3 brd ff:ff:ff:ff:ff:ff inet 202.54.1.11/29 brd 202.54.1.254 scope global eth1 inet 202.54.1.1/29 scope global secondary eth1 ping failover test Open UNIX / Linux / OS X desktop terminal and type the following command to ping to VIP: # ping 202.54.1.1 Login to lb0 and halt the server or take down networking: # halt Within seconds VIP should move from lb0 to lb1 and you should not see any drops in ping. On lb1 you should get the following in /var/log/messages: Feb 21 04:10:07 lb1 Keepalived_vrrp: VRRP_Instance(VI_1) forcing a new MASTER election Feb 21 04:10:08 lb1 Keepalived_vrrp: VRRP_Instance(VI_1) Transition to MASTER STATE Feb 21 04:10:09 lb1 Keepalived_vrrp: VRRP_Instance(VI_1) Entering MASTER STATE Feb 21 04:10:09 lb1 Keepalived_vrrp: VRRP_Instance(VI_1) setting protocol VIPs. Feb 21 04:10:09 lb1 Keepalived_healthcheckers: Netlink reflector reports IP 202.54.1.1 added (编辑:南平站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- linux – iptables nat只是端口25?
- 调用远程主机上的 RMI 服务时抛出 java.rmi.ConnectExcepti
- 转载-centos网络配置(手动设置,自动获取)的2种方法
- linux – rsync复制整个文件而不是差异
- 如何在BASH中创建TXT模板脚本
- linux – 为什么将’script’重定向到/ dev / null /允许’
- linux – 在Bash上使用FTP命令删除递归目录
- linux – 问:RHEL,SSSD,Active Directory
- 是否有适用于Linux的文件夹大小工具? (基于网络或在控制台
- GLib-2.2.1 amp;amp; glib、GTK+ 官网及下载地址