Piranha LVS DR 模式 HA 集群配置

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


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

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      


这里写图片描述

这里写图片描述

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值