You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[root@c43bfab6f744 ~] vi /etc/sysconfig/iptables
#添加下面端口
-A INPUT -m state --state NEW -m tcp -p tcp --dport 112 -j ACCEPT
[root@c43bfab6f744 ~] service iptables restart
Keepalived 默认使用的端口是:112, 需要开启防火墙的端口
步骤5: 配置开机自启动
[root@localhost ~]# vi /etc/rc.d/rc.local
#在末尾添加
/etc/init.d/keepalived restart
操作系统:centos 6
服务器两台:A、B
目的:A、B 上都安装Nginx, 想要使用 keepalived 做HA
下面是具体的步骤:
步骤1: 安装Keepalived
步骤2: 配置Keepalived
1. 查看网络信息:本机IP、网卡名字
现在的网络情况:
A服务器:
B服务器:
虚拟IP: 只要配置好Keepalived,启动后,就会自动在当前网卡上创建一个虚拟IP
2. 配置Keepalived
原理是:
A、B 服务器在Keepalived上配置同一个虚拟IP:
10.177.101.117
, 分别启动两台服务器的 keepalived时,会自动在对应的网卡上创建同一个虚拟IP。Keepalived 会创建路由表,根据A、B服务器的级别、权重,进行请求转发;
按照下面配置两台机器:
A机器的配置:
B机器的配置:
配置完成后,两台都重启 keepalived:
完成启动后,看下A、B服务器的网络信息如下:
步骤4: 配置防火墙
Keepalived 默认使用的端口是:112, 需要开启防火墙的端口
Keepalived 默认使用的端口是:112, 需要开启防火墙的端口
步骤5: 配置开机自启动
链接
The text was updated successfully, but these errors were encountered: