标签:cluster集群keepalived热备+lvs服务
keepalived
通过在两台主、备调度器上实现Keepalived高可用解决调度器单点失败问题
主、备调度器上配置LVS,正常情况下主调度器工作
主调度器异常时,Keepalived启用备用调度器,保证了调度器的高可用
调度器保证了后台服务的高可用
调度器安装keepalived
# yum install -y gcc gcc-c++ kernel-devel openssl-devel popt-devel
# tar xvzf keepalived-1.2.7.tar.gz -C /usr/src/
# cd /usr/src/keepalived-1.2.7/
# ./configure --sysconf=/etc --with-kernel-dir=/usr/src/kernels/2.6.32-358.el6.x86_64/ && make && make install
#ln -s /usr/local/sbin/keepalived /sbin/
# chkconfig keepalived on
二、Keepalived配置说明
设置报警邮件
global_defs {
notification_email {
admin@tarena.com.cn
}
notification_email_from ka@localhost
smtp_server 192.168.20.1
smtp_connect_timeout 30
router_id LVS_devel
}
VRRP实例设置
vrrp_instance VI_1 {
state MASTER //主服务器为MASTER,辅助为SLAVE
interface eth0
virtual_router_id 51
priority 100 //主服务器优先级要比辅助的高
advert_int 1
authentication {
auth_type pass
auth_pass forlvs //主辅服务器密码必须一致
}
virtual_ipaddress { 192.168.20.100 }
}
virtual_server 192.168.20.100 80 { //设置虚拟IP为192.168.20.100
delay_loop 6
lb_algo rr //设置LVS调度算法为RR
lb_kind DR //设置LVS的模式为DR
persistence_timeout 50
protocol TCP
real_server 192.168.20.150 80 {
weight 3 //设置权重为3
TCP_CHECK {
connect_timeout3
nb_get_retry3
delay_before_retry3
}
}
#Real Server参见VLS-DR部分的配置
标签:cluster集群keepalived热备+lvs服务
原文地址:http://liangzai818.blog.51cto.com/10003446/1754022