一:DR-模式
调度器Ip:192.168.1.254
服务器ip:192.168.1.1/192.168.1.2
VIP:192.168.1.10
——配置负载均衡调度器:
关闭重定向响应配置:
Vim /etc/sysctl.conf
net.ipv4.conf.all.send_redirects = 0 net.ipv4.conf.defautl.send_redirects = 0 net.ipv4.conf.eth0.send_redirects = 0 net.ipv4.conf.eth1.send_redirects = 0
sysctl -p
Vip配置方法:
ifconfig eth0:0 192.168.1.10 netmask 255.255.255.255 broadcast 192.168.1.10
配置:
ipvsadm –A –t 192.168.1.10:80 –s rr ipvsadm –a –t 192.168.1.10:80 –r 192.168.1.1:80 –g –w 1 ipvsadm –a –t 192.168.1.10:80 –r 192.168.1.2:80 –g –w 1
service ipvsadm save
chkconfig ipvsadm on
——配置服务器:
Vip配置方法:
ifconfig lo:0 192.168.1.10 netmask 255.255.255.255 broadcast 192.168.1.10
配置R:
route add –host 192.168.1.10 dev lo:0
Vim /etc/rc.local ——开机执行
Route add –host 192.168.1.10 dev lo:0
关闭arp:
Vim /etc/sysctl.conf
net.ipv4.conf.all.arp_ignore = 1 net.ipv4.conf.all.arp_announce = 2 net.ipv4.conf.defautl.arp_ignore = 1 net.ipv4.conf.defautl.arp_announce = 2 net.ipv4.conf.lo.arp_ignore = 1 net.ipv4.conf.lo.arp_announce = 2
sysctl -p
注意:配置vip和本地ip地址,关闭arp配置
二:NFS共享存储
——NFS服务器:
设共享存储的文件夹为:/mkdia/root
Mkdir /mkdia/root
安装nft-utils、rpcbind
查询是否存在:rpm –qa |grep nfs/rpcbind
Yum –y install nfs-utils rpcbind
Chkconfig nfs/rpcbind on
配置/ect/exports 配置文件,将/mkdia/root发布为共享文件夹
Vim /ect/exports
/mkdia/root 192.168.1.0/24(rw,sync,no_root_squash)
依次启动rpcbind、nfs服务,确认共享结果
Service rpcbind start
Service nfs start
Showmount –e
出现下面提示则成功发布文件夹
Exports list for localhost.localaomain:
/mkdia/root 192.168.1.0/24
——NFS客户机:
确认是否安装rpcbinds
开启rpcbind服务:service rpcbind start
挂载共享存储到本地的/var/www/html下:
Mount 192.168.1.254:/mkdia/root /var/www/html
设置开机挂载:vim /etc/fstab
192.168.1.254:/mkdia/root nfs /var/www/html defaults,netdev 0 0
确认是否挂载成功:tail -1 /etc/mtab
本文版权声明:
本文作者:魁·帝小仙
博文主页地址:http://www.cnblogs.com/dxxblog/
欢迎对小博主的博客内容批评指点,如果问题,可评论或邮件联系(2335228250@qq.com)
欢迎转载,转载请在文章页面明显位置给出原文链接,谢谢