阿里云高可用虚拟IP部署方案



1. 高可用虚拟IP-下创建虚拟内网IP

绑写Ecs实例-(需要绑定多台Ecs实例) 注:只支持同一可用区下机器
说明:https://help.aliyun.com/document_detail/110065.html?spm=5176.11182183.help.dexternal.6f7a4882cJ2QcJ



  • 或者绑定弹性网卡

2. 在实例上启动keepalive

配置虚拟IP,可用docker启动

#主keepalive.cfg
global_defs {
  default_interface eth0
}

vrrp_instance VI_1 {
  interface eth0

  state MASTER
  virtual_router_id 51
  priority 200
  nopreempt

  #unicast_src_ip 172.16.121.191
  unicast_peer {  
    172.16.121.190
  }

  virtual_ipaddress { 
    172.16.121.192
  }

  authentication { 
    auth_type PASS
    auth_pass lren.org
  }

  #notify "/container/service/keepalived/assets/notify.sh"
}

#从keepalive.cfg
global_defs {
  default_interface eth0
}

vrrp_instance VI_1 {
  interface eth0

  state BACKUP
  virtual_router_id 51
  priority 150
  nopreempt

  #unicast_src_ip 172.16.121.190
  unicast_peer {  
    172.16.121.191
  }

  virtual_ipaddress { 
    172.16.121.192
  }

  authentication { 
    auth_type PASS
    auth_pass lren.org
  }

  #notify "/container/service/keepalived/assets/notify.sh"
}