日期:2014-05-16  浏览次数:20754 次

apache + tomcat 负载均衡worker模式初探

前段时间有做过一次apache+tomcat的集群,为防止年久忘记,特存在这里 也与想做此集群的人分享!

?

背景:做一个软件的下载界面,而下载版本是可以在线更新和下载人数统计的,所以没有用静态页面,由于带宽问题特用两台服务器下载,一台作为请求转发。基本结果就是 1 apache ?+ 2 tomcat。直接通过apache的IP或者域名访问。

?

具体实现如下:

?

?

描叙:

???????? 此负载均衡通过apache+tomcat的方式安装在linux环境中。

???????? 系统:suse11 64bit

???????? 安装前系统的准备:安装make,安装gcc,安装glibc (都安装suse11系统盘里面的rpm)

(环境假设:A安装apacheB安装tomcatC安装tomcat

?

<!--[if !supportLists]-->一、<!--[endif]-->安装apacheserver

<!--[if !supportLists]-->a)???????? <!--[endif]-->检查是否安装gcc gcc –v?? (查看gcc版本)

<!--[if !supportLists]-->b)???????? <!--[endif]-->检查glibc版本 rpm -qa | grep glibc

<!--[if !supportLists]-->c)???????? <!--[endif]-->前两项通过之后,解压httpd-2.2.17.tar包,命令:tar –xvf httpd-2.2.17.tar

<!--[if !supportLists]-->d)???????? <!--[endif]-->解压之后,进入httpd-2.2.17目录,运行命令:./configure --prefix=/var/local/apache2 --enable-so --with-mpm=worker

<!--[if !supportLists]-->e)???????? <!--[endif]-->编译make

<!--[if !supportLists]-->f)????????? <!--[endif]-->安装make install

<!--[if !supportLists]-->g)???????? <!--[endif]-->进入/usr/local/apache/bin目录,运行:? ./apachectl -k start?? 启动,打开IE,输入http://此服务器的ip地址? 如果出现“It works 表示启动成功!

<!--[if !supportLists]-->h)???????? <!--[endif]-->停止:./apachectl –k stop

<!--[if !supportLists]-->i)?????????? <!--[endif]-->安装完之后,各命令:

.启动和停止

bin目录下

启动