背景:
阅读新闻
LVS+Keepalived实现高可用和负载均衡的解决方案
[日期:2012-03-12] 来源:Linux社区 作者:Linux [字体:]
实验拓扑图:
实验ip规划
VIP:192.168.1.200
Real server1:192.168.1.195
Real server2:192.168.1.193
心跳线:10.1.1.1、10.1.1.2
DR1:192.168.1.192
DR2:192.168.1.1.190
实现过程
第一:在主节点上的配置
首先配置LVS
[root@localhost ~]# cd tools/
[root@localhost tools]# ls ipvsadm-1.24.tar.gz
ipvsadm-1.24.tar.gz
[root@localhost tools]# tar zxvf ipvsadm-1.24.tar.gz
[root@localhost tools]# cd ipvsadm-1.24
[root@localhost ipvsadm-1.24]# ln -s /usr/src/kernels/2.6.18-164.el5 /usr/src/linux/
[root@localhost ipvsadm-1.24]# make all && make install
然后安装配置keepalived
[root@localhost tools]# ls keepalived-1.2.2.tar.gz
keepalived-1.2.2.tar.gz
[root@localhost tools]# tar zxvf keepalived-1.2.2.tar.gz
[root@localhost tools]# cd keepalived-1.2.2
[root@localhost keepalived-1.2.2]# vi keepalived/libipvs-2.6/ip_vs.h
找到下面一行:
#include <linux/types.h> /* For __beXX types in userland */
把他放到下面一行的下面:
#include <sys/types.h>
[root@localhost keepalived-1.2.2]# make && make install
[root@localhost keepalived-1.2.2]# ln -s /usr/local/sbin/keepalived /sbin/
[root@localhost ~]# cd /etc/keepalived/
[root@localhost keepalived]# cp keepalived.conf keepalived.conf.bak //备份
[root@localhost keepalived]# vi keepalived.conf //修改设置档如下
! Configuration File for keepalived
global_defs {
notification_email {
wethnicity@126.com
38205036@qq.com
}
notification_email_from Alexandre.Cassen@firewall.loc
smtp_server 192.168.1.192
smtp_connect_timeout 30
router_id LVS_DEVEL
}
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_typePASS
auth_pass 1111
}
virtual_ipaddress {
192.168.1.200
}
}
virtual_server 192.168.1.200 80 {
delay_loop 6
lb_algo rr
lb_kind DR
nat_mask 255.255.255.0
persistence_timeout 50
protocol TCP
real_server 192.168.1.193 80 {
weight 1
TCP_CHECK {
connect_timeout 10
nb_get_retry 3
delay_before_retry 3
}
}
real_server 192.168.1.195 80 {
weight 1
TCP_CHECK {
connect_timeout 10
nb_get_retry 3
delay_before_retry 3
}
}
}
VMware Linux下webalizer/awstats部署实验
相关资讯
本文评论 查看全部评论 (0)
尊重网上道德,遵守中华人民共和国的各项有关法律法规 承担一切因您的行为而直接或间接导致的民事或刑事法律责任 本站管理人员有权保留或删除其管辖留言中的任意内容 本站有权在网站内转载或引用您的评论 参与本评论即表明您已经阅读并接受上述条款
评论声明
最新资讯