keepalived 使用注意事项
1、启动用service keepalived start/stop 比直接 /sbin/keepalived start/stop要好,貌似解决了master停止了keepalived服务而backup不会转换状态的问题;
2、如果/var/log/messages出现
Keepalived_vrrp: Remote SMTP server [127.0.0.1:25] connected.
Keepalived_vrrp: Can not read data from remote SMTP server [127.0.0.1:25].
的报错信息,很有可能是/etc/keepalived/keepalived.conf配置文件的问题(前提是exim4等邮件服务已开),不能这样写:
notification_email # To:
{
admin@example1.com
}
而要写成
notification_email {
admin@example1.com
}
notification_email 与 { 之间必须要有空格。。
3、对于一备多主的机器,备机上要为每个instance配置一个 vrrp_sync_group,否则会导致只有一组主-备可以keepalived
4、用/usr/sbin/keepalived -f CONF_FILE启动会有问题,看keepalived.log会发现停在Using LinkWatch kernel netlink reflector…或Using autogen SSL context 这一步而没有读取vrrp_instance配置.需要用keepalived -f CONF_FILE才能读取到vrrp_instance配置,诡异的是which keepalived显示的就是/usr/sbin/keepalived