文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > IT/计算机 > linux实现web负载均衡
侵权投诉

linux实现web负载均衡

一、Director配置

1、设置网络接口地址

[root @director root] # vi

/etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

BOOTPROTO=static

BROADCAST=192.168.0.255

HWADDR=00:0C:29:A2:BD:B5

IPADDR=192.168.0.160

NETMASK=255.255.255.0

NETWORK=192.168.0.0

ONBOOT=yes

2、编辑 lvs 脚本

[root @director root] # vi /etc/init.d/lvsdr

#!/bin/bash

VIP=192.168.0.222

RIP1=192.168.0.249

RIP2=192.168.0.251

/etc/rc.d/init.d/funcions

case "$1" in

start)

echo "start LVS of DirectorServer"

#Set the Virtual ip address

/sbin/ifconfig eth0:0 $VIP broadcast $VIP netmask 255.255.255.255 up /sbin/route add -host $VIP dev eth0:0

# Clear ipvs Table

/sbin/ipvsadm -C

# set lvs

/sbin/ipvsadm -A -t $VIP:80 -s rr

/sbin/ipvsadm -a -t $VIP:80 -r $RIP1:80 -g

/sbin/ipvsadm -a -t $VIP:80 -r $RIP2:80 -g

#Run Lvs

/sbin/ipvsadm

;;

stop)

echo "close LVS Directorsever"

/sbin/ipvsadm -C

/sbin/ifconfig eth0:0 down

;;

*)

echo "Usage: $0 {start|stop}"

exit 1

esac

第1页

你可能喜欢

  • 集群部署
  • Nginx负载均衡
  • 负载均衡软件
  • 服务器负载均衡
  • 负载均衡方案
  • 服务器方案
  • 服务器集群
  • 应用负载均衡

热门文档

相关文档

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email