Hot Standby Keepalived

1.1.Keepalived initially for a powerful auxiliary tool designed for LVS, mainly used to provide failover and health checks - LVS load balancer determine availability server nodes, timely isolation and replaced with a new server, when the fault plane after its recovery rejoin the cluster.
The hot standby mode 1.keepalived

  • keepalived using VRRP (Virtual Router Redundancy Protocol Virtual Router Redundancy Protocol) protocol hot backup software means to achieve multi-function Liunx hot standby server.
  • Each router in the hot standby group can become the master router, the IP address of the virtual router (VIP) can be transferred between routers in the hot standby group, so it became drift IP address.

2.keepalived installation and service control

*  安装keepalived
[root@localhost ~]# rm -rf /etc/yum.repos.d/*
[root@localhost ~]# vim /etc/yum.repos.d/a.repo
[root@localhost ~]# mount /dev/cdrom  /media/
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost ~]# yum -y install  keepalived ipvsadm
已加载插件:fastestmirror, langpacks
A                                                               | 3.6 kB  00:00:00     
(1/2): A/group_gz                                               | 155 kB  00:00:00     
(2/2): A/primary_db                                             | 3.0 MB  00:00:00     
Loading mirror speeds from cached hostfile
正在解决依赖关系
  • Keepalived control service
    after yum install keepalived, execute the following command keepalived service to boot.
    [root@localhost ~]# systemctl enable keepalived.service 
    Created symlink from /etc/systemd/system/multi-user.target.wants/keepalived.service to /usr/lib/systemd/system/keepalived.service.

1.2. Keepalived achieved using hot standby
Hot Standby Keepalived

1) configuration of the master server
[root@localhost ~]# vim /etc/keepalived/keepalived.conf
Hot Standby Keepalived
to confirm the above-described configuration is correct, then the service start keepalived. MASTER actual status of the primary server will automatically add ens33 interfaces VIP address, you can check the ip command.
Hot Standby Keepalived

2) configured standby server
in the same group keepalived hot spare, all servers keepalived profile substantially the same, including the ID number, authentication information, address drift, heart rate and other virtual routers. The main difference is that the name of the router, hot standby status, priority.
Hot Standby Keepalived
After confirmation as keepalived need to start the service. At this time, the main online server of any course, any natural VIP address actually controlled by the main server, another server in the standby state, and therefore does not add VIP addresses ens33 the interface in the backup server.

Guess you like

Origin blog.51cto.com/14306186/2438952