找回密码
 注册
搜索
热搜: 回贴
微赢网络技术论坛 门户 服务器 Linux/BSD 查看内容

Centos Piranha安装过程

2009-12-20 13:41| 发布者: admin| 查看: 67| 评论: 0|原作者: 仙之剑缘

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


screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/75232_080919182909.jpg');}" onmousewheel="return imgzoom(this);" alt="" />


先安装好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,密码就是刚刚输入的。

screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/75232_080919184446.jpg');}" onmousewheel="return imgzoom(this);" alt="" />

进去后,看到以下界面:
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/75232_080919185328.jpg');}" onmousewheel="return imgzoom(this);" alt="" />


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

screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/75232_080919185542.jpg');}" onmousewheel="return imgzoom(this);" alt="" />
点击,redundancy,这里是配置lvs服务器的冗余,但lvs服务器坏了,就会造成服务中断,不能进行负载分配,为防止这种以外发生,配置好lvs的HA是很有必要的。截图如下:
Redundant server public ip:备用服务器的公网IP
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/75232_080919185718.jpg');}" onmousewheel="return imgzoom(this);" alt="" />

点击virtual servers,配置Virtual IP Address跟real server:
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/75232_080919185851.jpg');}" onmousewheel="return imgzoom(this);" alt="" />
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/75232_080919190028.jpg');}" onmousewheel="return imgzoom(this);" alt="" />

screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/75232_080919190145.jpg');}" onmousewheel="return imgzoom(this);" alt="" />
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/75232_080919190302.jpg');}" onmousewheel="return imgzoom(this);" alt="" />



然后将所有的配置激活。
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
成功后的截图如下:
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/75232_080919190851.jpg');}" onmousewheel="return imgzoom(this);" alt="" />

打开IE:
http://192.168.89.200
不断刷新,就会发现,有所变化,说明成功。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/75232_080919191045.jpg');}" onmousewheel="return imgzoom(this);" alt="" />






最新评论

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-30 11:36 , Processed in 0.275619 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

返回顶部