您的位置:首页 > 其它

Piranha LVS DR 模式 HA 集群配置

2016-10-10 10:32 597 查看
Piranha 是 Redhat 提供的一个基于 Web 进行 LVS 集群及 HA 配置管理软件,可以省去手工配置 LVS 的繁琐工作.



一、 配置 Real Server 节点

RS 1 :  172.30.2.155

RS 2 :  172.30.2.156

两个RS节点配置好lnmp集群后做以下操作

1、 调整内核参数解决 ARP 响应问题

[root@web1 ~]# echo "net.ipv4.conf.all.arp_ignore = 1" >> /etc/sysctl.conf
[root@web1 ~]# echo "net.ipv4.conf.all.arp_announce = 2" >> /etc/sysctl.conf
[root@web1 ~]# sysctl  -p




2、 添加 lo:1 网卡配置

[root@web1 ~]# vim /etc/sysconfig/network-scripts/ifcfg-lo:1
DEVICE=lo:1
ONBOOT=yes
BOOTPROTO=static
IPADDR=172.30.2.22
NETMASK=255.255.255.255




3、 重启网络 lo:1 绑定VIP

[root@web1 ~]# /etc/init.d/network restart
[root@web1 ~]# ifconfig lo:1
lo:1      Link encap:Local Loopback
inet addr:172.30.2.22  Mask:255.255.255.255
UP LOOPBACK RUNNING  MTU:16436  Metric:1




二、 配置调度器节点

主调度器:  172.30.2.155

备调度器:  172.30.2.156

两个调度节点都做以下操作

1、 关闭 Selinux 及 iptables

# 临时修改,立即生效
[root@lvs ~]# setenforce 0

# 永久修改,需要重启
[root@lvs ~]# vim /etc/sysconfig/selinux
SELINUX=disabled

[root@lvs ~]# /etc/init.d/iptables stop




2、 修改内核参数开启路由转发

[root@lvs ~]# sed -i 's/net.ipv4.ip_forward\ =\ 0/net.ipv4.ip_forward\ =\ 1/' /etc/sysctl.conf
[root@lvs ~]# sysctl -p




3、安装 piranha 及 ipvsadm

[root@lvs ~]# yum install piranha -y
[root@lvs ~]# chkconfig pulse on




4、主节点配置 Prianha Web

# 设置 web 登陆密码
[root@lvs ~]# piranha-passwd
New Password:
Verify:
Adding password for user piranha

# 启动 piranha-gui
[root@lvs ~]# /etc/init.d/piranha-gui start




5、通过 web 界面配置 LVS

http://192.168.2.11:3636/login 登陆配置集群

配置图文详解



6、复制配置文件到备用节点

# 拷贝主节点lvs配置文件
[root@lvs ~]# scp /etc/sysconfig/ha/lvs.cf 172.30.2.12:/etc/sysconfig/ha/




7、启动LVS服务(先主后从)

[root@lvs ~]# /etc/init.d/pulse start
Starting pulse:                                            [确定]




8、访问及查看 LVS 转

[root@lvs ~]# ipvsadm -ln
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port           Forward Weight ActiveConn InActConn
TCP  172.30.2.22:80 wlc persistent 360
-> 172.30.2.155:80              Route   1      0          0
-> 172.30.2.156:80              Route   1      0          0
TCP  172.30.2.22:443 wlc persistent 360
-> 172.30.2.155:443             Route   1      0          0
-> 172.30.2.156:443             Route   1      1          0






内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息