HA 启动heartbeat以后虚拟IP不出现
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HA 启动heartbeat以后虚拟IP不出现相关的知识,希望对你有一定的参考价值。
#tail /var/log/messages 配置都对但是nginx报错,修改nginx的配置即可 Mar 31 09:34:47 FrankTest02 IPaddr(IPaddr_192.168.1.150)[11820]: INFO: /usr/libexec/heartbeat/send_arp -i 200 -r 5 -p /var/run/resource-agents/send_arp-192.168.1.150 eth0 192.168.1.150 auto not_used not_used Mar 31 09:34:47 FrankTest02 /usr/lib/ocf/resource.d//heartbeat/IPaddr(IPaddr_192.168.1.150)[11794]: INFO: Success Mar 31 09:34:47 FrankTest02 ResourceManager(default)[11659]: info: Running /etc/init.d/nginx start Mar 31 09:34:48 FrankTest02 ResourceManager(default)[11659]: ERROR: Return code 1 from /etc/init.d/nginx Mar 31 09:34:48 FrankTest02 ResourceManager(default)[11659]: CRIT: Giving up resources due to failure of nginx Mar 31 09:34:48 FrankTest02 ResourceManager(default)[11659]: info: Releasing resource group: master 192.168.1.150/24/eth0:0 nginx Mar 31 09:34:48 FrankTest02 ResourceManager(default)[11659]: info: Running /etc/init.d/nginx stop Mar 31 09:34:48 FrankTest02 ResourceManager(default)[11659]: info: Running /etc/ha.d/resource.d/IPaddr 192.168.1.150/24/eth0:0 stop Mar 31 09:34:48 FrankTest02 IPaddr(IPaddr_192.168.1.150)[12022]: INFO: IP status = ok, IP_CIP= Mar 31 09:34:48 FrankTest02 /usr/lib/ocf/resource.d//heartbeat/IPaddr(IPaddr_192.168.1.150)[11996]: INFO: Success
#tail /var/log/messages如果不启动从服务器,所以启动了主服务器以后要启动从服务器 原因:我想到一个问题,我记得上课的时候我只启动主上的heartbeat,从还为启动的时候,主上是不会启动vip和nginx服务的,这是因为,主有一个判断,只有当从节点一切准备就绪时,主才会正常工作。因为它要保证HA集群的可用性,如果从连heartbeat服务都不开启,只能说明这是一个单点,所以它要罢工! Mar 31 09:13:20 FrankTest02 ResourceManager(default)[10114]: info: Releasing resource group: master 192.168.1.150/24/eth0:0 nginx Mar 31 09:13:20 FrankTest02 ResourceManager(default)[10114]: info: Running /etc/init.d/nginx stop Mar 31 09:13:20 FrankTest02 ResourceManager(default)[10114]: info: Running /etc/ha.d/resource.d/IPaddr 192.168.1.150/24/eth0:0 stop Mar 31 09:13:20 FrankTest02 IPaddr(IPaddr_192.168.1.150)[10477]: INFO: IP status = ok, IP_CIP= Mar 31 09:13:20 FrankTest02 /usr/lib/ocf/resource.d//heartbeat/IPaddr(IPaddr_192.168.1.150)[10451]: INFO: Success Mar 31 09:13:29 FrankTest02 heartbeat: [9899]: info: Local Resource acquisition completed. (none) Mar 31 09:13:29 FrankTest02 heartbeat: [9899]: info: local resource transition completed. Mar 31 09:13:50 FrankTest02 hb_standby(default)[10562]: Going standby [foreign]. Mar 31 09:13:50 FrankTest02 heartbeat: [9899]: info: master wants to go standby [foreign] Mar 31 09:14:00 FrankTest02 heartbeat: [9899]: WARN: No reply to standby request. Standby request cancelled.
[[email protected] ha.d]# ls /etc/sysconfig/network-scripts/ #可以看到有eth1网卡, ifcfg-eth0 ifdown-eth ifdown-ppp ifup-aliases ifup-isdn ifup-routes net.hotplug ifcfg-eth1 ifdown-ippp ifdown-routes ifup-bnep ifup-plip ifup-sit network-functions ifcfg-lo ifdown-ipv6 ifdown-sit ifup-eth ifup-plusb ifup-tunnel network-functions-ipv6 ifdown ifdown-isdn ifdown-tunnel ifup-ippp ifup-post ifup-wireless ifdown-bnep ifdown-post ifup ifup-ipv6 ifup-ppp init.ipv6-global 从上: [[email protected] ha.d]# ip addr 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 00:0c:29:03:f8:1f brd ff:ff:ff:ff:ff:ff inet 192.168.1.106/24 brd 192.168.1.255 scope global eth0 inet6 fe80::20c:29ff:fe03:f81f/64 scope link valid_lft forever preferred_lft forever 3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000 link/ether 00:0c:29:03:f8:29 brd ff:ff:ff:ff:ff:ff [[email protected] ha.d]# rm -f /etc/sysconfig/network-scripts/ifcfg-eth1 删掉eth1
重启主从,
#ip addr 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 00:0c:29:58:45:92 brd ff:ff:ff:ff:ff:ff inet 192.168.1.110/24 brd 192.168.1.255 scope global eth0 inet 192.168.1.150/24 brd 192.168.1.255 scope global secondary eth0:0 inet6 fe80::20c:29ff:fe58:4592/64 scope link valid_lft forever preferred_lft forever
但是从上ip addr,还是存在eth1的提示,但是已经把eth1这个网卡删除了应该就没问题了
[[email protected] ha.d]# ip addr 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 00:0c:29:03:f8:1f brd ff:ff:ff:ff:ff:ff inet 192.168.1.106/24 brd 192.168.1.255 scope global eth0 inet6 fe80::20c:29ff:fe03:f81f/64 scope link valid_lft forever preferred_lft forever 3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000 link/ether 00:0c:29:03:f8:29 brd ff:ff:ff:ff:ff:ff
PS:ha.cf上的ucast试验用eth0,线上建议用不同的网卡eth1或者用串口把两个连起来,什么是串口
以上是关于HA 启动heartbeat以后虚拟IP不出现的主要内容,如果未能解决你的问题,请参考以下文章