在设计或部署集群环境时,除了要求有多台服务器用于实现冗余以外,设备的冗余也十分重要,服务器中的冗余设备可以有效降低单台服务器的宕机几率,它们主要包括:
网卡绑定
磁盘阵列
磁盘多路径绑定
冗余电源
 
配置步骤:
[root@station1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.101.100
NETMASK=255.255.255.0
GETWAY=192.168.101.1
BONDING_OPTS="mode=1 miimon=100 primary=eth0"
说明:miimon是用来进行链路监测的.miimon=100表示系统每100ms监测一次链路连接状态,如果有一条线路不通就转入另一条线路;mode的值表示工作模式,他共有0,1,2,3四种模式,常用的为0,1两种0为负载均衡模式,1为冗余.

[root@station1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
MASTER=bond0
SLAVE=yes
ONBOOT=yes
HWADDR=00:0c:29:82:37:58
[root@station1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth1
MASTER=bond0
SLAVE=yes
ONBOOT=yes
HWADDR=00:0c:29:82:37:62
[root@station1 ~]# tail -6 /etc/modprobe.conf
alias eth0 pcnet32
alias eth1 pcnet32
alias eth2 pcnet32
alias eth3 pcnet32
alias bond0 bonding
options bonding max_bonds=1
[root@station1 ~]#

[root@station1 ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.4.0 (October 7, 2008)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth1
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0c:29:82:37:62
Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0c:29:82:37:58
[root@station1 ~]#
 
如果是四块网卡两两绑定配置同上只需添加和修改下/etc/modprobe.conf
alias bond1 bonding
options bonding max_bonds=2