虚拟化容器,大数据,DBA,中间件,监控。

Centos Piranha安装过程

24 10月
作者:admin|分类:应用管理
Centos Piranha安装过程



随着计算机跟网络的发展,人们对网络的流量及计算机的处理能力,要求越来越高,在现今,单靠一台计算机处理,是达不到要求的。所以就出现集群、负载均衡等应用。
说到负载均衡,大家都知道LVS,值得我们高兴的是,这个软件是中国linux程序员章文嵩博士发起和领导的,其实现目标是创建一个具有良好的扩展性、高可靠性、高性能和高可用性的体系。在lvs的基础上,也出现了很多商业性的软件,比如RedHat的Piranha、Turbo Linux公司的Turbo Cluster等,都是基于LVS的核心代码的。
下面我介绍的就是RedHat的Piranha,其实centos跟redhat是一样的,不明白的可以到网上找一下说明,不在这里罗嗦。
随便说一下,lvs可以多达几千个点,目前,在实际应用中,好象有公司做到了2千多个点。
首先介绍我的环境:





先安装好apache应用程序

一、    需要的软件包
操作系统:RedHat AS51、ipvsadm-1.24-8.1.i386.rpm2、modcluster-0.8-27.el5.i386.rpm
3、piranha-0.8.4-7.el5.i386.rpm
4、system-config-cluster-1.0.39-1.0.noarch.rpm
5、php-5.1.6-5.el5.i386.rpm
6、php-cli-5.1.6-5.el5.i386.rpm
7、php-common-5.1.6-5.el5.i386.rpm
二、用yum进行安装
yum install ipvsadm modcluster piranha system-config-cluster php php-cli php-common
安装完成后,会生成最主要的几个文件分别是:/etc/sysconfig/ha/lvs.cf,/etc/init.d/piranha-gui,/etc/init.d/pulse
三、启动/etc/init.d/piranha-gui start
若遇到以下错误提示:
Starting piranha-gui: (13)Permission denied: make_sock: could not bind to address [::]:3636
关闭掉selinux跟firewall
四、启动转发
vi /etc/sysctl.conf
net.ipv4.ip_forward = 0
将 0 改成 1
net.ipv4.ip_forward = 1
执行如下命令来应用:
sysctl –p
五、在命令行里输入piranha-passwd然后输入密码。
配置LVS主要是通过http的方式,地址如下:
http://192.168.89.132:3636
。点击登陆,用户名piranha,密码就是刚刚输入的。

Click here to open new windowCTRL+Mouse wheel to zoom in/out


进去后,看到以下界面:

Click here to open new windowCTRL+Mouse wheel to zoom in/out


点击global settings,如下:

Primary server public ip:输入你公网IP。
Primary server private ip:输入私网IP,可以不输入。
然后选择网络模式:NAT、DR、Tunneling。我这里选择是DR模式。

Click here to open new windowCTRL+Mouse wheel to zoom in/out

点击,redundancy,这里是配置lvs服务器的冗余,但lvs服务器坏了,就会造成服务中断,不能进行负载分配,为防止这种以外发生,配置好lvs的HA是很有必要的。截图如下:
Redundant server public ip:备用服务器的公网IP
Click here to open new windowCTRL+Mouse wheel to zoom in/out

点击virtual servers,配置Virtual IP Address跟real server:

Click here to open new windowCTRL+Mouse wheel to zoom in/out
Click here to open new windowCTRL+Mouse wheel to zoom in/out

Click here to open new windowCTRL+Mouse wheel to zoom in/out

Click here to open new windowCTRL+Mouse wheel to zoom in/out



然后将所有的配置激活。

scp /etc/sysconfig/ha/lvs.cf
[email=root@192.168.89.132:/etc/sysconfig/ha/]root@192.168.89.132:/etc/sysconfig/ha/[/email]
备注:先将一台通过web方式配置好,然后测试,通过后,拷贝到另外一抬机器。另外一台机器的安装方法一样。
六、Real Server的配置,只需要在命令行设置IPTABLES就可以了。如下:
iptables -A PREROUTING -t nat -p tcp -d 192.168.89.200 --dport 80 -j REDIRECT
service iptables save  //保存
七、设置LVS相关服务自启动
chkconfig --level 345 piranha-gui on
chkconfig --level 345 pulse on
/etc/init.d/piranha-gui start
/etc/init.d/pulse start
成功后的截图如下:
Click here to open new windowCTRL+Mouse wheel to zoom in/out

打开IE:

http://192.168.89.200
不断刷新,就会发现,有所变化,说明成功。

浏览2083 评论0
返回
目录
返回
首页
heartbeat V2在CentOS4.6上简要安装、配置笔记 Linux-HA 入门指南