Keepalived configuration
------------------------
Keepalived version : 1.1.19
Compiler : gcc
Compiler flags : -g -O2
Extra Lib : -lpopt -lssl -lcrypto
Use IPVS Framework : No
IPVS sync daemon support : No
Use VRRP Framework : Yes
Use Debug flags : No Use VRRP Framwork VRRP框架,这基本上是必须的,Keepalived的核心进程vrrpd。
[编辑] 启动KEEPALIVED服务
service keepalived start [编辑] 停止KEEPALIVED服务
service keepalived stop [编辑] KEEPALIVED配置
KEEPALIVED的所有配置在一个配置文件里面配置,支持的配置项也比较多。分为三类:
Nov 5 09:15:44 localhost Keepalived: Starting Keepalived v1.1.19 (11/03,2009)
Nov 5 09:15:44 localhost Keepalived_vrrp: Registering Kernel netlink reflector
Nov 5 09:15:44 localhost Keepalived_vrrp: Registering Kernel netlink command channel
Nov 5 09:15:44 localhost Keepalived_vrrp: Registering gratutious ARP shared channel
Nov 5 09:15:44 localhost Keepalived_vrrp: Opening file '/etc/keepalived/keepalived.conf'.
Nov 5 09:15:44 localhost Keepalived_vrrp: Configuration is using : 62380 Bytes
Nov 5 09:15:44 localhost Keepalived_vrrp: Using LinkWatch kernel netlink reflector...
Nov 5 09:15:44 localhost Keepalived: Starting VRRP child process, pid=18301
Nov 5 09:15:44 localhost Keepalived_vrrp: VRRP sockpool: [ifindex(2), proto(112), fd(9,10)]
Nov 5 09:15:44 localhost Keepalived_vrrp: VRRP_Instance(VI_1) Transition to MASTER STATE
Nov 5 09:15:45 localhost Keepalived_vrrp: VRRP_Instance(VI_1) Entering MASTER STATE
Nov 5 09:15:45 localhost Keepalived_vrrp: VRRP_Instance(VI_1) setting protocol VIPs.
Nov 5 09:15:45 localhost avahi-daemon[11188]: Registering new address record for 172.16.100.11 on eth0.
Nov 5 09:15:45 localhost Keepalived_vrrp: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth0 for 172.16.100.11
可以看到此机处于MASTER状态
SLAVE机调试信息
Nov 5 21:41:17 localhost Keepalived: Starting Keepalived v1.1.19 (11/05,2009)
Nov 5 21:41:17 localhost Keepalived_vrrp: Registering Kernel netlink reflector
Nov 5 21:41:17 localhost Keepalived_vrrp: Registering Kernel netlink command channel
Nov 5 21:41:17 localhost Keepalived_vrrp: Registering gratutious ARP shared channel
Nov 5 21:41:17 localhost Keepalived_vrrp: Opening file '/etc/keepalived/keepalived.conf'.
Nov 5 21:41:17 localhost Keepalived_vrrp: Configuration is using : 63316 Bytes
Nov 5 21:41:17 localhost Keepalived_vrrp: Using LinkWatch kernel netlink reflector...
Nov 5 21:41:17 localhost Keepalived_vrrp: VRRP_Instance(VI_1) Entering BACKUP STATE
Nov 5 21:41:17 localhost Keepalived_vrrp: VRRP sockpool: [ifindex(6), proto(112), fd(9,10)]
Nov 5 21:41:17 localhost Keepalived: Starting VRRP child process, pid=31263
可以看到此机此时处于BACKUP状态
常见错误一:
/var/log/messages has thousands of errors like this:
Jun 28 09:18:32 rust Keepalived_vrrp: receive an invalid ip number count
associated with VRID!
Jun 28 09:18:32 rust Keepalived_vrrp: bogus VRRP packet received on eth0 !!!
Jun 28 09:18:32 rust Keepalived_vrrp: VRRP_Instance(VI_1) Dropping received
VRRP packet...
The backup director starts up, but doesn't listen on the virtual addresses
at all. Its /var/log/messages has thousands of errors like this:
Jun 28 06:25:05 stye Keepalived_vrrp: receive an invalid ip number count
associated with VRID!
Jun 28 06:25:05 stye Keepalived_vrrp: bogus VRRP packet received on eth0 !!!
Jun 28 06:25:05 stye Keepalived_vrrp: VRRP_Instance(VI_1) ignoring received
advertisment...
解决方法:
改变配置文件/etc/keepalived/keepalived.conf中virtual_router_id为另一个值即可。
(changed the vrid to another number and it worked fine).