慕课学习记录_keepalived 安装记录
1.解压 tar -zxvf keepalived-2.0.18.tar.gz
2.进入到keepalived解压文件目录
./configure --prefix=/usr/local/keepalived --sysconf=/etc
prefix:keepalived安装的位置
sysconf:keepalived核心配置文件所在位置,固定位置,改成其他位置则keepalived启动不了,/var/log/messages中会报错
3.提示错误信息
*** WARNING - this build will not support IPVS with IPv6. Please install libnl/libnl-3 dev libraries to support IPv6 with IPVS.
yum -y install libnl libnl-devel
执行后再次执行 ./configure --prefix=/usr/local/keepalived --sysconf=/etc
4.make && make install
5.进入到/etc/keepalived
,该目录下为keepalived核心配置文件
通过命令 vim keepalived.conf
打开配置文件
启动服务
ps -ef|grep keepalived
查看端口是否启动 ip addr
6.将服务注册到系统中
在解压的目录中/home/software/keepalived-2.0.18/keepalived/etc 中 将两个配置文件拷贝到 /etc/ 目录中
cp init.d/keepalived /etc/init.d/
cp sysconfig/keepalived /etc/sysconfig/
7.系统重启注册服务
systemctl daemon-reload
systemctl stop / start / restart keepalived.service
8.Centos7 keepalived 防火墙设置
firewall-cmd --direct --permanent --add-rule ipv4 filter INPUT 0 --destination 224.0.0.18 --protocol vrrp -j ACCEPT
firewall-cmd --direct --permanent --add-rule ipv4 filter OUTPUT 0 --destination 224.0.0.18 --protocol vrrp -j ACCEPT
firewall-cmd --reload