Keepalived+Nginx高可用架构配置

时间:2023-11-22 15:46:02

1.yum install -y libnfnetlink-devel
2.yum -y install libnl libnl-devel
3.yum -y install openssl-devel

./configure --prefix=/usr/local/keepalived
make&make install

# cp ./keepalived-1.3.4/keepalived/etc/init.d/keepalived /etc/init.d/
# cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/
# cp ./keepalived-1.3.4/keepalived/etc/sysconfig/keepalived /etc/sysconfig/keepalived

#keepalived的快捷启动,必须要执行以上三步,且文件路径必须一致,也不知道什么原因,
# 可能是init.d中的keepalived中已经指明了吧

执行service keepalived [start | stop | reload | restart ]

添加
firewall-cmd --zone=public --add-port=80/tcp --permanent (--permanent永久生效,没有此参数重启后失效)
重新载入
firewall-cmd --reload
查看
firewall-cmd --zone= public --query-port=80/tcp
删除
firewall-cmd --zone= public --remove-port=80/tcp --permanent

-- root登陆 linux