nginx + memcached-session-manager 实现tomcat下的负载均衡
1. tomcat6.0 配置
memcached-session-manager 实现session共享
1.1 下载memcached-session-manager-1.6.5.jar、memcached-session-manager-tc6-1.6.5.jar(tomcat6.0)、msm-javolution-serializer-1.6.5.jar、spymemcached-2.8.12.jar、javolution-5.4.3.1.jar和couchbase-client-1.1.4.jar 共5个jar包放入tomcat的lib目录下;
1.2 context节点下增加如下配置
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
memcachedNodes="n1:192.168.1.104:11211"
sticky="false"
requestUriIgnorePattern=".*\.(png|gif|jpg|css|js)$"
sessionBackupAsync="false"
sessionBackupTimeout="100"
transcoderFactoryClass="de.javakaffee.web.msm.serializer.javolution.JavolutionTranscoderFactory"
copyCollectionsForSerialization="false"
/>
2.nginx-1.5.6 配置
#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 10; #gzip on;
upstream localhost {
server 192.168.1.104:85;
server 192.168.1.106:85;
} server {
listen 80;
server_name localhost; #charset koi8-r;
charset utf-8; #access_log logs/host.access.log main; location / {
root html;
index index.html index.htm;
proxy_pass http://localhost;
proxy_set_header X-Real-IP $remote_addr;
client_max_body_size 100m;
} location ~ ^/(WEB-INF)/ {
deny all;
} #error_page 404 /404.html;\
error_page 500 502 503 504 /50x.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 ssl;
# server_name localhost; # ssl_certificate cert.pem;
# ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on; # location / {
# root html;
# index index.html index.htm;
# }
#} }
nginx + memcached-session-manager 实现tomcat下的负载均衡的更多相关文章
- Memcached Session Manager 共享tomcat session设置
tomcat的lib下添加jar包 修改tomcat的conf目录下的context.xml文件 新增 sessionCookiePath="/" <Manager clas ...
- Tomcat使用Memcached Session Manager管理Session
Tomcat使用Memcached Session Manager管理Session 废话不多说,直接进入主题.项目使用阿里云负载均衡+ECS服务器集群进行部署,Tomcat使用8.5版本.阿里云负载 ...
- windows系统下nginx+tomcat+redis做负载均衡和session粘滞附整套解决方案
Nginx: 在nginx-1.8.0\conf目录下找到nginx.conf文件,打开文件修改文件中http{}中的内容,在http{}中加入 upstream localhost { serve ...
- Nginx+Tomcat+Redis实现负载均衡、资源分离、session共享
Nginx+Tomcat+Redis实现负载均衡.资源分离.session共享 CentOS安装Nginx http://centoscn.com/CentosServer/www/2013/0910 ...
- 使用Memcached Session Manager扩展Session管理
>>Tomcat的session管理 在请求过程中首先要解析请求中的sessionId信息,然后将sessionId存储到request的参数列表中. 然后再从request获取sessi ...
- Nginx + Tomcat Windows下的负载均衡配置
Nginx + Tomcat Windows下的负载均衡配置 一.为什么需要对Tomcat服务器做负载均衡? Tomcat服务器作为一个Web服务器,其并发数在300-500之间,如果超过50 ...
- Nginx+Tomcat在Windows下做负载均衡
一. 为什么需要对Tomcat服务器做负载均衡 Tomcat服务器作为一个Web服务器,其并发数在300-500之间,如果有超过500的并发数便会出现Tomcat不能响应新的请求的情况,严重影响网站的 ...
- keepalived+nginx+tomcat+redis实现负载均衡和session共享(原创)
keepalived+nginx+tomcat+redis实现负载均衡和session共享 直接上链接,码了一天,就不再重写了,希望能帮到大家,有问题欢迎留言交流.
- 使用Nginx实现Tomcat集群负载均衡
概述 要解决的问题 环境准备以及问题解决思路 配置 测试 小结 一.概述 使用Nginx主要是来解决高并发情况下的负载均衡问题. 二.要解决的问题 1.最主要是负载均衡请求分发. 2.文件上传功能,只 ...
随机推荐
- HOOK函数(一)——进程内HOOK
什么是HOOK呢?其实很简单,HOOK就是对Windows消息进行拦截检查处理的一个函数.在Windows的消息机制中,当用户产生消息时,应用程序通过调用GetMessage函数取出消息,然后把消息放 ...
- 几种JavaScript富应用MVC MVVM框架
Ember.js.Backbone.js.Knockout.js.Spine.js.Batman.js , Angular.js 前端中的MVVM设计模式让UI与数据模型可以很轻松的相互更新,这意味着 ...
- 页面嵌套 Iframe 产生缓存导致页面数据不刷新问题
最近遇到个比较古怪的问题:当页面嵌套多个 Iframe 时会出现 Iframe 里包含的页面无法看到最新的页面信息. 初步解决方案,在 Iframe 指向的页面地址后缀添加一个随机数或者时间戳.这样能 ...
- HDU 1176 免费馅饼(数字三角形)
免费馅饼 Problem Description 都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼.说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉 ...
- 【失败】制作CentOS镜像
1.在vmware上安装centos虚拟机,安装过程中设置CPU时,点选 虚拟化Intel VT-x~ 和 虚拟化CPU性能计数器,网络使用NAT模式 2.#mkdir /opt/iso,上传镜像(用 ...
- Ubuntu系统的安装
在上一篇博客中,我们已经建立了一个“空白”的虚拟Ubuntu镜像,在这篇博客中,我们将介绍如何安装并进入完整的Ubuntu系统. 写在前面:不同版本的系统在安装过程中,有些操作可能会不同,但是其核心步 ...
- 非常实用的JQuery的选项卡切换源码
<html> <head> <meta charset="utf-8"> <title>简单选项卡</title> &l ...
- spring mvc 和mybatis整合 的异常处理
1.自定义异常信息类 通过构造函数来实现异常信息的接收 public class CustomException extends Exception { //异常信息 private String m ...
- sae后台管理的js(二)
jsloader cssloader 使用方法<link rel="stylesheet" type="text/css" href="/min ...
- lnmp安装--php与nginx结合
软件环境: linux:centos5. nginx:.tar.gz php:.tar.gz lnmp与lamp的区别? lnmp(linux+nginx+mysql+php)的提法相对于lamp(l ...