- 浏览: 786245 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (573)
- Java基础 (76)
- C++基础 (5)
- hibernate (5)
- struts (4)
- spring (1)
- webservice (7)
- AjaX基础 (0)
- JS脚本 (53)
- 正则表达式 (5)
- html脚本 (30)
- 数据库基础 (54)
- 工作相关 (49)
- 其他 (30)
- Linux (9)
- web服务器 (17)
- JSP (13)
- eclipse (6)
- 面试题相关 (20)
- XML (3)
- Apache common (2)
- 生活 (35)
- VMware (1)
- log4j (9)
- BeanUtils (2)
- 设计模式 (3)
- UML (1)
- UNIX (1)
- ibats (5)
- GT-Grid (17)
- ABAP学习 (17)
- ABAP (35)
- ABAP--ALV (11)
- ABAP--WEBDIMPRO (0)
- abap-sample (1)
- BEMS (2)
- flex (33)
- GIS技术 (3)
最新评论
一、环境搭建:
* 准备机器两台:192.168.0.2、192.168.0.3
* 下载apache2.2.9,地址:http://httpd.apache.org/download.cgi ,安装在192.168.0.2的D:\Apache
* 下载apache-tomcat-5.5.26.zip,地址:http://tomcat.apache.org/download-55.cgi ,分别解压到192.168.0.2、192.168.0.3的D:\Tomcat5.5
* 下载mod_jk,在这里找:http://tomcat.apache.org/download-connectors.cgi ,或者直接下载:http://dev.xiaonei.com/apache-mirror/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.26/mod_jk-1.2.26-httpd-2.2.4.so ,拷贝到D:\Apache\modules改名为:mod_jk
二、集群,负载配置:
* 修改D:\Apache\conf\httpd.conf,
修改前:
Java代码
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
修改后:
Java代码
#Listen 12.34.56.78:80
#Listen 80
Listen 192.168.0.2:80
#引入配置文件
Include conf/http-vhosts.conf
Include conf/mod_jk.conf
# add compress start
LoadModule headers_module modules/mod_headers.so
LoadModule deflate_module modules/mod_deflate.so
# add compress end
#
# Dynamic Shared Object (DSO) Support
#Listen 12.34.56.78:80
#Listen 80
Listen 192.168.0.2:80
#引入配置文件
Include conf/http-vhosts.conf
Include conf/mod_jk.conf
# add compress start
LoadModule headers_module modules/mod_headers.so
LoadModule deflate_module modules/mod_deflate.so
# add compress end
#
# Dynamic Shared Object (DSO) Support
* 在conf下面新建http-vhosts.conf内容如下:
Java代码
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin admin@yoursite.com
DocumentRoot "e:/site/apache/www.yoursite.com"
ServerName yoursite.com
ServerAlias www.yoursite.com
ErrorLog "logs/www.yoursite.com-error.log"
CustomLog "logs/www.yoursite.com-access.log" common
# add compress start
<Location "/">
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
Header append Vary User-Agent env=!dont-vary
</Location>
# add compress end
<Directory "e:/site/apache/www.yoursite.com">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin admin@yoursite.com
DocumentRoot "e:/site/apache/www.yoursite.com"
ServerName yoursite.com
ServerAlias www.yoursite.com
ErrorLog "logs/www.yoursite.com-error.log"
CustomLog "logs/www.yoursite.com-access.log" common
# add compress start
<Location "/">
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
Header append Vary User-Agent env=!dont-vary
</Location>
# add compress end
<Directory "e:/site/apache/www.yoursite.com">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
* 在conf下新建文件mod_jk.conf,内容如下:
Java代码
# Load mod_jk module
LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile conf/workers.properties
# Where to put jk shared memory
JkShmFile logs/httpd/mod_jk.shm
# Where to put jk logs
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T %R"
# All requests go to Tomcat by default
JkMount /* www
# Serve html, jpg and gif etc using Apache
JkUnMount /*.css www
JkUnMount /*.js www
JkUnMount /*.gif www
JkUnMount /*.jpg www
JkUnMount /*.htm www
JkUnMount /*.swf www
JkUnMount /*.xml www
JkUnMount /*.ico www
# png and flv mount to tomcat
#JkUnMount /*.png www
#JkUnMount /*.flv www
# Load mod_jk module
LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile conf/workers.properties
# Where to put jk shared memory
JkShmFile logs/httpd/mod_jk.shm
# Where to put jk logs
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T %R"
# All requests go to Tomcat by default
JkMount /* www
# Serve html, jpg and gif etc using Apache
JkUnMount /*.css www
JkUnMount /*.js www
JkUnMount /*.gif www
JkUnMount /*.jpg www
JkUnMount /*.htm www
JkUnMount /*.swf www
JkUnMount /*.xml www
JkUnMount /*.ico www
# png and flv mount to tomcat
#JkUnMount /*.png www
#JkUnMount /*.flv www
* 在conf下新建文件workers.properties,内容如下:
Java代码
#
# workers.properties
#
# list the workers by name
worker.list=www
worker.maintain=60
# =============================================================================
# ------------------------
# www1 server 0.2
# ------------------------
worker.www1.port=8009
worker.www1.host=192.168.0.2
worker.www1.type=ajp13
worker.www1.socket_timeout=0
worker.www1.socket_keepalive=true
worker.www1.lbfactor=10
# Define preferred failover node for worker1
#worker.www1.redirect=www2
# ------------------------
# www2 server 0.2
# ------------------------
worker.www2.port=9009
worker.www2.host=192.168.0.2
worker.www2.type=ajp13
worker.www2.socket_timeout=0
worker.www2.socket_keepalive=true
worker.www2.lbfactor=10
#Disable worker2 for all requests except failover
#worker.worker2.activation=disabled
# ------------------------
# Load Balancer worker
# ------------------------
worker.www.type=lb
#worker.www.balance_workers=www2
worker.www.balance_workers=www1,www2
worker.www.sticky_session=true
#worker.www.method=Traffic
# ----------------------
#
#-----------------------
# Add the status worker to the worker list
#worker.list=jkstatus
# Define a 'jkstatus' worker using status
#worker.jkstatus.type=status
# Add the jkstatus mount point
#JkMount /jkmanager/* jkstatus
# ===========================================================================
#
# END workers.properties
#
#
# workers.properties
#
# list the workers by name
worker.list=www
worker.maintain=60
# =============================================================================
# ------------------------
# www1 server 0.2
# ------------------------
worker.www1.port=8009
worker.www1.host=192.168.0.2
worker.www1.type=ajp13
worker.www1.socket_timeout=0
worker.www1.socket_keepalive=true
worker.www1.lbfactor=10
# Define preferred failover node for worker1
#worker.www1.redirect=www2
# ------------------------
# www2 server 0.2
# ------------------------
worker.www2.port=9009
worker.www2.host=192.168.0.2
worker.www2.type=ajp13
worker.www2.socket_timeout=0
worker.www2.socket_keepalive=true
worker.www2.lbfactor=10
#Disable worker2 for all requests except failover
#worker.worker2.activation=disabled
# ------------------------
# Load Balancer worker
# ------------------------
worker.www.type=lb
#worker.www.balance_workers=www2
worker.www.balance_workers=www1,www2
worker.www.sticky_session=true
#worker.www.method=Traffic
# ----------------------
#
#-----------------------
# Add the status worker to the worker list
#worker.list=jkstatus
# Define a 'jkstatus' worker using status
#worker.jkstatus.type=status
# Add the jkstatus mount point
#JkMount /jkmanager/* jkstatus
# ===========================================================================
#
# END workers.properties
#
三、session复制:参见[Tomcat 5集群中的SESSION复制|Tomcat 5集群中的SESSION复制详解],方法如下:
* 在每个工程的web.xml中</web-app>前面加上一行:<distributable/>(不要忘记了)
* 在tomcat配置文件的conf下的server.xml中去掉注释,如下:
Java代码
<Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
managerClassName="org.apache.catalina.cluster.session.DeltaManager"
expireSessionsOnShutdown="false"
useDirtyFlag="true"
notifyListenersOnReplication="true">
<Membership
className="org.apache.catalina.cluster.mcast.McastService"
mcastAddr="228.0.0.4"
mcastPort="45564"
mcastFrequency="500"
mcastDropTime="3000"/>
<Receiver
className="org.apache.catalina.cluster.tcp.ReplicationListener"
tcpListenAddress="auto"
tcpListenPort="4002"
tcpSelectorTimeout="100"
tcpThreadCount="6"/>
<Sender
className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
replicationMode="pooled"
ackTimeout="15000"/>
<Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>
<Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
tempDir="/tmp/war-temp/"
deployDir="/tmp/war-deploy/"
watchDir="/tmp/war-listen/"
watchEnabled="false"/>
</Cluster>
<Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
managerClassName="org.apache.catalina.cluster.session.DeltaManager"
expireSessionsOnShutdown="false"
useDirtyFlag="true"
notifyListenersOnReplication="true">
<Membership
className="org.apache.catalina.cluster.mcast.McastService"
mcastAddr="228.0.0.4"
mcastPort="45564"
mcastFrequency="500"
mcastDropTime="3000"/>
<Receiver
className="org.apache.catalina.cluster.tcp.ReplicationListener"
tcpListenAddress="auto"
tcpListenPort="4002"
tcpSelectorTimeout="100"
tcpThreadCount="6"/>
<Sender
className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
replicationMode="pooled"
ackTimeout="15000"/>
<Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>
<Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
tempDir="/tmp/war-temp/"
deployDir="/tmp/war-deploy/"
watchDir="/tmp/war-listen/"
watchEnabled="false"/>
</Cluster>
* 下面是成功的正常的反应(关闭另一个tomcat,开始另一个tomcat):
现在你可是感受一下成果,session被复制到每个tomcat例程,即使例程当机,只要还剩下一个例程,用户就感觉不到任何异常。
* 准备机器两台:192.168.0.2、192.168.0.3
* 下载apache2.2.9,地址:http://httpd.apache.org/download.cgi ,安装在192.168.0.2的D:\Apache
* 下载apache-tomcat-5.5.26.zip,地址:http://tomcat.apache.org/download-55.cgi ,分别解压到192.168.0.2、192.168.0.3的D:\Tomcat5.5
* 下载mod_jk,在这里找:http://tomcat.apache.org/download-connectors.cgi ,或者直接下载:http://dev.xiaonei.com/apache-mirror/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.26/mod_jk-1.2.26-httpd-2.2.4.so ,拷贝到D:\Apache\modules改名为:mod_jk
二、集群,负载配置:
* 修改D:\Apache\conf\httpd.conf,
修改前:
Java代码
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
修改后:
Java代码
#Listen 12.34.56.78:80
#Listen 80
Listen 192.168.0.2:80
#引入配置文件
Include conf/http-vhosts.conf
Include conf/mod_jk.conf
# add compress start
LoadModule headers_module modules/mod_headers.so
LoadModule deflate_module modules/mod_deflate.so
# add compress end
#
# Dynamic Shared Object (DSO) Support
#Listen 12.34.56.78:80
#Listen 80
Listen 192.168.0.2:80
#引入配置文件
Include conf/http-vhosts.conf
Include conf/mod_jk.conf
# add compress start
LoadModule headers_module modules/mod_headers.so
LoadModule deflate_module modules/mod_deflate.so
# add compress end
#
# Dynamic Shared Object (DSO) Support
* 在conf下面新建http-vhosts.conf内容如下:
Java代码
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin admin@yoursite.com
DocumentRoot "e:/site/apache/www.yoursite.com"
ServerName yoursite.com
ServerAlias www.yoursite.com
ErrorLog "logs/www.yoursite.com-error.log"
CustomLog "logs/www.yoursite.com-access.log" common
# add compress start
<Location "/">
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
Header append Vary User-Agent env=!dont-vary
</Location>
# add compress end
<Directory "e:/site/apache/www.yoursite.com">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin admin@yoursite.com
DocumentRoot "e:/site/apache/www.yoursite.com"
ServerName yoursite.com
ServerAlias www.yoursite.com
ErrorLog "logs/www.yoursite.com-error.log"
CustomLog "logs/www.yoursite.com-access.log" common
# add compress start
<Location "/">
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
Header append Vary User-Agent env=!dont-vary
</Location>
# add compress end
<Directory "e:/site/apache/www.yoursite.com">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
* 在conf下新建文件mod_jk.conf,内容如下:
Java代码
# Load mod_jk module
LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile conf/workers.properties
# Where to put jk shared memory
JkShmFile logs/httpd/mod_jk.shm
# Where to put jk logs
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T %R"
# All requests go to Tomcat by default
JkMount /* www
# Serve html, jpg and gif etc using Apache
JkUnMount /*.css www
JkUnMount /*.js www
JkUnMount /*.gif www
JkUnMount /*.jpg www
JkUnMount /*.htm www
JkUnMount /*.swf www
JkUnMount /*.xml www
JkUnMount /*.ico www
# png and flv mount to tomcat
#JkUnMount /*.png www
#JkUnMount /*.flv www
# Load mod_jk module
LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile conf/workers.properties
# Where to put jk shared memory
JkShmFile logs/httpd/mod_jk.shm
# Where to put jk logs
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T %R"
# All requests go to Tomcat by default
JkMount /* www
# Serve html, jpg and gif etc using Apache
JkUnMount /*.css www
JkUnMount /*.js www
JkUnMount /*.gif www
JkUnMount /*.jpg www
JkUnMount /*.htm www
JkUnMount /*.swf www
JkUnMount /*.xml www
JkUnMount /*.ico www
# png and flv mount to tomcat
#JkUnMount /*.png www
#JkUnMount /*.flv www
* 在conf下新建文件workers.properties,内容如下:
Java代码
#
# workers.properties
#
# list the workers by name
worker.list=www
worker.maintain=60
# =============================================================================
# ------------------------
# www1 server 0.2
# ------------------------
worker.www1.port=8009
worker.www1.host=192.168.0.2
worker.www1.type=ajp13
worker.www1.socket_timeout=0
worker.www1.socket_keepalive=true
worker.www1.lbfactor=10
# Define preferred failover node for worker1
#worker.www1.redirect=www2
# ------------------------
# www2 server 0.2
# ------------------------
worker.www2.port=9009
worker.www2.host=192.168.0.2
worker.www2.type=ajp13
worker.www2.socket_timeout=0
worker.www2.socket_keepalive=true
worker.www2.lbfactor=10
#Disable worker2 for all requests except failover
#worker.worker2.activation=disabled
# ------------------------
# Load Balancer worker
# ------------------------
worker.www.type=lb
#worker.www.balance_workers=www2
worker.www.balance_workers=www1,www2
worker.www.sticky_session=true
#worker.www.method=Traffic
# ----------------------
#
#-----------------------
# Add the status worker to the worker list
#worker.list=jkstatus
# Define a 'jkstatus' worker using status
#worker.jkstatus.type=status
# Add the jkstatus mount point
#JkMount /jkmanager/* jkstatus
# ===========================================================================
#
# END workers.properties
#
#
# workers.properties
#
# list the workers by name
worker.list=www
worker.maintain=60
# =============================================================================
# ------------------------
# www1 server 0.2
# ------------------------
worker.www1.port=8009
worker.www1.host=192.168.0.2
worker.www1.type=ajp13
worker.www1.socket_timeout=0
worker.www1.socket_keepalive=true
worker.www1.lbfactor=10
# Define preferred failover node for worker1
#worker.www1.redirect=www2
# ------------------------
# www2 server 0.2
# ------------------------
worker.www2.port=9009
worker.www2.host=192.168.0.2
worker.www2.type=ajp13
worker.www2.socket_timeout=0
worker.www2.socket_keepalive=true
worker.www2.lbfactor=10
#Disable worker2 for all requests except failover
#worker.worker2.activation=disabled
# ------------------------
# Load Balancer worker
# ------------------------
worker.www.type=lb
#worker.www.balance_workers=www2
worker.www.balance_workers=www1,www2
worker.www.sticky_session=true
#worker.www.method=Traffic
# ----------------------
#
#-----------------------
# Add the status worker to the worker list
#worker.list=jkstatus
# Define a 'jkstatus' worker using status
#worker.jkstatus.type=status
# Add the jkstatus mount point
#JkMount /jkmanager/* jkstatus
# ===========================================================================
#
# END workers.properties
#
三、session复制:参见[Tomcat 5集群中的SESSION复制|Tomcat 5集群中的SESSION复制详解],方法如下:
* 在每个工程的web.xml中</web-app>前面加上一行:<distributable/>(不要忘记了)
* 在tomcat配置文件的conf下的server.xml中去掉注释,如下:
Java代码
<Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
managerClassName="org.apache.catalina.cluster.session.DeltaManager"
expireSessionsOnShutdown="false"
useDirtyFlag="true"
notifyListenersOnReplication="true">
<Membership
className="org.apache.catalina.cluster.mcast.McastService"
mcastAddr="228.0.0.4"
mcastPort="45564"
mcastFrequency="500"
mcastDropTime="3000"/>
<Receiver
className="org.apache.catalina.cluster.tcp.ReplicationListener"
tcpListenAddress="auto"
tcpListenPort="4002"
tcpSelectorTimeout="100"
tcpThreadCount="6"/>
<Sender
className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
replicationMode="pooled"
ackTimeout="15000"/>
<Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>
<Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
tempDir="/tmp/war-temp/"
deployDir="/tmp/war-deploy/"
watchDir="/tmp/war-listen/"
watchEnabled="false"/>
</Cluster>
<Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
managerClassName="org.apache.catalina.cluster.session.DeltaManager"
expireSessionsOnShutdown="false"
useDirtyFlag="true"
notifyListenersOnReplication="true">
<Membership
className="org.apache.catalina.cluster.mcast.McastService"
mcastAddr="228.0.0.4"
mcastPort="45564"
mcastFrequency="500"
mcastDropTime="3000"/>
<Receiver
className="org.apache.catalina.cluster.tcp.ReplicationListener"
tcpListenAddress="auto"
tcpListenPort="4002"
tcpSelectorTimeout="100"
tcpThreadCount="6"/>
<Sender
className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
replicationMode="pooled"
ackTimeout="15000"/>
<Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>
<Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
tempDir="/tmp/war-temp/"
deployDir="/tmp/war-deploy/"
watchDir="/tmp/war-listen/"
watchEnabled="false"/>
</Cluster>
* 下面是成功的正常的反应(关闭另一个tomcat,开始另一个tomcat):
现在你可是感受一下成果,session被复制到每个tomcat例程,即使例程当机,只要还剩下一个例程,用户就感觉不到任何异常。
发表评论
-
如何查看Tomcat版本信息
2012-01-19 11:03 1一般来说,在tomcat启动时就会有版本信息,如: 信息: ... -
如何查看Tomcat版本信息
2012-01-19 11:03 1159一般来说,在tomcat启动时就会有版本信息,如: 信息: ... -
tomcat 设置session失效时间
2011-12-06 09:20 1375tomcat在5.5以后,就没有自带admin项目了,如果要从 ... -
The content of element type "web-app" must match……问题之解决办法
2011-12-06 09:18 1653在flex整合java生成的web.xml中添加引用serve ... -
The content of element type "web-app" must match解决
2011-12-06 09:16 954The content of element type &qu ... -
java.io.EOFException解决
2010-05-28 15:54 2584IOException while loading persi ... -
Tomcat下中文的彻底解决
2009-12-18 17:15 857这些天开发一个项目,服务器是tomcat,****作系统是xp ... -
远程重新启动Tomcat
2009-11-12 15:50 1361jsp 代码如下:查看复制到剪切板打印 <%@ page ... -
linux下 JDK mysql tomcat的安装
2009-11-12 15:05 1217一、JDK 1. 下载并安装JDK: 下载地址 http:/ ... -
linux下tomcat集群配置
2009-11-12 15:04 1518Apache + Tomcat + Linux 集群和均衡负载 ... -
linux下tomcat服务的启动、关闭与错误跟踪
2009-11-12 15:01 2590linux下tomcat服务的启动、关闭与错误跟踪,远程连接到 ... -
Tomcat中部署Java Web应用程序
2009-11-12 11:22 988在Tomcat中部署Java Web应 ... -
非安装型的Tomcat如何注册成为服务
2009-11-12 11:17 748如果用win32 exe 会直接安装到系统服务的 如果是zi ... -
Tomcat6.0连接池配置
2009-11-12 11:12 1670Tomcat6.0连接池配置 1.配置tomcat下的con ... -
web.xml配置详解
2009-11-06 16:27 860<?xml version="1.0" ... -
Tomcat服务器
2009-10-20 14:14 824Tomcat服务器:Tomcat 是一个免费的开放源代码的 S ... -
如何指定tomcat中session过期时间
2009-10-14 15:52 1217如何指定tomcat中session过期时间 1. 在se ...
相关推荐
Apache+Tomcat+Linux集群和均衡负载(Session同步复制
【Apache+Tomcat 集群与负载均衡及Session...通过以上配置,Apache+Tomcat集群可以实现高效的负载均衡和高可用性,同时通过Session绑定确保用户会话的连续性。注意定期监控和优化集群性能,以应对不断变化的业务需求。
### Linux 下 Apache+Tomcat 基于集群负载均衡 Session 复制 #### 一、概述 在现代 Web 应用开发中,为了提高服务的可用性和响应速度,常常会采用集群技术。其中,Apache 和 Tomcat 组合是常用的方案之一。本篇...
Apache+Tomcat+JK 实现集群负载均衡是一种常见的Web服务器和应用服务器的部署方式,它能够提高系统的可用性和响应速度,实现服务的高并发处理。本文将详细介绍如何配置这一环境。 首先,我们需要准备以下软件: 1. ...
标题中的“在32位操作系统上配置apache+tomcat集群/负载均衡/session复制”涉及到的是在32位系统环境下,如何构建一个使用Apache HTTP Server作为前端负载均衡器,与多个Tomcat应用服务器协同工作的集群环境,并实现...
本文将详细介绍如何配置 Apache + Tomcat 集群,包括安装 Apache 和 Tomcat 服务器、配置 mod_jk 模块、配置 Apache 和 Tomcat 服务器、配置负载均衡控制器等。 一、安装 Apache 服务器 首先,需要安装 Apache ...
总之,“Windows+Nginx+Tomcat做负载均衡同时实现session共享Demo”是一个实践性强的教学资源,它涵盖了Web服务集群中的关键技术和最佳实践,对于学习和提升系统架构能力非常有帮助。通过深入理解和实践这个Demo,...
Apache和Tomcat的组合经常被用来搭建这样的架构,特别是在实现负载均衡和集群时。在这个场景中,session同步是一个核心问题,因为用户session数据的正确管理和共享是保持应用程序一致性和用户体验的关键。本文将深入...
在部署Apache+Tomcat集群时,还需考虑session复制或共享以保证会话一致性,以及监控和管理工具的使用,如Nagios、Zabbix等,以确保集群的稳定运行。同时,为了提高安全性,建议使用SSL/TLS进行加密传输,通过配置...
总结,实现Apache+Tomcat集群负载均衡的关键在于正确配置Apache的mod_proxy模块,以及确保Tomcat集群的会话一致性。通过这种方式,我们可以有效分摊高并发访问压力,提高系统的稳定性和响应速度。同时,持续监控和...
Apache 和 Tomcat 集群配合 Session 复制是一种常见的高可用性和负载均衡解决方案,尤其适用于大型网站和企业级应用。以下将详细解释这个方案的关键点。 **整体方案策略** 1. **部署逻辑图** 部署逻辑通常包括...
JK模块负责通信、负载均衡以及session复制。 1. **JK模块配置**:`mod_jk.so`的配置主要在Apache的httpd.conf或独立的workers.properties文件中进行。需要定义每个Tomcat实例的工作者(worker),包括它们的IP地址...
Apache+Tomcat的负载均衡配置就是为了解决这一问题。 负载均衡的基本思想是将来自用户的请求分发到多个后端服务器,这样可以避免任何单一服务器过载,同时提高整体服务的可靠性和响应时间。Apache通常通过其模块mod...
当我们谈论"Apache,tomcat负载均衡和session复制"时,这意味着我们要探讨如何在多台服务器之间分配负载,并确保用户会话的无缝迁移和一致性。 **负载均衡**是解决高并发、高可用性问题的重要策略。它通过将来自...
在实际应用中,Apache+Tomcat集群的配置可能更为复杂,需要考虑SSL支持、session复制、故障转移、健康检查等高级特性。此外,随着技术的发展,现代的负载均衡解决方案如Nginx、HAProxy等也可能替代Apache作为反向...
本文将详细介绍如何在Windows环境下,利用Nginx作为反向代理服务器,与Tomcat集群配合实现负载均衡,并进行session复制,确保用户会话在不同服务器之间的一致性。 首先,Nginx是一款轻量级、高性能的HTTP和反向代理...