`
zpball
  • 浏览: 910462 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

nginx负载resin,实现session共享-JVM_ROUTE

阅读更多
NGINX负载配置:


   
 upstream backend {#集群服务器   
           server  127.0 . 0.1 : 8080  srun_id=resinserver1;    
           server  127.0 . 0.1 : 8081  srun_id=resinserver2;   
           jvm_route $cookie_JSESSIONID|sessionid;#session共享   
           } 


修改resin  server.xml

   <server id="a" address="192.168.6.121" port="6800">
    <!-- server2 address=192.168.6.162 -->
    <http id="" port="8080"/>
    </server>
    <server id="b" address="192.168.6.121" port="6801">
    <!-- server2 address=192.168.6.162 -->
    <http id="" port="8081"/>
    </server>


tomcat服务器

10.110.5.151修改为
<Engine name=”Catalina” defaultHost=”localhost” jvmRoute=”resinserver1”>

10.110.5.152修改为
<Engine name=”Catalina” defaultHost=”localhost” jvmRoute=”resinserver2”>

jvm_route介绍



This module achieves session stickiness with the session cookie. If the session is not in the cookie or URL, the module will be a normal Round-Robin upstream module.
INSTALLATION
EXAMPLE

1.For 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
;


}
DIRECTIVES

    jvm_route

    syntax: jvm_route $cookie_COOKIE[ |session_url] [ reverse]

    default: none

    context: upstream

    description:

    '$cookie_SESSION_COOKIE' specifies the session cookie name(0.7.24+). 'session_url' specifies a different session name in the URL when the client does not accept a cookie. The session name is case-insensitive. In this module, if it does not find the session_url, it will use the session cookie name instead. So if the session name in cookie is the name with its in URL, you don't need give the session_url name.

    With scanning this cookie, the module will send the request to right backend server. As far as I know, the resin's srun_id name is in the head of cookie. For example, requests with cookie value 'a* * * ' are always sent to the server with the srun_id of 'a'. But tomcat's JSESSIONID is opposite, which is like '* * * .a'. The parameter of 'reverse' specifies the cookie scanned from tail to head.

    If the request fails to be sent to the chosen backend server, It will try another server with the Round-Robin mode until all the upstream servers tried. The directive proxy_next_upstream can specify in what cases the request will be transmitted to the next server. If you want to force the session sticky, you can set 'proxy_next_upstream off'.

    server

    Every syntax is the same with the official directive except the parameter of 'srun_id' which identified the backend JVM's name by cookie. The default srun_id's value is 'a';
NOTE

This is a third-party module. And you need careful test before using this module in your production environment.

Questions/patches may be directed to Weibin Yao, yaoweibin@gmail.com.
分享到:
评论

相关推荐

    nginx-upstream-jvm-route-1.15

    【标题】"nginx-upstream-jvm-route-1.15" 涉及的核心知识点是Nginx的upstream模块与JVM路由的整合,特别针对Nginx 1.15版本。这个项目旨在解决在配置Nginx时遇到的特定错误提示“nginx: [emerg] invalid parameter ...

    nginx-upstream-jvm-route 和 nginx 对应版本,亲测可用

    此资源有两个文件,含 nginx-upstream-jvm-route 和 nginx 对应版本,都是tar.gz文件。 安装方法网上很多就不写了,亲测可用。 不用担心版本不匹配造成安装失败,再浪费积分去到处下载尝试的烦恼。 此资源有两个文件...

    nginx-upstream-jvm-route-1.12.0.tar.gz

    nginx_upstream_jvm_route 是一个 Nginx 的扩展模块,用来实现基于 Cookie 的 Session Sticky 的功能。 安装方法(进入Nginx源码目录): #patch -p0 &lt; /path/to/this/directory/jvm_route.patch # ./configure -...

    nginx-upstream-jvm-route nginx共享Session

    标题 "nginx-upstream-jvm-route nginx共享Session" 涉及到的是在使用Nginx作为反向代理服务器时,如何实现多个Java应用服务器(通常指的是JVM实例)之间的Session共享。这通常在构建高可用性和负载均衡的Web服务...

    nginx-upstream-jvm-route-1.6.tar.gz

    nginx_upstream_jvm_route 是一个 Nginx 的扩展模块,用来实现基于 Cookie 的 Session Sticky 的功能。 安装方法(进入Nginx源码目录): #patch -p0 &lt; /path/to/this/directory/jvm_route.patch # ./configure -...

    nginx-upstream-jvm-route-0.1.tar.gz

    "nginx-upstream-jvm-route-0.1.tar.gz"这个压缩包包含了实现这一功能的相关配置和脚本。在解压后的"nginx_upstream_jvm_route"目录中,我们可以找到Nginx的配置示例、Java应用程序的部署配置以及可能的脚本文件。...

    linux nginx nginx_upstream_jvm_route

    linux nginx nginx_upstream_jvm_route

    nginx-1.19.3_nginx-http-flv-module.rar

    标题中的"nginx-1.19.3_nginx-http-flv-module.rar"表明这是一个关于Nginx服务器的软件包,特别地,它包含了Nginx的1.19.3版本,并且已经集成了`nginx-http-flv-module`模块。这个模块是用于支持HTTP FLV(Flash ...

    fastdfs-nginx-module_v1.16.tar.gz源码包,nginx支

    标题中的"fastdfs-nginx-module_v1.16.tar.gz"是一个开源项目,它是一个用于Nginx服务器的模块,旨在使Nginx能够与FastDFS文件存储系统无缝集成。FastDFS是一个轻量级的开源分布式文件系统,适用于互联网和企业内部...

    fastdfs-nginx-module_v1.16.tar.gz

    总结来说,fastdfs-nginx-module_v1.16.tar.gz是一个强大的工具,它将FastDFS的文件存储能力与Nginx的Web服务器特性完美结合,实现了高效、安全的文件服务。对于需要处理大量文件上传下载的Web应用,它是理想的选择...

    nginx-sticky-module-1.25.zip

    nginx sticky是nginx的module,可以实现基于cookie的负载均衡。 下载后,在编译安装nginx时,用--add-module选项,指到sticky所在目录。类似命令如下: ./configure --prefix=/usr/local/nginx-1.6.0 --add-module=...

    Nginx安装配置、Resin安装配置说明文档

    a)在server1 上安装配置 nginx + nginx_upstream_jvm_route - 22 - b)分别在两台机器上 安装 resin - 22 - c)配置两台机器 的 resin - 23 - d)整合 ngxin resin - 24 - e)测试,打开浏览器,输入 ...

    linux下为nginx添加jvmroute模块的方法

    代码如下:cd /optwget ... /opt/nginx_upstream_jvm_route/jvm_route.patc

    Nginx-1_6_2+Memcached-1_2_6+Tomcat7负载均衡实现Session共享

    本文将详细讲解如何使用Nginx-1.6.2作为反向代理和负载均衡器,结合Memcached-1.2.6实现Session共享,并在Tomcat7应用服务器集群中部署此架构。 首先,Nginx是一款轻量级的Web服务器/反向代理服务器,以其高效、...

    Nginx-GUI-For-Linux-X64-v1.6.zip

    - **反向代理(Reverse Proxy)**:Nginx可以作为反向代理服务器,将客户端请求转发到后端的应用服务器,提高系统性能并实现负载均衡。 - **负载均衡(Load Balancing)**:通过Nginx将请求分配给多台后端服务器,...

    Nginx-GUI-For-Windows-x64-v1.6.zip

    在给定的压缩包文件“Nginx-GUI-For-Windows-x64-v1.6.zip”中,包含了一个专为Windows 64位系统设计的Nginx图形用户界面(GUI)版本,版本号为1.6。这个GUI工具的主要目的是简化Nginx的配置、启动和状态监控过程,...

    CentOS-7-x86_64-Everything-1611的版本安装nginx.rar

    首先,解压这些文件到一个合适的目录,例如 `/usr/local/src/nginx-modules`。然后,按照每个模块的文档指示进行编译和安装。通常,这会涉及到修改Nginx的配置文件`/etc/nginx/nginx.conf`,并将模块的配置行添加到...

    tomcat9+tomcat-cluster-redis-session-manager_4.0.zip

    "tomcat9+tomcat-cluster-redis-session-manager_4.0.zip"这个文件组合涉及到的是在Tomcat 9上实现负载均衡以及使用Redis作为Session管理器的高级配置。 首先,Tomcat 9是Apache Tomcat服务器的一个版本,它是Java ...

    fastdfs-nginx-module_v1.19

    4. 负载均衡:Nginx可以根据配置的策略,将请求分发到不同的FastDFS存储节点,实现负载均衡。 六、优化与维护 在实际运行中,可以根据业务需求对FastDFS Nginx模块进行优化,例如调整缓存策略、增加并发处理能力等...

Global site tag (gtag.js) - Google Analytics