/ 中存储网

Nginx_upstream_jvm_route模块的使用方法

2014-04-03 17:51:01 来源:ITJS.CN
nginx_upstream_jvm_route 是一个 Nginx 的扩展模块,用来实现基于 Cookie 的 Session Sticky 的功能。

安装方法(进入Nginx源码目录):

#patch -p0 < /path/to/this/directory/jvm_route.patch

# ./configure --prefix=/usr/nginx-0.8.1 --with-http_stub_status_module --add-module=/path/to/this/directory/

#make

#make install

例如以下配置:

1. Resin:

upstream backend {

server 192.168.0.100 srun_id=a;

server 192.168.0.101 srun_id=b;

server 192.168.0.102 srun_id=c;

server 192.168.0.103 srun_id=d;

jvm_route $cookie_JSESSIONID;

}

2. Tomcat:

upstream backend {

server 192.168.0.100 srun_id=a;

server 192.168.0.101 srun_id=b;

server 192.168.0.102 srun_id=c;

server 192.168.0.103 srun_id=d;

jvm_route $cookie_JSESSIONID reverse;

}