Tomcat负载之session共享配置示例

1.开启本机组播

&">nbsp;命令:route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0

2.配置server.xml文档(/usr/local/conf/server.xml)

Eg:
<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
 -->
<Server port="8005" shutdown="SHUTDOWN">
         <!--多个tomcat时更改其关闭端口号-->
  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
  <Listener className="org.apache.catalina.core.JasperListener" />
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />

<!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

<!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container",
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   -->
  <Service name="Catalina">
 
    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="150" minSpareThreads="4"/>
    -->
   
   
    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL HTTP/1.1 Connector on port 8080
    -->
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
                  <!--多个tomcat时更改其端口号port=""-->

<!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    -->          
    <!-- Define a SSL HTTP/1.1 Connector on port 8443
         This connector uses the JSSE configuration, when using APR, the
         connector should be using the OpenSSL style configuration
         described in the APR documentation -->
    <!--
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />
    -->

时间: 2024-12-19 08:17:23

Tomcat负载之session共享配置示例的相关文章

各位大婶看看这是哪里出的问题啊,负载均衡session共享配置的问题

问题描述 rt 解决方案 解决方案二:我也不太清楚问题出在哪里,你要把你的报异常的截图(Causedby)贴出来但是异常是找不到定义的类文件,不过你的那些包我没见过.所以你把你的项目clean一下

session-apache tomcat集群Session 共享后报错!

问题描述 apache tomcat集群Session 共享后报错! 我参考http://www.blogjava.net/killme2008/archive/2007/03/13/103607.html 实现session共享.然后我把我的工程放到tomcat 里面去.启动不报错.点击登录的时候就登录不进去.多次点击登录按钮会进入到主界面然后又强制退出到登录界面.我的tomcat集群版本是Apache 2.2.25Tomcat-7.0.55 点击登录的时候报:严重: Manager [loc

简直奔溃,搭建centos+nginx+tomcat+redis做session共享,启动报错

问题描述 简直奔溃,搭建centos+nginx+tomcat+redis做session共享,启动报错 环境是 centos6.4+nginx1.8+tomcat7.0.65+redis3.0.5+jdk1.7.......... 配置应该没有问题,但是启动tomcat的时候报 caused by: org.apache.catalina.LifecycleException: Unable to attach to session handling valve; sessions canno

Tomcat 二级域名session共享。。。。。。。。。。。。。。。。?

问题描述 Tomcat 二级域名session共享................? java怎么实现啊 如题.................................. 解决方案 借助cookie传值,服务器读取

nginx+tomcat+memcached实现session共享,tomcat7可以正常运行

问题描述 nginx+tomcat+memcached实现session共享,tomcat7可以正常运行 我用nginx+tomcat+memcached实现session共享,tomcat7可以正常运行,但是tomcat8就报Caused by: java.lang.NoSuchMethodError: org.apache.catalina.core.ApplicationSessionCookieConfig.getSessionCookieName(Lorg/apache/catalin

Nginx 1.4.4负载均衡+容灾、泛域名解析、session共享代码示例

以下示例代码基于Nginx 1.4.4版本,配置nginx.conf文件实现http://www.aliyun.com/zixun/aggregation/13996.html">负载均衡+容灾.泛域名解析.session共享,列举配置文件中的代码与大家分享.   nginx.conf配置文件代码:   worker_processes 2; error_log logs/error.log; events {     worker_connections 560.html"&g

Nginx安装,Nginx静态缓存,Nginx Gzip压缩,Nginx负载均衡,Nginx方向代理,Nginx+Tomcat+Redis做session共享

Nginx安装 nginx-1.10.1.tar.gz安装,参考http://blog.csdn.net/tototuzuoquan/article/details/47381907. 修改nginx.conf的配置文件 #user  nobody; worker_processes  8;   error_log  logs/error.log; error_log  logs/error.log  notice; error_log  logs/error.log  info;   #pid

Apache + Tomcat 负载均衡 session复制

转自:http://blog.csdn.net/cssmhyl/article/details/8455400 http://snowolf.iteye.com/blog/743611 Apache 和 Tomcat原本就是一家,更是一家亲!Apache与Tomcat整合,无非是将Apache作为前端根据请求路径.端口.代理分发给多个Tomcat,以到达转发和负载均衡的目的!同时,通过Apache和Tomcat相互作用,进行粘性会话,会话拷贝构建集群!这一切的最终结果就是"云服务"!不

nginx+tomcat+redis完成session共享

本文记录nginx+redis+tomcat实现session共享的过程 nginx安装:http://blog.csdn.net/grhlove123/article/details/47834673 redis安装:http://blog.csdn.net/grhlove123/article/details/47783471 准备两个tomcat,修改相应的端口   名称 IP 端口 tomcat版本 JDK tomcat1 10.10.49.23 8080 7.0.40 1.7.0_25