Ubuntu OS xen虚拟机上测试LVS和Keepalived负载均衡

Ubuntu OS xen虚拟机上测试lvs和keepalived负载均衡


网络拓扑:

Ubuntu OS xen虚拟机上测试LVS和Keepalived负载均衡

虚拟机管理器和xen虚拟机实例:

Ubuntu OS xen虚拟机上测试LVS和Keepalived负载均衡

step1: 安装LVSkeepalived:director服务器上,分别安装LVSkeepalived软件,使用命令:

$sudo apt-get install ipvsadm

keepalived,使用命令:

$sudo apt-get installkeepalived

step2:配置keepalived:安装装完之后,在/etc/keepalived目录下建立keepalived.conf文件,写入配置文件如下:

# Global Configuration

global_defs {

lvs_id  director1

}

# VRRP Configuration

vrrp_instance LVS {

state MASTER

interface eth0

virtual_router_id 51

priority 150

advert_int 1

authentication {

auth_type PASS

auth_pass 123456

}

virtual_ipaddress {

192.168.122.38

}

# Virtual ServerConfiguration - for WWW service

virtual_server 192.168.122.3880 {

delay_loop 1

lb_algo rr

lb_kind DR

persistence_timeout 60

protocol TCP

# Real Server 1 configuration

real_server 192.168.122.36 80{

weight 3

TCP_CHECK {

connection_timeout 10

nb_get_retry 3

delay_before_retry 3

}

real_server 192.168.122.37 80{

weight 1

TCP_CHECK {

connection_timeout 10

nb_get_retry 3

delay_before_retry 3

}

}

}

相关推荐