zoukankan      html  css  js  c++  java
  • Tomcat集成Memcached Session Manager方案

    http://repo1.maven.org/maven2/de/javakaffee/msm/memcached-session-manager/2.3.2/memcached-session-manager-2.3.2.jar

    http://repo1.maven.org/maven2/de/javakaffee/msm/memcached-session-manager-tc7/2.3.2/memcached-session-manager-tc7-2.3.2.jar

    http://repo1.maven.org/maven2/net/spy/spymemcached/2.9.1/spymemcached-2.9.1.jar

    [root@crm-web apache-tomcat-7.0.92]# cat conf/context.xml
    <?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.
    -->
    <!-- The contents of this file will be loaded for each web application -->
    <Context>
    
        <!-- Default set of monitored resources -->
        <WatchedResource>WEB-INF/web.xml</WatchedResource>
    
        <!-- Uncomment this to disable session persistence across Tomcat restarts -->
        <!--memcached 
        <Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
            memcachedNodes="n1:172.17.1.255:11211,n2:172.17.1.13:11211"
            failoverNodes="n2"
            requestUriIgnorePattern=".*.(ico|png|gif|jpg|css|js)$"
            transcoderFactoryClass="de.javakaffee.web.msm.JavaSerializationTranscoderFactory"/>
        -->
    
        <!-- Uncomment this to enable Comet connection tacking (provides events
             on session expiration as well as webapp lifecycle) -->
        <!--
        <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
        -->
    
    </Context>

    Add custom serializers to your webapp (optional)

    If you want to use java's built in serialization nothing more has to be done. If you want to use a custom serialization strategy (e.g. because of better performance) this has to be deployed with your webapp so that they're available in WEB-INF/lib/.

    As msm is available in maven central (under groupId de.javakaffee.msm) you can just pull it in using the dependency management of your build system. With maven you can use this dependency definition for the kryo-serializer:

    <dependency>
        <groupId>de.javakaffee.msm</groupId>
        <artifactId>msm-kryo-serializer</artifactId>
        <version>1.9.7</version>
        <scope>runtime</scope>
    </dependency>
  • 相关阅读:
    Charles的使用教程
    Sublime Text 3 无法使用package control安装插件解决办法
    sublime常用快捷键整理(未完待续)
    常用 Git 命令清单
    js判断的执行顺序
    使用CSS3 Media Queries实现网页自适应(转)
    移动前端开发之viewport的深入理解(转)
    javascript之函数节流
    String常用方法总结
    腾讯面试题1
  • 原文地址:https://www.cnblogs.com/rgqancy/p/10247983.html
Copyright © 2011-2022 走看看