zyllf2009 发表于 2018-12-31 08:16:28

Linux的shell脚本LvsDR模式启动脚本和模拟keepalived高可用脚本

  一.脚本运行前模拟环境
  DR:server1:172.25.29.1 ipvsadmkeepalived

  RS:server2:172.25.29.2 arptables_jf   httpd

  RS:server3:172.25.29.3 arptables_jf   httpd

  DR:server4:172.25.29.4 ipvsadmkeepalived
  

  使用脚本前先安装好server1、server2、server3的软件,做好httpd的后端访问页面

  

  二.LVS_DR模式脚本介绍
  1.server1上运行LvsDR模式启动停止脚本:(提前安装好ipvsadm),后面可以在server4上运行
  自动添加ipvsadm策略
  自动添加VIP
  

  lvs_action.sh

https://s3.运维网.com/oss/201711/17/add5551388a180ec507d7e9c2e69a30e.png
https://s5.运维网.com/oss/201711/17/77f877063942933006d15b02e0e97d33.png
https://s5.运维网.com/oss/201711/17/35ec602a2e59dc341cf42bb67c52d276.png
  

  2.server2,server3运行arptables策略添加脚本:(提前安装好iptables_jf)
  

  lvs_Arp.sh
https://s3.运维网.com/oss/201711/17/0c1fad985176eae5541fda1af626d206.png
  

  三.模拟keepalived切换脚本
  1.在server1和server4运行模拟keepalived健康检查脚本
  

  lvs_check.sh

https://s2.运维网.com/oss/201711/17/f05f61be29f16990d1a9510986601c98.png
  

  2.在server1和server4运行模拟keepalived高可用切换脚本
  

  keepalived_lvs.sh

https://s2.运维网.com/oss/201711/17/5cf013b77da68242d385aab29bdd3bdc.png
  

  




页: [1]
查看完整版本: Linux的shell脚本LvsDR模式启动脚本和模拟keepalived高可用脚本