lvs-nat 模式-piranha (2)

 

lvs-nat 模式-piranha

 

5.5 配置真实服务器(rs01和rs02)步骤add->edit->accept->active

 

lvs-nat 模式-piranha

 

lvs-nat 模式-piranha

 

lvs-nat 模式-piranha

 

5.6  up对外服务的vip

 

lvs-nat 模式-piranha

 

5.7 将在lvs01 上的配置文件复制到lvs02 上,

[root@lvs01 ~]# scp /etc/sysconfig/ha/lvs.cf lvs02:/etc/sysconfig/ha/lvs.cf

root@lvs02's password:

lvs.cf                              100%  865     0.8KB/s   00:00   

[root@lvs01 ~]# cat /etc/sysconfig/ha/lvs.cf

serial_no = 17

primary = 192.168.10.10

primary_private = 192.168.20.10

service = lvs

backup_active = 1

backup = 192.168.10.20

backup_private = 192.168.20.20

heartbeat = 1

heartbeat_port = 539

keepalive = 6

deadtime = 18

network = nat

nat_router = 192.168.20.254 eth1:0

nat_nmask = 255.255.255.0

debug_level = NONE

monitor_links = 0

syncdaemon = 0

virtual http {

     active = 1

     address = 192.168.10.254 eth0:1

     vip_nmask = 255.255.255.0

     port = 80

     send = "GET / HTTP/1.0\r\n\r\n"

     expect = "HTTP"

     use_regex = 0

     load_monitor = none

     scheduler = rr

     protocol = tcp

     timeout = 6

     reentry = 15

     quiesce_server = 0

     server rs01 {

         address = 192.168.20.100

         active = 1

         weight = 1

     }

     server rs02 {

         address = 192.168.20.200

         active = 1

         weight = 2

     }

}

 

 

5.8 在lvs01,lvs02 上启动负载均衡的监控进程

[root@lvs01 ~]# /etc/init.d/pulse restart

Shutting down pulse:                                       [失败]

Starting pulse:                                            [确定]

[root@lvs01 ~]# chkconfig pulse on

[root@lvs02 ~]# /etc/init.d/pulse restart

Shutting down pulse:                                       [失败]

Starting pulse:                                            [确定]

[root@lvs02 ~]# chkconfig pulse on

 

5.9 查看lvs的正常运行状态

 

lvs-nat 模式-piranha

 

6、  测试

6.1 访问vip,web的内容是后台两台真实服务器网页内容,轮替提供服务

lvs-nat 模式-piranha

 

6.2 lvs01失效的情况下服务依然可用(我直接把lvs01关机了)

[root@lvs02 ~]# elinks -dump

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

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