Linux下搭建HA高可用集群(3)

Windows客户端一直ping 192.168.11.100 ,一直通,停止心跳服务后中间会中断一会,之后一直通;
在从上ifconfig查看出现eth1:0,查看nginx进程也有,说明转换到从机器上运行;


13、测试3:测试脑裂,主和从都停掉eth1网卡;

eth1网卡禁用,ifdown eth1 心跳线断了之后,会发生脑裂;主从之间连接断了,从在死亡时间没收到主的心跳,则认为主死亡。
主死了,从机器接管服务,从机器使用虚��ip地址,主和从都在运行服务;
主机器没有eth1网卡,一直运行nginx;
[root@yong ha.d]# ifconfig 
eth0      Link encap:Ethernet  HWaddr 00:0C:29:43:3D:32 
          inet addr:192.168.20.20  Bcast:192.168.20.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe43:3d32/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:11442 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15376 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:842833 (823.0 KiB)  TX bytes:10226838 (9.7 MiB)
          Interrupt:18 Base address:0x2000 
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:1163 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1163 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:150095 (146.5 KiB)  TX bytes:150095 (146.5 KiB)

[root@yong ha.d]# ps aux |grep nginx
root    11686  0.0  0.1  5000  636 ?        Ss  14:27  0:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
nobody  11687  0.0  0.1  5200  988 ?        S    14:27  0:00 nginx: worker process

从机器查看地址,eth1:0出现
[root@localhost ha.d]# ifconfig 
eth0      Link encap:Ethernet  HWaddr 00:0C:29:97:C3:EC 
          inet addr:192.168.20.30  Bcast:192.168.20.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe97:c3ec/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7901 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5891 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:603592 (589.4 KiB)  TX bytes:2094606 (1.9 MiB)
          Interrupt:19 Base address:0x2000 
eth1      Link encap:Ethernet  HWaddr 00:0C:29:97:C3:F6 
          inet6 addr: fe80::20c:29ff:fe97:c3f6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:20774 errors:0 dropped:0 overruns:0 frame:0
          TX packets:59144 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3513861 (3.3 MiB)  TX bytes:12998603 (12.3 MiB)
          Interrupt:18 Base address:0x2080 
eth1:0    Link encap:Ethernet  HWaddr 00:0C:29:97:C3:F6 
          inet addr:192.168.11.100  Bcast:0.0.0.0  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:18 Base address:0x2080

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/43e4a8ec4f806d6315ffea1d95d07bb7.html