标签:col get ip绑定 文件 target fine 切换 app 压缩
Keepalived是HA cluster的一种实现方案,其以vrrp协议(Virtual Router Redundancy Protocol,即虚拟路由冗余协议)为实现基础,在N台具有相同功能的路由器或服务器中选出一个master或多个backup,这些路由器或服务器会共用一个对外提供服务的VIP。在此HA cluster集群中,master主机会发送组播来跟backup主机进行通信确认双方是否存活。当backup主机在指定的时间内没有收到vrrp组播报文则认为master主机宕机了,此时就会在所有的backup主机中根据vrrp协议来选举出新的master主机来保证服务的高可用性。
1、域名指向,域名只能指向一个固定IP,如果该IP绑定的机器宕机了,那么这个域名便无法访问了;
2、数据库服务指向,应用是通过一个固定的IP连接到数据库,如果该IP宕机,也无法提供服务;
一般主要解决以上两个问题,即keepalived+lvs+nginx和keepalive+mysql等等
keepalived主要有三个模块,分别是ipvs wrapper、checkers和vrrp stack。
keepalived源码包下载地址:http://www.keepalived.org/download.html
说明文档:https://www.keepalived.org/LVS-NAT-Keepalived-HOWTO.html
安装环境
# yum install -y openssl-devel popt-devel curl gcc libnl3-devel net-snmp-devel libnfnetlink-devel
下载安装包,主机备机都要安装
wget https://www.keepalived.org/software/keepalived-2.0.0.tar.gz
解压缩、编译、安装,过程中提示缺什么库就安装什么库,然后再重新编译安装。
# tar -zxf keepalived-2.0.0.tar.gz # cd keepalived-2.0.0 # ./configure --prefix=/usr/local/keepalived # make && make install # echo $? 0 # # cp /usr/local/keepalived/sbin/keepalived /usr/sbin/ # cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/ # cp ./keepalived/etc/init.d/keepalived /etc/init.d/
# mkdir /etc/keepalived
# cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/
标签:col get ip绑定 文件 target fine 切换 app 压缩
原文地址:https://www.cnblogs.com/zwj-linux/p/11552364.html