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.]# 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>
Tomcat集成Memcached Session Manager方案的更多相关文章
- Tomcat使用Memcached Session Manager管理Session
Tomcat使用Memcached Session Manager管理Session 废话不多说,直接进入主题.项目使用阿里云负载均衡+ECS服务器集群进行部署,Tomcat使用8.5版本.阿里云负载 ...
- 使用Memcached Session Manager扩展Session管理
>>Tomcat的session管理 在请求过程中首先要解析请求中的sessionId信息,然后将sessionId存储到request的参数列表中. 然后再从request获取sessi ...
- Memcached Session Manager 共享tomcat session设置
tomcat的lib下添加jar包 修改tomcat的conf目录下的context.xml文件 新增 sessionCookiePath="/" <Manager clas ...
- Tomcat可以实现Session共享方案
说明:原来Tomcat也是可以实现Session共享的,这样大大减少的硬编码的实现,并且前面用Nginx分流时不用考虑Session的问题,因为是Web容器提供了Session共享的支持. 1.在每个 ...
- Tomcat集群环境下session共享方案 通过memcached 方法实现
对于web应用集群的技术实现而言,最大的难点就是:如何能在集群中的多个节点之间保持数据的一致性,会话(Session)信息是这些数据中最重要的一块.要实现这一点, 大体上有两种方式:一种是把所有Ses ...
- Tomcat利用MSM实现Session共享方案解说
Session共享有多种解决方法,常用的有四种:1)客户端Cookie保存2)服务器间Session同步3)使用集群管理Session(如MSM) 4)把Session持久化到数据库 针对上面Sess ...
- Tomcat通过Memcached实现session共享的完整部署记录
对于web应用集群的技术实现而言,最大的难点就是:如何能在集群中的多个节点之间保持数据的一致性,会话(Session)信息是这些数据中最重要的一块.要实现这一点, 大体上有两种方式:一种是把所有Ses ...
- 在Nginx里指定ip_hash的方式解决Tomcat集群session的问题
据称,Tomcat集群session同步方案有以下几种方式: 1)使用tomcat自带的cluster方式,多个tomcat间自动实时复制session信息,配置起来很简单.但这个方案的效率比较低,在 ...
- nginx+tomcat+redis完成session共享
本文记录nginx+redis+tomcat实现session共享的过程 nginx安装:http://blog.csdn.net/grhlove123/article/details/4783467 ...
随机推荐
- PCL学习笔记1
先贴一段代码,从别处抄来的 #include <iostream> #include <pcl/io/pcd_io.h> #include <pcl/point_type ...
- Shell脚本常用模板
作为一个运维人员编写Shell脚本是很平常的,一个格式好的脚本不仅赏心悦目,后期自己和别人也易于维护. 下面的脚本就是我自己的shell编写格式,如下: [root@mini05 -]# cat te ...
- WIndows 使用VS编译 Lua5
从Lua5.1开始官方给出的文件只有源代码和makefile文件了,官网给出的bulid方式也是在linux平台,如果只是想找个库使用下可以到这里来下载:http://joedf.ahkscript. ...
- Nginx使用教程(六):使用Nginx缓存之FastCGI缓存
启用FastCGI缓存 <br\>编辑必须启用缓存的虚拟主机配置文件. nano /etc/nginx/sites-enabled/vhost 将以下行添加到server{}指令之外的文件 ...
- (转)Spring Boot(五):Spring Boot Jpa 的使用
http://www.ityouknow.com/springboot/2016/08/20/spring-boot-jpa.html 在上篇文章Spring Boot(二):Web 综合开发中简单介 ...
- CentOS7.6 linux下yum安装redis以及使用
一.安装redis 1.检查是否有redis yum 源 1 yum install redis 2.下载fedora的epel仓库 1 yum install epel-release 3.安装re ...
- 如何给30台centos7服务器分别增加相同的用户
老大直接给了30台新鲜的生产服务器,要给每一台服务器增加一个用户,密码相同 难道我们要部署一个工具吗?这样对生产环境可能会产生影响,为了保证服务器的新鲜以及节约时间,研究了小半天,终于研究出一个不是很 ...
- [1] 从零开始 TensorFlow 学习
计算图的基本概念 TensorFlow 的名字中己经说明了它最重要的两个概念一一Tensor 和 Flow Tensor: 张量(高阶数组,矩阵为二阶张量,向量为一阶张量,标量为零阶张量) Flow: ...
- Shell 文本处理三剑客之grep
grep ♦参数 -E,--extended-regexp 模式是扩展正则表达式 -i,--ignore-case 忽略大小写 -n,--line-number 打印行号 -v,--invert-ma ...
- Python 的几个命令行参数
1) 以 $ python 方式启动 python 解释器,之后 import 一个模块,将生成 .pyc 文件. 2) 以 $ python -O 方式启动 python 解释器,之后 import ...