IP地址接管和故障转移:heartbeat是通过IP地址接管和ARP广播进行故障转移的ARP广播:在主服务区故障时,备用节点接管资源后,会立即强制更新所有客户端本地的ARP表(即清楚客户端本地缓存的失败服务区VIP地址的解析记录),确保客户端和新的主服务器对话
vip/ip别名/辅助IP1,真是IP真实IP,又称为管理IP,一般是配置在物理网卡上的实际IP,这可以看做名称,如,张三。在负载均衡及高可用环境中,管理IP是不对外提供用户访问服务的,而仅仅作为管理服务器用,如SSH可通过这个IP链接服务器!
使用ifconfig查看的就是真实IP,也就是管理IP
2,虚拟IP,VIP在实际环境中,需要在DNS配置中把网站域名地址解析到这个VIP地址中来虚拟IP的好处是在服务宕机后,快速的配置别名IP在cnetos7上被遗弃,centos6还是有的!
(1)手动配置别名VIP:这样的别名是临时,重启即将丢失
[root@localhost ~]# ifconfig eth1:0 10.0.0.100 netmask 255.255.0.0 up
[root@localhost ~]# ifconfig
eth1 Link encap:Ethernet HWaddr 00:0C:29:C4:E4:30
inet addr:10.0.0.14 Bcast:10.0.255.255 Mask:255.255.0.0
inet6 addr: fe80::20c:29ff:fec4:e430/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:302 errors:0 dropped:0 overruns:0 frame:0
TX packets:229 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:28300 (27.6 KiB) TX bytes:26964 (26.3 KiB)
eth1:0 Link encap:Ethernet HWaddr 00:0C:29:C4:E4:30
inet addr:10.0.0.100 Bcast:10.0.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
[root@localhost ~]# route add -host 10.0.0.100 dev eth1
[root@localhost ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.100 0.0.0.0 255.255.255.255 UH 0 0 0 eth1
10.0.0.0 0.0.0.0 255.255.0.0 U 1 0 0 eth1
0.0.0.0 10.0.0.1 0.0.0.0 UG 0 0 0 eth1
[root@localhost ~]#
删除down既可以
[root@localhost ~]# ifconfig eth1:0 down
[root@localhost ~]# ifconfig
eth1 Link encap:Ethernet HWaddr 00:0C:29:C4:E4:30
inet addr:10.0.0.14 Bcast:10.0.255.255 Mask:255.255.0.0
inet6 addr: fe80::20c:29ff:fec4:e430/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:463 errors:0 dropped:0 overruns:0 frame:0
TX packets:340 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:42681 (41.6 KiB) TX bytes:39730 (38.7 KiB)
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:16 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:960 (960.0 b) TX bytes:960 (960.0 b)
[root@localhost ~]#
永久生效则需要写到配置文件(2)手动查看IP,ifconfig即可,ip add也可以
辅助IP辅助IP,使用ip addr add创建辅助IP
[root@localhost ~]# ip addr add 10.0.0.100/23 dev eth1
[root@localhost ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 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: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:c4:e4:30 brd ff:ff:ff:ff:ff:ff
inet 10.0.0.14/16 brd 10.0.255.255 scope global eth1
inet 10.0.0.100/23 scope global eth1
inet6 fe80::20c:29ff:fec4:e430/64 scope link
valid_lft forever preferred_lft forever
删除
[root@localhost ~]# ip addr del 10.0.0.100/23 dev eth1
[root@localhost ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 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: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:c4:e4:30 brd ff:ff:ff:ff:ff:ff
inet 10.0.0.14/16 brd 10.0.255.255 scope global eth1
inet6 fe80::20c:29ff:fec4:e430/64 scope link
valid_lft forever preferred_lft forever
[root@localhost ~]#
heartbeat2.1.4及遗弃使用的别名IP,之后使用的则是辅助ip来提供vip服务,而keepalevid一直使用辅助IP服务
软件发展:从2.1.4后heartbeat分为三个不同的项目heartbeat:集群消息层,主要负责维护集群各个节点的相互通信及基本信息cluster glue:中间层,负责调度,包括两个模块:本地资源管理local resource manager LRM和stonithresource agents:资源代理层,来实现各种资源的启动,停止,监控等