如何架设LVS集群服务器
来源:互联网 发布:网络搞笑鬼子进村 编辑:程序博客网 时间:2024/04/30 13:39
LVS,即linux virtual server, 就是Linux环境下架设集群服务器的一种实现方式,目的是通过多个服务器一起提供高性能的服务。很适合大型网站的接入。
LVS可以通过3种方式搭建:分别为NAT,IP tunneling,和Direct routing. 其中NAT方式性能较差,其它两种都差不多。详情见官方网站:http://www.linuxvirtualserver.org
下面以IP tunneling具体实例,来介绍如果搭建LVS.
1. Installation:
Install ipvs module at Load Balancer, the following modules must be installed at least:
/root/modules/ipvs # lsmod
Module Size Used by Tainted: G
ip_vs_ftp 7560 0
ip_vs_rr 2560 1
ip_vs 85184 5 ip_vs_ftp,ip_vs_rr
and then install configuration tool "ipvsadm".
2. configuration:
Definition:
Load Balancer: 192.168.1.249
real server1: 192.168.1.252
real server2: 192.168.1.253
virtual address: 192.168.1.110
In my example, I setup a virtual server 192.168.1.110:3000.
1).For load banlancer:
ifconfig eth0:0 192.168.1.110 netmask 255.255.255.255 broadcast 192.168.1.110 up
route add -host 192.168.1.110 dev eth0:0
ipvsadm -A -t 192.168.1.110:3000 -s rr
ipvsadm -a -t 192.168.1.110:3000 -r 192.168.1.252 -i -w 1
ipvsadm -a -t 192.168.1.110:3000 -r 192.168.1.253 -i -w 1
2). For real server #1 and #2:
#install ip tunnel module
modprobe ipip
#setup ip tunnel address
ifconfig tunl0 192.168.1.110 netmask 255.255.255.255 broadcast 192.168.1.110 up
route add -host 192.168.1.110 dev tunl0
#disable arp reply
echo 8 > /proc/sys/net/ipv4/conf/tunl0/arp_ignore
3. Setup service in real server side.
For my example, http is running at the real server #1 and #2, port 3000.
How does it works?
When issue a http request to load balancer 192.168.1.110:3000, the load balancer will
select a workable server, and use ipip to encapsulate and send the ipip packet to the realserver.
The realserver ipip module will decode the ipip packet, and issue the encapsulated data to
network layer. The network layer will deliver the packet to the httpd, because it's listening on the
port 3000.
From httpd side view, the packet is come from client machine directly!
So httpd processes and send the packet to client. And then the client get data.
- 如何架设LVS集群服务器
- 集群服务器--LVS/tun
- Linux服务器集群LVS
- LVS 集群服务器实施详解
- LVS Linux服务器集群系统
- LVS服务器集群系统结构
- LVS+Keepalived搭建服务器集群
- LVS服务器集群系统结构
- 如何架设流媒体服务器
- 如何架设vpn服务器
- 如何架设流媒体服务器
- 如何架设流媒体服务器
- 如何架设流媒体服务器
- 如何架设PHP服务器
- 如何架设流媒体服务器
- 如何架设流媒体服务器
- 如何架设流媒体服务器
- 如何架设svn服务器
- 感恩节,《2012》,尖叫
- 请问'tab':undefined identifier是怎么回事啊?
- 安装VS2008 .net framework Failed to open XML file 问题解决办法
- 获得当前锁表用户和杀死该用户进程
- 线段树+离散化+线性扫描 POJ 1151 Atlantis
- 如何架设LVS集群服务器
- 【转载】哈佛图书馆自习墙上的训言
- Java网络编程1
- 李清照《声声慢》欣赏(转载)
- TreeView控件
- 2009年fast大会的best paper:《CA-NFS:A Congestion-Aware Network File System》
- 睿智男人的24条生存法则
- 可以画波形的播放器实现
- Linux 查看磁盘分区、文件系统、磁盘的使用情况相关的命令和工具介绍