lvs+ldirectord
来源:互联网 发布:哈登 nba数据 编辑:程序博客网 时间:2024/06/01 14:10
原网页
http://www.noblenet.org/evergreenwiki/index.php/Ldirectord_setup
Ldirectord setup
Following these directions here:
http://www.howtoforge.com/high_availability_loadbalanced_apache_cluster
System Name IPVirtual IPevergreen172.29.120.84Load node 1:load1172.29.120.79Apache node1:Apache01172.29.120.83Apache node2:Apache02172.29.120.68Apache node3:Apache03172.29.120.71Apache node4:Apache04172.29.120.74</pre.1. Enable IPVS on load balancer. IP Virtual Server implements transport layer load balancing inside the linux 2.6 kernel.<pre>echo ip_vs_dh >> /etc/modulesecho ip_vs_ftp >> /etc/modulesecho ip_vs >> /etc/modulesecho ip_vs_lblc >> /etc/modulesecho ip_vs_lblcr >> /etc/modulesecho ip_vs_lc >> /etc/modulesecho ip_vs_nq >> /etc/modulesecho ip_vs_rr >> /etc/modulesecho ip_vs_sed >> /etc/modulesecho ip_vs_sh >> /etc/modulesecho ip_vs_wlc >> /etc/modulesecho ip_vs_wrr >> /etc/modulesmodprobe ip_vs_dhmodprobe ip_vs_ftpmodprobe ip_vsmodprobe ip_vs_lblcmodprobe ip_vs_lblcrmodprobe ip_vs_lcmodprobe ip_vs_nqmodprobe ip_vs_rrmodprobe ip_vs_sedmodprobe ip_vs_shmodprobe ip_vs_wlcmodprobe ip_vs_wrr
2. Install ipvsadm and ldirectord. Get perl-doc also in order to read the ldirectord help pages.
apt-get install ipvsadmupdate-rc.d: warning: ipvsadm start runlevel arguments (2 3 4 5) do not match LSB Default-Start values (2 3 5)ipvsadm is not configured to run. Please run dpkg-reconfigure ipvsadm.apt-get install ldirectordSetting up ldirectord (1:1.0.3-3.1) ...No configuration file found, doing nothing. ... (warning).apt-get install perl-doc
3. Enable packet forwarding on the load balancer in /etc/sysctl.conf. Then load the new setting.
# Enables packet forwardingnet.ipv4.ip_forward = 1sysctl -p
4. Configure ipvsadm. Running dpkg-reconfigure will create the two files ipvsadm.rules and ipvsadm.
dpkg-reconfigure ipvsadmLoad on boot: NoDaemon method: none/etc/ipvsadm.rules# emtpy rules file for ipvsadm/etc/default/ipvsadmAUTO="false"DAEMON="none"
5. Configure ldirectord.
/etc/ha.d/ldirectord.cfchecktimeout=10checkinterval=2autoreload=nologfile="/var/log/ldirectord.log"quiescent=yesvirtual=172.29.120.84:80 real=172.29.120.83:80 gate real=172.29.120.68:80 gate real=172.29.120.71:80 gate real=172.29.120.74:80 gate #fallback=127.0.0.1:80 gate service=http request="ldirector.html" receive="Test Page" scheduler=wlc protocol=tcp checktype=negotiatevirtual=172.29.120.84:443 real=172.29.120.83:443 gate real=172.29.120.68:443 gate real=172.29.120.71:443 gate real=172.29.120.74:443 gate #fallback=127.0.0.1:443 gate service=http request="ldirector.html" receive="Test Page" scheduler=wlc #weighted least connection; rr round robin protocol=tcp checktype=negotiate
Point to this file in /etc/default/ldirectord
CONFIG_FILE=/etc/ha.d/ldirectord.cf
Status of ldirector:
ldirectord ldirectord.cf status\1 better written as $1 at /usr/sbin/ldirectord line 1252.\1 better written as $1 at /usr/sbin/ldirectord line 1252.ldirectord for /etc/ha.d/ldirectord.cf is running with pid: 2629
6. Configure heartbeat. Not using heartbeat. ldirectord typically is started from heartbeat but can also be run from the command line.
7. Start ldirectord.
/etc/init.d/ldirectord startipvsadm -L -nIP Virtual Server version 1.2.1 (size=4096)Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConnTCP 172.29.120.84:80 wlc -> 172.29.120.68:80 Route 1 0 0 -> 172.29.120.71:80 Route 1 0 0 -> 172.29.120.74:80 Route 1 0 0 -> 172.29.120.83:80 Route 1 0 0TCP 172.29.120.84:443 wlc -> 172.29.120.68:443 Route 0 0 0 -> 172.29.120.71:443 Route 0 0 0 -> 172.29.120.74:443 Route 0 0 0 -> 172.29.120.83:443 Route 0 0 0
The load balancer should list the virtual IP:
ip addr sh eth02: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000 link/ether 78:2b:cb:11:93:9c brd ff:ff:ff:ff:ff:ff inet 172.29.120.79/26 brd 172.29.120.127 scope global eth0
8. Configure the apache nodes to accept requests on the virtual IP 172.29.120.84.
/etc/sysctl.conf# NOBLE load balancing settings# Enable configuration of arp_ignore optionnet.ipv4.conf.all.arp_ignore = 1# When an arp request is received on eth0, only respond if that address is# configured on eth0. In particular, do not respond if the address is# configured on lonet.ipv4.conf.eth0.arp_ignore = 1# Ditto for eth1, add for all ARPing interfaces#net.ipv4.conf.eth1.arp_ignore = 1# Enable configuration of arp_announce optionnet.ipv4.conf.all.arp_announce = 2# When making an ARP request sent through eth0 Always use an address that# is configured on eth0 as the source address of the ARP request. If this# is not set, and packets are being sent out eth0 for an address that is on# lo, and an arp request is required, then the address on lo will be used.# As the source IP address of arp requests is entered into the ARP cache on# the destination, it has the effect of announcing this address. This is# not desirable in this case as adresses on lo on the real-servers should# be announced only by the linux-director.net.ipv4.conf.eth0.arp_announce = 2# Ditto for eth1, add for all ARPing interfaces#net.ipv4.conf.eth1.arp_announce = 2
Load the new settings:
sysctl -p
9. Configure /etc/ha.d/haresources (to start ldirectord from heartbeat). Is this necessary?
load1 \ ldirectord::ldirectord.cf \ IPaddr2::172.29.120.84/26/eth0 \
10. Configure network interface for the virtual IP on the apache servers.
/etc/network/interfaces# Load balancing virtual interfaceauto lo:0iface lo:0 inet static address 172.29.120.84 netmask 255.255.255.255 pre-up sysctl -p > /dev/nullenable the interface:ifup lo:0Run ifconfig to verify interface is up:lo:0 Link encap:Local Loopback inet addr:172.29.120.84 Mask:255.255.255.255 UP LOOPBACK RUNNING MTU:16436 Metric:1
11. Create /openils/var/web/ldirector.html on the apache servers.
Test Page
12. Test.
Browse to 172.29.120.84 (virtual IP)
- lvs+ldirectord
- heartbeat+ldirectord+lvs nat
- heartbeat+LVS+ldirectord
- Heartbeat+lvs+ldirectord
- Lvs+Ldirectord+Heartbeat
- Lvs+Ldirectord+Heartbeat
- HA + LVS + ipvsadm + heartbeat-ldirectord
- Heartbeat+DRDB+LVS+Keepalived+Ldirectord
- ldirectord对lvs进行检测
- centos 5.2 lvs+heartbeat+ldirectord集群
- lvs+heartbeat+ldirectord(centos5 测试通过)
- Centos5.5下lvs+heartbeat+ldirectord
- Heartbeat+ipvsadm+ldirectord高可用双机lvs
- Heartbeat,LVS ,Keepalived,Ldirectord功能及配置
- Heartbeat + LVS + ldirectord构建可伸缩网络服务(1)
- LVS+heartbeat+ldirectord高可用负载均衡集群解决方案
- Linux 系统 LVS(DR)+ldirectord 实现负载平衡
- VMWare虚拟机环境下的Linux服务器集群 - 使用LVS+Heartbeat+Ldirectord (2)LVS脚本编写
- IaaS, PaaS和SaaS公司都做些什么
- 内存_PA_MAP_VA
- poj 2796 Feel Good (单调栈)
- 统一设计,iOS6也玩扁平化
- 使用jdbc向数据库插入100000条记录
- lvs+ldirectord
- 算法之逆序对问题求解
- HDU 2553 N皇后问题
- linux tree 命令
- 十个海量数据处理方法大总结
- python Image库 出错
- 大数据量下的数据库查询与插入如何优化? (整理)
- Ubuntu的软件都安装到哪里去了
- Android支付接入(一):支付宝