我编译并configuration了keepalived但不会启动。
这是我非常基本的configuration;
vrrp_sync_group PUBLIC_WEB_IPS { group { public_http_ip_lan } } vrrp_instance public_http_ip_lan { state MASTER interface br1118 virtual_router_id 18 priority 100 advert_int 1 virtual_ipaddress { 192.168.0.254/24 dev br1118 } nopreempt }
当我开始keepalived我没有得到任何错误,但它似乎得到了大部分的等待开始,然后暂停/挂起? 这是从/ var / log / syslog开始keepalived ;
Apr 11 17:25:33 basil Keepalived[8047]: Starting Keepalived v1.2.7 (04/08,2013) Apr 11 17:25:33 basil Keepalived[8048]: Starting Healthcheck child process, pid=8051 Apr 11 17:25:33 basil Keepalived[8048]: Starting VRRP child process, pid=8052 Apr 11 17:25:33 basil Keepalived_healthcheckers[8051]: Initializing ipvs 2.6 Apr 11 17:25:33 basil Keepalived_healthcheckers[8051]: Interface queue is empty Apr 11 17:25:33 basil Keepalived_healthcheckers[8051]: No such interface, eth0 Apr 11 17:25:33 basil Keepalived_healthcheckers[8051]: No such interface, eth1.116 Apr 11 17:25:33 basil Keepalived_healthcheckers[8051]: No such interface, br1116 Apr 11 17:25:33 basil Keepalived_healthcheckers[8051]: No such interface, eth1.118 Apr 11 17:25:33 basil Keepalived_healthcheckers[8051]: No such interface, br1118 Apr 11 17:25:33 basil Keepalived_healthcheckers[8051]: Netlink reflector reports IP 10.0.115.69 added Apr 11 17:25:33 basil Keepalived_healthcheckers[8051]: Netlink reflector reports IP 10.0.116.249 added Apr 11 17:25:33 basil Keepalived_healthcheckers[8051]: Netlink reflector reports IP 192.168.0.250 added Apr 11 17:25:33 basil Keepalived_healthcheckers[8051]: Netlink reflector reports IP fe80::2a0:c9ff:fe8f:4164 added Apr 11 17:25:33 basil Keepalived_healthcheckers[8051]: Netlink reflector reports IP fe80::220:edff:fe9f:9774 added Apr 11 17:25:33 basil Keepalived_healthcheckers[8051]: Netlink reflector reports IP fe80::2a0:c9ff:fe8f:4164 added Apr 11 17:25:33 basil Keepalived_healthcheckers[8051]: Netlink reflector reports IP fe80::2a0:c9ff:fe8f:4164 added Apr 11 17:25:33 basil Keepalived_healthcheckers[8051]: Netlink reflector reports IP fe80::2a0:c9ff:fe8f:4164 added Apr 11 17:25:33 basil Keepalived_healthcheckers[8051]: Netlink reflector reports IP fe80::2a0:c9ff:fe8f:4164 added Apr 11 17:25:33 basil Keepalived_healthcheckers[8051]: Registering Kernel netlink reflector Apr 11 17:25:33 basil Keepalived_healthcheckers[8051]: Registering Kernel netlink command channel Apr 11 17:25:33 basil Keepalived_healthcheckers[8051]: Configuration is using : 2777 Bytes Apr 11 17:25:33 basil Keepalived_healthcheckers[8051]: Using LinkWatch kernel netlink reflector...
keepalived仍在运行(CPU使用率为2〜3%,RAM为10%)
user@basil:/usr/local/etc/keepalived$ ps aux | grep keepalived root 8048 0.0 0.1 8372 808 ? Ss 17:25 0:00 /usr/local/sbin/keepalived -D root 8051 0.0 0.3 8492 1820 ? S 17:25 0:00 /usr/local/sbin/keepalived -D root 8052 0.0 0.2 8492 1344 ? S 17:25 0:00 /usr/local/sbin/keepalived -D
当我启动keepalived时,tcpdump中没有显示任何内容,例如:
user@basil:~$ sudo tcpdump -nlASX -s 0 -vvv -e src net 192.168.0.0/24 and not port 22tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
网桥接口已经启动(因为这是通过一个单独的vlan)。
user@basil:/usr/local/etc/keepalived$ ip as br1118 11: br1118: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP link/ether 00:a0:c9:8f:41:64 brd ff:ff:ff:ff:ff:ff inet 192.168.0.250/24 brd 192.168.0.255 scope global br1118 inet6 fe80::2a0:c9ff:fe8f:4164/64 scope link valid_lft forever preferred_lft forever
我可以ping该VLAN上的主机。 这里发生了什么,我怀疑我犯了一个非常愚蠢的错误,但是我找不到任何错误。
更新:
就像要求的一样:
user@basil:~$ ifconfig -a br1116 Link encap:Ethernet HWaddr 00:a0:c9:8f:41:64 inet addr:xxxxx Bcast:xxxxx Mask:xxxx inet6 addr: fe80::2a0:c9ff:fe8f:4164/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:20 errors:0 dropped:0 overruns:0 frame:0 TX packets:6 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1120 (1.0 KiB) TX bytes:468 (468.0 B) br1118 Link encap:Ethernet HWaddr 00:a0:c9:8f:41:64 inet addr:xxxxx Bcast:xxxxx Mask:xxxx inet6 addr: fe80::2a0:c9ff:fe8f:4164/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:19 errors:0 dropped:0 overruns:0 frame:0 TX packets:6 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1064 (1.0 KiB) TX bytes:468 (468.0 B) eth0 Link encap:Ethernet HWaddr 00:20:ed:9f:97:74 inet addr:xxxx Bcast:xxxxx Mask:xxxxx inet6 addr: fe80::220:edff:fe9f:9774/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:169 errors:0 dropped:0 overruns:0 frame:0 TX packets:96 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:20019 (19.5 KiB) TX bytes:11089 (10.8 KiB) eth1 Link encap:Ethernet HWaddr 00:a0:c9:8f:41:64 inet6 addr: fe80::2a0:c9ff:fe8f:4164/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:150 errors:0 dropped:10 overruns:0 frame:0 TX packets:30 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:11680 (11.4 KiB) TX bytes:2436 (2.3 KiB) eth1.116 Link encap:Ethernet HWaddr 00:a0:c9:8f:41:64 inet6 addr: fe80::2a0:c9ff:fe8f:4164/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:20 errors:0 dropped:0 overruns:0 frame:0 TX packets:12 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1120 (1.0 KiB) TX bytes:936 (936.0 B) eth1.118 Link encap:Ethernet HWaddr 00:a0:c9:8f:41:64 inet6 addr: fe80::2a0:c9ff:fe8f:4164/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:19 errors:0 dropped:0 overruns:0 frame:0 TX packets:12 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1064 (1.0 KiB) TX bytes:936 (936.0 B) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:10 errors:0 dropped:0 overruns:0 frame:0 TX packets:10 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:732 (732.0 B) TX bytes:732 (732.0 B)
我刚刚重启了这个盒子,这就是为什么stream量计数器很低。
我遇到的情况是,keepalived启动,什么都不做,最后一个日志行是;
Apr 11 17:25:33 basil Keepalived_healthcheckers[8051]: Using LinkWatch kernel netlink reflector...
在删除设置并重新开始之后,我发现有两种情况,keepalived在这一点上停止,什么都不做;
Keepalived被指向keepalived.conf文件,所以它在技术上没有configuration启动
Keepalived正在加载configuration文件,但有一个错误(例如,错字)
使用keepalived启动问题通常是由于keepalived.conf文件中的错误。 Keepalived目前不支持检查configuration文件,如果发现任何错误,它通常会忽略所有的错误。
但是有一种更容易检测configuration问题的方法。 你应该启动一个-d开关,它会把configuration数据转储到syslog中。 如果你是从Red Hat / CentOS软件包安装的,只需编辑/etc/sysconfig/keepalived然后将-d添加到KEEPALIVED_OPTIONSvariables中:
KEEPALIVED_OPTIONS="-D -d"
现在,当您开始keepalived时,您将能够在syslog中读取哪些configuration数据keepalivedparsing。 另外,如果configuration的某些部分工作,而另一些则不工作,则可能是因为您忘记了使用右括号closures一个configuration块。
如果你从源代码编译keepalived,它会把configuration文件放在/usr/local/etc/keepalived ,由于某种原因,keepalived没有看到,所以我把keepalived.conf放在/etc/keepalived.conf和/etc/keepalived/keepalived.conf和一切工作后!