江湖浪人 发表于 2019-1-5 11:35:29

LINUX负载均衡LVS之DR模型

LINUX负载均衡LVS之DR模型
LVS-DR(Direct Routing):直接路由模型
http://blog.运维网.com/attachment/201310/163102933.png
特点:
①RealServer和Director必须处于同一IP段.
②这种模型最多支持的Real节点数目100个.
③由于要对数据包只经过了3次处理,所以效率很好.
④由于Real节点最后直接将请求返回给Client,所以RealServer没有必要网关参数.
案例:
http://blog.运维网.com/attachment/201310/163103984.png
DIRECTOR
地址参数
http://blog.运维网.com/attachment/201310/163104219.png
http://blog.运维网.com/attachment/201310/163106665.png
重启网络服务
http://blog.运维网.com/attachment/201310/163108552.png
安装lvs用户空间的工具ipvsadm
http://blog.运维网.com/attachment/201310/163110601.png
编写ipvsadm转发功能
http://blog.运维网.com/attachment/201310/163112493.png
保存下来
http://blog.运维网.com/attachment/201310/163112946.png
  

SERVER1
修改内核参数对192.168.2.100的arp请求不作出回应
http://blog.运维网.com/attachment/201310/163114984.png
http://blog.运维网.com/attachment/201310/163116487.png
http://blog.运维网.com/attachment/201310/163117360.png
重启网络服务
http://blog.运维网.com/attachment/201310/163118338.png
最好添加一条路由
http://blog.运维网.com/attachment/201310/163120906.png
安装web服务器
http://blog.运维网.com/attachment/201310/163121442.png
http://blog.运维网.com/attachment/201310/163122967.png
# service httpd restart
设置开机启动
# chkconfig httpd on
SERVER2
修改内核参数对192.168.2.100的arp请求不作出回应
http://blog.运维网.com/attachment/201310/163126870.png
修改地址参数
# service httpd restart
http://blog.运维网.com/attachment/201310/163127878.png
http://blog.运维网.com/attachment/201310/163128149.png
重启网络服务
http://blog.运维网.com/attachment/201310/163129129.png
同样也添加一条路由
http://blog.运维网.com/attachment/201310/163130444.png
安装web服务器
http://blog.运维网.com/attachment/201310/163131616.png
设置开机启动
# chkconfig httpd on
**************************************

通过我们的宿主机来访问一下


http://blog.运维网.com/attachment/201310/163132676.png
刷新一下
http://blog.运维网.com/attachment/201310/163133890.png
http://blog.运维网.com/attachment/201310/163134978.png
因为是RR轮询调度算法,所以他们的连接数是一样的。

存储Nas采用(nfs)
地址参数
http://blog.运维网.com/attachment/201310/163138860.png
在虚拟机上放入VWnet2区域
http://blog.运维网.com/attachment/201310/163150651.png
创建共享目录
http://blog.运维网.com/attachment/201310/163152724.png
安装nfs文件共享
http://blog.运维网.com/attachment/201310/163153822.png
http://blog.运维网.com/attachment/201310/163154409.png
http://blog.运维网.com/attachment/201310/163156212.png
http://blog.运维网.com/attachment/201310/163157877.png
http://blog.运维网.com/attachment/201310/163158858.png
Server1
地址参数
http://blog.运维网.com/attachment/201310/163320702.png
也放入VMnet2区域
http://blog.运维网.com/attachment/201310/163321138.png
挂载文件
http://blog.运维网.com/attachment/201310/163322575.png
http://blog.运维网.com/attachment/201310/163322914.png
Server2
地址参数
http://blog.运维网.com/attachment/201310/163325281.png
也放入VMnet2区域
http://blog.运维网.com/attachment/201310/163328326.png
挂载文件
http://blog.运维网.com/attachment/201310/163331313.png
http://blog.运维网.com/attachment/201310/163332785.png
下面我们来访问一下
http://blog.运维网.com/attachment/201310/163332284.pngCU
你会发现不管怎么刷新都是不会变的。
http://blog.运维网.com/attachment/201310/163332606.png
  




页: [1]
查看完整版本: LINUX负载均衡LVS之DR模型