其中是开许多resin ,例如:
resin77go-fuzhai.bat中开了四个httpd:
start E:\webtools\resin\httpd.exe -conf E:\webtools\resin\conf\resin77go-fuzhai.conf -server a
start E:\webtools\resin\httpd.exe -conf E:\webtools\resin\conf\resin77go-fuzhai.conf -server b
start E:\webtools\resin\httpd.exe -conf E:\webtools\resin\conf\resin77go-fuzhai.conf -server c
start E:\webtools\resin\httpd.exe -conf E:\webtools\resin\conf\resin77go-fuzhai.conf -server d
在resin77go-fuzhai.conf中
<cluster>
<srun server-id="a" host="127.0.0.1" port="6801"/>
<srun server-id="b" host="127.0.0.1" port="6802"/>
<srun server-id="c" host="127.0.0.1" port="6803"/>
<srun server-id="d" host="127.0.0.1" port="6804"/>
</cluster>
<host id='www.77go.cn'>
<document-directory>D:/77go</document-directory>
<!-- configures the root web-app -->
<web-app id='/'>
<!-- adds xsl to the search path -->
<class-loader>
<compiling-loader path='WEB-INF/classes'/>
<library-loader path='WEB-INF/lib'/>
</class-loader>
</web-app>
</host>
LoadModule caucho_module "E:/webtools/resin/win32/apache-2.0/mod_caucho.dll"
<IfModule mod_caucho.c>
# ResinConfigServer localhost 6811
# CauchoStatus yes
# </IfModule>
# <IfModule mod_caucho.c>
# ResinConfigServer localhost 6812
# CauchoStatus yes
# </IfModule>
# <IfModule mod_caucho.c>
# ResinConfigServer localhost 6813
# CauchoStatus yes
# </IfModule>
# <IfModule mod_caucho.c>
# ResinConfigServer localhost 6814
# CauchoStatus yes
# </IfModule>
#<VirtualHost *:80>
# DocumentRoot D:/77go
# ServerName www.77go.cn
# DirectoryIndex index.jsp index.htm index.html
# Options FollowSymLinks
# ErrorLog D:/77go/logs/www.77go.cn-error_log
# CustomLog D:/77go/logs/access_www.77go.cn.log common
# CustomLog "|bin/cronolog.exe E:/77go_log/%y/%m/%d/access_www.77go.cn.log" combined env=!img-request
# ErrorLog "|bin/cronolog.exe E:/77go_log/%y/%m/%d/error_www.77go.cn.log"
#</VirtualHost>
下面是网上的一篇相关配置:
配置resin负载均衡
下面就简单列出如何配置load balance,以resin 3为例:
配置apache:
假设我开4个cluster,ip分别是10.10.22.1、10.10.22.2、10.10.22.3、10.10.22.4。网卡设置好。在apache的配置文件httpd.conf的最后有3句话:
LoadModule caucho_module /usr/local/apache-mysql/libexec/mod_caucho.so
ResinConfigServer localhost 6802
CauchoStatus yes
只需将第二句改成:
ResinConfigServer 10.10.22.1 6802
ResinConfigServer 10.10.22.2 6802
ResinConfigServer 10.10.22.3 6802
ResinConfigServer 10.10.22.4 6802
resin的配置:
<!-- <http port='80'/> -->
<cluster>
<srun server-id="a" host="10.10.22.1" port="6802" index="1"/> <srun server-id="b" host="10.10.22.2" port="6802" index="2"/> <srun server-id="c" host="10.10.22.3" port="6802" index="3"/> <srun server-id="d" host="10.10.22.4" port="6802" index="4"/> </cluster>
其他根据自己需求配置!
6. 启动resin和apache:由于使用负载均衡技术,因此启动也不单单是起一个http.sh了。可以写一个脚本:
#!/bin/bash
/usr/local/apache/bin/apachectl start
/usr/local/resin/bin/httpd.sh -pid /usr/local/resin/srun1.pid -server a start
/usr/local/resin/bin/httpd.sh -pid /usr/local/resin/srun2.pid -server b start
/usr/local/resin/bin/httpd.sh -pid /usr/local/resin/srun3.pid -server c start
/usr/local/resin/bin/httpd.sh -pid /usr/local/resin/srun4.pid -server d start
对于resin的负载均衡使用上启动的进程数,我认为还是要根据自己的机器实际情况来考虑的。少了达不到效果,多了会机器系统也是一个负载。个人认为,4个可以作为一个默认的选择来考虑。
resin77go-fuzhai.bat中开了四个httpd:
start E:\webtools\resin\httpd.exe -conf E:\webtools\resin\conf\resin77go-fuzhai.conf -server a
start E:\webtools\resin\httpd.exe -conf E:\webtools\resin\conf\resin77go-fuzhai.conf -server b
start E:\webtools\resin\httpd.exe -conf E:\webtools\resin\conf\resin77go-fuzhai.conf -server c
start E:\webtools\resin\httpd.exe -conf E:\webtools\resin\conf\resin77go-fuzhai.conf -server d
在resin77go-fuzhai.conf中
<cluster>
<srun server-id="a" host="127.0.0.1" port="6801"/>
<srun server-id="b" host="127.0.0.1" port="6802"/>
<srun server-id="c" host="127.0.0.1" port="6803"/>
<srun server-id="d" host="127.0.0.1" port="6804"/>
</cluster>
<host id='www.77go.cn'>
<document-directory>D:/77go</document-directory>
<!-- configures the root web-app -->
<web-app id='/'>
<!-- adds xsl to the search path -->
<class-loader>
<compiling-loader path='WEB-INF/classes'/>
<library-loader path='WEB-INF/lib'/>
</class-loader>
</web-app>
</host>
LoadModule caucho_module "E:/webtools/resin/win32/apache-2.0/mod_caucho.dll"
<IfModule mod_caucho.c>
# ResinConfigServer localhost 6811
# CauchoStatus yes
# </IfModule>
# <IfModule mod_caucho.c>
# ResinConfigServer localhost 6812
# CauchoStatus yes
# </IfModule>
# <IfModule mod_caucho.c>
# ResinConfigServer localhost 6813
# CauchoStatus yes
# </IfModule>
# <IfModule mod_caucho.c>
# ResinConfigServer localhost 6814
# CauchoStatus yes
# </IfModule>
#<VirtualHost *:80>
# DocumentRoot D:/77go
# ServerName www.77go.cn
# DirectoryIndex index.jsp index.htm index.html
# Options FollowSymLinks
# ErrorLog D:/77go/logs/www.77go.cn-error_log
# CustomLog D:/77go/logs/access_www.77go.cn.log common
# CustomLog "|bin/cronolog.exe E:/77go_log/%y/%m/%d/access_www.77go.cn.log" combined env=!img-request
# ErrorLog "|bin/cronolog.exe E:/77go_log/%y/%m/%d/error_www.77go.cn.log"
#</VirtualHost>
下面是网上的一篇相关配置:
配置resin负载均衡
下面就简单列出如何配置load balance,以resin 3为例:
配置apache:
假设我开4个cluster,ip分别是10.10.22.1、10.10.22.2、10.10.22.3、10.10.22.4。网卡设置好。在apache的配置文件httpd.conf的最后有3句话:
LoadModule caucho_module /usr/local/apache-mysql/libexec/mod_caucho.so
ResinConfigServer localhost 6802
CauchoStatus yes
只需将第二句改成:
ResinConfigServer 10.10.22.1 6802
ResinConfigServer 10.10.22.2 6802
ResinConfigServer 10.10.22.3 6802
ResinConfigServer 10.10.22.4 6802
resin的配置:
<!-- <http port='80'/> -->
<cluster>
<srun server-id="a" host="10.10.22.1" port="6802" index="1"/> <srun server-id="b" host="10.10.22.2" port="6802" index="2"/> <srun server-id="c" host="10.10.22.3" port="6802" index="3"/> <srun server-id="d" host="10.10.22.4" port="6802" index="4"/> </cluster>
其他根据自己需求配置!
6. 启动resin和apache:由于使用负载均衡技术,因此启动也不单单是起一个http.sh了。可以写一个脚本:
#!/bin/bash
/usr/local/apache/bin/apachectl start
/usr/local/resin/bin/httpd.sh -pid /usr/local/resin/srun1.pid -server a start
/usr/local/resin/bin/httpd.sh -pid /usr/local/resin/srun2.pid -server b start
/usr/local/resin/bin/httpd.sh -pid /usr/local/resin/srun3.pid -server c start
/usr/local/resin/bin/httpd.sh -pid /usr/local/resin/srun4.pid -server d start
对于resin的负载均衡使用上启动的进程数,我认为还是要根据自己的机器实际情况来考虑的。少了达不到效果,多了会机器系统也是一个负载。个人认为,4个可以作为一个默认的选择来考虑。