LVS/DR + Keepalived搭建负载均衡集群(2)

[root@localhost ~]# curl 192.168.11.110
rs1rs1
[root@localhost ~]# curl 192.168.11.110
rs1rs1
[root@localhost ~]# curl 192.168.11.110
rs1rs1
[root@localhost ~]# curl 192.168.11.110
rs1rs1

[root@dr1 ~]# tail -2 /var/log/messages
Jun  9 23:27:19 localhost Keepalived_healthcheckers[1572]: TCP connection to [192.168.11.101]:80 failed !!!
Jun  9 23:27:19 localhost Keepalived_healthcheckers[1572]: Removing service [192.168.11.101]:80 from VS [192.168.11.110]:80

rs2启动nginx,日志文件记录adding rs2;curl测试,发现请求平均分配到rs1和rs2上面了;

[root@rs2 ~]# /etc/init.d/nginx start

[root@dr1 ~]# tail -2 /var/log/messages
Jun  9 23:31:38 localhost Keepalived_healthcheckers[1572]: TCP connection to [192.168.11.101]:80 success.
Jun  9 23:31:38 localhost Keepalived_healthcheckers[1572]: Adding service [192.168.11.101]:80 to VS [192.168.11.110]:80

[root@localhost ~]# curl 192.168.11.110
rs1rs1
[root@localhost ~]# curl 192.168.11.110
rs2rs2
[root@localhost ~]# curl 192.168.11.110
rs1rs1
[root@localhost ~]# curl 192.168.11.110
rs2rs2

加入dr2 备用dircetor机器;
主上停止keepalive服务;stop之后,在从上ip addr查看绑定虚拟ip,说明从接管了服务;切换速度很快;
主上启动keepalived服务后,主绑定虚拟ip,接管服务;
[root@dr2 keepalived]# ip addr
eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether 00:0c:29:af:73:3f brd ff:ff:ff:ff:ff:ff
    inet 192.168.11.40/24 brd 192.168.11.255 scope global eth1
    inet 192.168.11.110/32 scope global eth1

nc命令可以扫描端口是否打开:

在其他机器上扫描,11.100 和11.101,11.110的80端口是否打开;

#nc -z -w2 192.168.11.110 80
[root@localhost ~]# nc -z -w2 192.168.11.100 80
Connection to 192.168.11.100 80 port [tcp/http] succeeded!
[root@localhost ~]# nc -z -w2 192.168.11.101 80
Connection to 192.168.11.101 80 port [tcp/http] succeeded!
[root@localhost ~]# nc -z -w2 192.168.11.110 80
Connection to 192.168.11.110 80 port [tcp/http] succeeded!

LVS+Keepalived实现四层负载及高可用 

LVS+Keepalived高可用负载均衡集群架构实验 

Heartbeat+LVS构建高可用负载均衡集群 

搭建LVS负载均衡测试环境 

一个针对LVS的压力测试报告

CentOS 6.3下Haproxy+Keepalived+Apache配置笔记

Haproxy + KeepAlived 实现WEB群集 on CentOS 6

Keepalived+Haproxy配置高可用负载均衡

Haproxy+Keepalived构建高可用负载均衡

CentOS 7 上配置LVS + Keepalived + ipvsadm

Keepalived高可用集群搭建

Keepalived 的详细介绍请点这里
Keepalived 的下载地址请点这里

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/1014fa3c135fef5612f65f644c9939ec.html