出现该问题一般是因为主存储(server)nfs服务器IP地址不对造句造成的
/usr/src *(rw,sync,no_root_squash) /home *(rw,sync,no_root_squash) #/usr/src centos22(rw,sync,no_root_squash) #/usr/src centos33(rw,sync,no_root_squash) #/usr/src centos44(rw,sync,no_root_squash) #/usr/src centos55(rw,sync,no_root_squash) #/usr/src --root=centos22
LVS负载均衡服务器
eth0 Link encap:Ethernet HWaddr 00:0C:29:4E:B7:C3
inet addr:192.168.0.12 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe4e:b7c3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3088 errors:0 dropped:0 overruns:0 frame:0
TX packets:3106 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:325969 (318.3 KiB) TX bytes:473711 (462.6 KiB)
Interrupt:169 Base address:0x2024
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:16436 Metric:1
RX packets:688 errors:0 dropped:0 overruns:0 frame:0
TX packets:688 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:52912 (51.6 KiB) TX bytes:52912 (51.6 KiB)
lo:0 Link encap:Local Loopback
inet addr:192.168.0.11 Mask:255.255.255.255
UP LOOPBACK RUNNING MTU:16436 Metric:1
realserver 服务器1
ifconfig eth0 192.168.0.22 netmask 255.255.255.0 route add default gw 192.168.0.1 service portmap start service nfs start #mount -t nfs 192.168.0.11:/usr/src /usr/src /usr/local/php/sbin/php-fpm start /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf /realserver.sh start mount -t nfs 192.168.0.12:/usr/src /usr/src mount -t nfs 192.168.0.12:/home /home chattr +i /etc/resolv.conf
realserver 服务器2
#!/bin/sh touch /var/lock/subsys/local ifconfig eth0 192.168.0.33 netmask 255.255.255.0 route add default gw 192.168.0.1 #chattr +i /etc/resolv.conf service portmap start service nfs start #mount -t nfs 192.168.0.11:/usr/src /usr/src /usr/local/php/sbin/php-fpm start /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf /realserver.sh start mount -t nfs 192.168.0.12:/usr/src /usr/src mount -t nfs 192.168.0.12:/home /home #echo "nameserver 192.168.0.1" > /etc/resolv.conf ~
其中web服务器脚本 realserver.sh
#!/bin/bash VIP=192.168.0.11 case "$1" in start) echo "start lvs RealServer" /sbin/ifconfig lo:0 $VIP broadcast $VIP netmask 255.255.255.255 up /sbin/route add -host $VIP dev lo:0 echo "1" >/proc/sys/net/ipv4/conf/lo/arp_ignore echo "2" >/proc/sys/net/ipv4/conf/lo/arp_announce echo "1" >/proc/sys/net/ipv4/conf/all/arp_ignore echo "2" >/proc/sys/net/ipv4/conf/all/arp_announce echo "1" >/proc/sys/net/ipv4/ip_forward ;; stop) /sbin/ifconfig lo:0 down /sbin/route del $VIP > /dev/null 2>&1 echo "close LVS RealServer" echo "0" >/proc/sys/net/ipv4/conf/lo/arp_ignore echo "0" >/proc/sys/net/ipv4/conf/lo/arp_announce echo "0" >/proc/sys/net/ipv4/conf/all/arp_ignore echo "0" >/proc/sys/net/ipv4/conf/all/arp_announce echo "0" >/proc/sys/net/ipv4/ip_forward ;; *) echo "Usage:$0 {start|stop}" exit 1 esac
其中LVS集群中的每台服务器设置:/etc/hosts
192.168.0.11 centos11 192.168.0.22 centos22 192.168.0.33 centos33 192.168.0.44 centos44 192.168.0.55 centos55
只要把共享存储服务器挂载到所需服务器上运行即可解决上面的问题.