kryo-1.03.jar
kryo-1.03-sources.jar
minlog-1.2.jar
reflectasm-0.9.jar
memcached-session-manager-1.6.3.jar
memcached-session-manager-tc7-1.6.3.jar
msm-kryo-serializer-1.6.3.jar
msm-javolution-serializer-1.6.3.jar
msm-xstream-serializer-1.6.3.jar
msm-flexjson-serializer-1.6.3.jar
javolution-5.4.3.1.jar
spymemcached-2.8.4.jar
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 path="" docBase="ROOT">
<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<!-- Uncomment this to disable session persistence across Tomcat restarts -->
<!--
<Manager pathname="" />
-->
<!-- Uncomment this to enable Comet connection tacking (provides events
on session expiration as well as webapp lifecycle) -->
<!--
<Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
-->
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
sticky = "false"
memcachedNodes="n1:10.10.55.135:11211"
requestUriIgnorePattern=".*\.(png|gif|jpg|css|js)$"
sessionBackupAsync="false"
sessionBackupTimeout="100"
transcoderFactoryClass="de.javakaffee.web.msm.serializer.javolution.JavolutionTranscoderFactory"
copyCollectionsForSerialization="false"
/>
</Context>
\conf\nginx.conf
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
upstream tomcats {
#ip_hash;
server 10.10.55.174:8080 weight=1;
server 10.10.55.135:8080 weight=10;
}
server {
listen 80;
server_name 127.0.0.1;
charset utf-8;
location / {
root html;
index index.html index.htm;
proxy_pass http://tomcats;
proxy_set_header X-Real-IP $remote_addr;
client_max_body_size 100m;
}
location ~ ^/(WEB-INF)/ {
deny all;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 80;
server_name localhost;
#charset koi8-r;
access_log logs/host.access.log combined;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
test.jsp
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
<%=session.getId() %><br/>
<%=request.getServerName() %><br/>
<%=request.getServerPort() %><br/>
<%out.print("111111111111"); %><br/>
</body>
</html>
分享到:
相关推荐
基于nginx+tomcat+memcache的负载均衡架构
nginx,tomcat集群,session共享,基于memcache 包含nginx配置,tomcat配置,以及tomcat所需要的jar 不包含nginx,tomcat,jdk,memcache的安装
1 jdk安装及tomcat7解压缩安装配置 不用说明 2 下载nginx1 4 2 for win32 解压安装 3 下载memcached服务端for win32 解压安装 设成windows服务端 执行memcached exe d install 4 下载tomcat7对应的memcached所需jar...
这个压缩包“Nginx+tomcat6+memcache所需jar包”提供了实现这一目标所需的组件。 首先,Nginx是一个高性能的反向代理服务器,常用于负载均衡,它能够将用户的请求分发到后端不同的服务器上,从而提高服务的响应速度...
Nginx+Tomcat7+Memcached集群Session共享 完整例子 主要是利用memcached-session-manager(下面简称msm)开源tomcat插件改变tomcat原始的session存储机制,将session的存储放到分布式缓存memcache中,从而实现对...
- 配置Nginx,设置反向代理规则,将特定路径的请求转发到Tomcat实例。同时,Nginx可以通过缓存策略来缓存静态资源。 - 编写或修改应用程序,使其能够利用Memcached来缓存计算结果或频繁访问的数据,减少对数据库的...
这个程序包“tomcat7+nginx+memcached”旨在实现通过Nginx进行负载均衡,以及利用Memcache来共享Tomcat服务器之间的Session数据。以下是关于这个集成方案的详细解释: 1. **Nginx**: - **功能**:Nginx是一款高...
7. **测试与优化**:进行压力测试,调整Nginx的负载均衡策略和Memcache的缓存策略,以达到最佳性能。 总结来说,Nginx+Memcache+Linux+Tomcat集群通过合理利用资源,实现了Web服务的高性能、高可用性和可扩展性。...
这个配置利用Nginx作为反向代理和负载均衡器,Memcache作为分布式session存储,而Tomcat作为Java应用服务器。 **Nginx**: Nginx是一款高性能的HTTP和反向代理服务器,它能够有效地处理高并发请求,通过反向代理...
tomcat+nginx+memcache高可用
5. **Nginx配置**:在Nginx的配置文件中,你可以使用`ip_hash`或`sticky`模块来基于用户的IP地址或特定cookie保持会话粘滞,确保同一用户的请求始终路由到同一台Tomcat服务器,以减少Session同步的需求。 6. **测试...
为了设置session共享,你需要在Tomcat的配置文件(如`context.xml`或`server.xml`)中配置Memcached Session Manager,并指定Spy Memcached为客户端,同时在Nginx配置中启用session sticky或负载均衡策略。...
memcached-session-manager-1.9.5, kryo-3.0.3,asm-5.0.3等,我用的jdk是1.8,解决了tomcat7java.lang.NoSuchFieldError: attributes等 错误。
标题 "Memcache Session Manager Tomcat8.5.6" 指的是在Tomcat 8.5.6版本中使用Memcache作为会话管理器的一种配置。这种配置旨在提高Web应用在集群环境下的性能和可扩展性,通过将用户的会话数据存储在分布式缓存...
使用Nginx做的负载均衡,memcache做高速cache,tomcat7.0.22做web容器环境下的session共享及缓存。 能够做到重启tomcatsession不失效或多个tomcat应用下session共享。 该RAR包包含了配置所需要的全部jar文件。
Apache+Tomcat+Session+Memcache 高性能群集搭建 J2EE性能调优 Jboss的优化配置 Memcached分布式缓存 Nginx+Tomcat 动静分离 Nginx+tomcat集群Memcached+Session复制 高性能高并发服务器架构 基于nginx的tomcat负载...
构建基于Apache、Tomcat、Memcache与Nginx的分布式网站,涉及多个技术栈的集成与配置。从JDK的基础安装到Tomcat的优化配置,再到Memcached与Nginx的高级应用,每一步都需要细致的规划与实施。通过合理的设计与调优,...
这里我们主要探讨的是如何通过`memcache`与`Tomcat7`的集成,实现跨服务器的Session共享,以提高系统的可扩展性和性能。`memcache`是一个高性能、分布式的内存对象缓存系统,它能够将数据存储在内存中,从而加快读取...
在构建高性能、高可用性的Web服务时,"nginx-1.9.3--tomcat-(6,7)-memcached-session共享负载"是一个典型的架构模式,它整合了Nginx、Tomcat以及Memcached来实现负载均衡和Session共享。这个配置方案能够有效地提高...
总结来说,实现Nginx、Tomcat集群与Memcached的Session共享,需要正确配置Nginx的反向代理设置,引入并配置Tomcat的Memcached Session Manager,以及确保所有必要的jar包已经正确安装。这一过程虽然涉及多个环节,但...