- 浏览: 138514 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (58)
- java (6)
- android (2)
- 商业 (3)
- 数据库 (5)
- oracle (6)
- 网络监控 (1)
- 盘阵 (2)
- AIX (1)
- 双机 (2)
- PM (0)
- weblogic (1)
- 测试 (1)
- 数字电视 (1)
- 手机 (0)
- linux (2)
- rhel5 (0)
- 主机配置 (0)
- 支付 (0)
- nginx (0)
- 负载均衡 (0)
- 旅游 (0)
- 签证 (0)
- httpsqs (0)
- 消息队列 (0)
- 防火墙 (0)
- iptables (0)
- selinux (1)
- apache (1)
- httpd (1)
- ssl (1)
- PCRE (1)
- glassfish (1)
- 优化 (0)
- web布局 (0)
- tiles (0)
- sitemesh (0)
- 网站 (0)
- 性能 (0)
- pv (0)
- struts2 (0)
- sprintmvc (0)
- 电子商务 (0)
- 架构 (0)
- 事务管理 (0)
- eclipse (1)
- 乱码 (1)
- svnserver (0)
- svnserve (0)
- 持续集成 (0)
- jenkins (0)
- 集群 (0)
- shell (0)
最新评论
-
sunchenjava:
目前公司正在做opennms的二次开发阶段,能否提供一些开发文 ...
OpenNMS:开放源码 NMS -
hhb19900618:
我问一下 ios平台有钓鱼的风险吗?
手机支付的思考(转载) -
cectsky:
写的不错!
groovy基础教程 -
Aaronlong31:
多谢了!不过文章 第8点 中的for循环范围貌似写错了吧!应该 ...
groovy基础教程 -
沙舟狼客:
看后豁然开朗!
groovy基础教程
A common use case for front-ending GlassFish with
However, up until now, support for Apache's
We have listened to the GlassFish user community and added the requested feature to the SJSAS 9.1 UR1 release. In
other words, with the upcoming SJSAS 9.1 UR1 release, it will be
possible to load-balance a cluster of GlassFish instances with Apache.
In order to support stickiness, Apache's loadbalancer relies on a
For example, if an HTTP session was generated on a cluster instance with a
The challenge we were facing when adding support for the
We've addressed this challenge by having the web container strip any
One of the side effects of this change has been that since a
The remainder of this blog covers important configuration aspects.
In order to load-balance a GlassFish cluster via Apache, follow these steps:
As soon as the cluster instance to which an HTTP session has been
sticky has failed, the loadbalancer will route any subsequent requests
for the same HTTP session to a different instance. This instance will
be able to load and resume the requested session using the in-memory
session replication feature that has been available since GlassFish V2.
The in-memory session replication feature is enabled only for those web applications that have been marked as How to Loadbalance GlassFish Cluster with Apache Loadbalancer
How to Loadbalance GlassFish Cluster with Apache Loadbalancer
Since GlassFish V1, it has been possible to front-end a GlassFish instance with Apache's httpd
web server, after following a few simple configuration steps
, which include defining the com.sun.enterprise.web.connector.enableJK
system property on the GlassFish instance, and specifying the port number of the mod_jk
listener on the GlassFish instance as its value. By specifying this system property, the mod_jk
connector, which comes standard with GlassFish (minus the JAR files
that need to be copied from a Tomcat installation as per the
configuration steps referenced above), will be started automatically
and will listen on the specified port to any traffic sent by the httpd
front-end over the AJP
protocol. (Please notice that when you follow the configuration steps referenced above, you must use the tomcat-ajp.jar
from Tomcat 5.5.23. Using the tomcat-ajp.jar
bundled with a more recent Tomcat release will not work.)
httpd
is to have httpd
serve any requests for static resources, while having any requests for
dynamic resources, such as servlets and JavaServer(TM) Pages (JSPs),
forwarded to, and handled by the GlassFish backend instance.
httpd
has been limited to a single GlassFish instance, and there has been great interest on the GlassFish user forum
in having an entire cluster of GlassFish instances load-balanced by
Apache, allowing users to transition from an Apache-loadbalanced
cluster of Tomcat instances to an Apache-loadbalanced cluster of
GlassFish instances and take advantage of the in-memory session
replication feature introduced in GlassFish V2
.
jvmRoute
to be included in any JSESSIONID received by it. The jvmRoute
,
which is separated from the session id via ".", and whose value is
configured via a system property of the same name, identifies the
cluster instance on which the HTTP session was generated, or on which
it was last resumed. This means that every GlassFish instance in a
cluster that is front-ended by Apache's loadbalancer must be configured
with a jvmRoute
system property whose value is unique within the cluster.
jvmRoute
system property equal to instance1
, the JSESSIONID returned to the client (via an HTTP cookie or URL rewriting) will contain the session id with the string .instance1
appended to it. A subsequent request that is intercepted by the Apache
loadbalancer will include the same JSESSIONID value that was returned
to the client, from whose jvmRoute
suffix the Apache
loadbalancer can determine the instance on which the HTTP session was
last served, and direct the request to it. Should that instance have
failed in the meantime, the Apache loadbalancer will select a different
instance from the remaining healthy instances, and have the request
failover to it. For example, if the request fails over to an instance
whose jvmRoute
system property is equal to instance2
, the response generated from that instance will include a JSESSIONID containing the session id with .instance2
(instead of .instance1
) appended to it.
jvmRoute
feature to GlassFish has been that while the Apache loadbalancer expects the jvmRoute
,
whose value may change over the lifetime of its associated HTTP
session, to be part of the JSESSIONID, we had to shield the session
management in GlassFish from the jvmRoute
, to preserve
the invariant (from the session management's perspective) that session
ids are immutable and remain constant over the lifetime of a session.
jvmRoute
off an incoming JSESSIONID (and use the remainder as the session id of the session to be resumed), and append a jvmRoute
to the session id when forming a JSESSIONID. Of course, we have the web container process a JSESSIONID in this way only if the jvmRoute
system property has been set.
jvmRoute
is dynamic, the web container now adds a JSESSIONID cookie to every
response, regardless of whether an HTTP session was created or resumed
by the corresponding request, provided that the jvmRoute
system property has been set.
jvmRoute
and com.sun.enterprise.web.connector.enableJK
system properties at the GlassFish cluster level. For example, in the case of a cluster named "cluster1", run these commands:
asadmin create-jvm-options --target cluster1 "-DjvmRoute=\${AJP_INSTANCE_NAME}"
asadmin create-jvm-options --target cluster1 "-Dcom.sun.enterprise.web.connector.enableJK=\${AJP_PORT}"
asadmin create-system-properties --target instance9 AJP_INSTANCE_NAME=instance9
asadmin create-system-properties --target instance9 AJP_PORT=8020
Notice how the port number (8020) specified for the mod_jk
connector on "instance9" matches the value of the corresponding worker.instance9.port
in the sample workers.properties
below.
mod_jk
connector, in Apache's workers.properties
configuration file. Make sure that the name of each worker
equals the value of the jvmRoute
system property of the GlassFish instance to which the worker
connects.
This convention makes it possible for an HTTP session to remain sticky
to the GlassFish instance on which the session was created, or on which
the session was last resumed.
workers.properties
configuration file is used to load-balance a 9-instance GlassFish
cluster, in which the instances are spread over three physical server
machines: my.domain1.com
, my.domain2.com
, and my.domain3.com
:
# Define 1 real worker using ajp13
worker.list=loadbalancer
# Set properties for instance1
worker.instance1.type=ajp13
worker.instance1.host=my.domain1.com
worker.instance1.port=8012
worker.instance1.lbfactor=50
worker.instance1.cachesize=10
worker.instance1.cache_timeout=600
worker.instance1.socket_keepalive=1
worker.instance1.socket_timeout=300
# Set properties for instance4
worker.instance4.type=ajp13
worker.instance4.host=my.domain1.com
worker.instance4.port=8015
worker.instance4.lbfactor=50
worker.instance4.cachesize=10
worker.instance4.cache_timeout=600
worker.instance4.socket_keepalive=1
worker.instance4.socket_timeout=300
# Set properties for instance7
worker.instance7.type=ajp13
worker.instance7.host=my.domain1.com
worker.instance7.port=8018
worker.instance7.lbfactor=50
worker.instance7.cachesize=10
worker.instance7.cache_timeout=600
worker.instance7.socket_keepalive=1
worker.instance7.socket_timeout=300
# Set properties for instance2
worker.instance2.type=ajp13
worker.instance2.host=my.domain2.com
worker.instance2.port=8013
worker.instance2.lbfactor=50
worker.instance2.cachesize=10
worker.instance2.cache_timeout=600
worker.instance2.socket_keepalive=1
worker.instance2.socket_timeout=300
# Set properties for instance5
worker.instance5.type=ajp13
worker.instance5.host=my.domain2.com
worker.instance5.port=8016
worker.instance5.lbfactor=50
worker.instance5.cachesize=10
worker.instance5.cache_timeout=600
worker.instance5.socket_keepalive=1
worker.instance5.socket_timeout=300
# Set properties for instance8
worker.instance8.type=ajp13
worker.instance8.host=my.domain2.com
worker.instance8.port=8019
worker.instance8.lbfactor=50
worker.instance8.cachesize=10
worker.instance8.cache_timeout=600
worker.instance8.socket_keepalive=1
worker.instance8.socket_timeout=300
# Set properties for instance3
worker.instance3.type=ajp13
worker.instance3.host=my.domain3.com
worker.instance3.port=8014
worker.instance3.lbfactor=50
worker.instance3.cachesize=10
worker.instance3.cache_timeout=600
worker.instance3.socket_keepalive=1
worker.instance3.socket_timeout=300
# Set properties for instance6
worker.instance6.type=ajp13
worker.instance6.host=my.domain3.com
worker.instance6.port=8017
worker.instance6.lbfactor=50
worker.instance6.cachesize=10
worker.instance6.cache_timeout=600
worker.instance6.socket_keepalive=1
worker.instance6.socket_timeout=300
# Set properties for instance9
worker.instance9.type=ajp13
worker.instance9.host=my.domain3.com
worker.instance9.port=8020
worker.instance9.lbfactor=50
worker.instance9.cachesize=10
worker.instance9.cache_timeout=600
worker.instance9.socket_keepalive=1
worker.instance9.socket_timeout=300
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=instance1,instance2,instance3,instance4,instance5,instance6,instance7,instance8,instance9
loadbalancer
worker specified in your workers.properties
file from your httpd.conf
. The following snippet from httpd.conf
causes any JSP requests to be load-balanced over the GlassFish cluster configured in the above workers.properties
file:
JkWorkersFile workers.properties
# Loadbalance all JSP requests over GlassFish cluster
JkMount /*.jsp loadbalancer
distributable
in their web.xml
deployment descriptor, and that have been deployed to the cluster with the --availabilityenabled
option of the asadmin deploy
command set to true
(default is false
).
相关推荐
#### 四、配置Apache作为负载均衡器 ##### 4.1 安装Apache 1. **安装Apache**:在Linux系统上安装Apache。 2. **配置Apache**:编辑Apache的配置文件,例如`httpd.conf`。 3. **安装JK模块**:JK模块是Apache与...
4. 介绍创建jk监听器的部分说明了仅仅依靠Glassfish内部的负载均衡和会话复制功能是不够的,还需要通过配置Apache服务器来保证跨服务器的会话复制和粘滞会话效果。 5. 最后,手册还包括了通过命令行界面进行集群...
flex远程对象操作(简单对象到复杂对象) 服务器为glassfish 工作过程录制,语言为成都方言:),听不明白的只有光看了
apache与glassfish整合,包含apache的安装与配置文件配置与属性说明,以及一个简易demo
1. Nginx 作为前端服务器,负责处理静态资源请求,提供 SSL/TLS 加密,进行负载均衡,同时作为反向代理,将动态请求转发给 Apache 或 Tomcat。 2. Apache 可以作为动态内容处理器,尤其是当应用使用 PHP 或其他 ...
工作录制,语言为成都方言 主要实际操作Flex远程对象实现
工作录制,语言为成都方言 主要实际操作Flex远程对象实现
《Glassfish V2与Apache整合详解》 在IT行业中,服务器的高效运行和灵活配置是提升应用程序性能的关键。本文将详细介绍如何将Java EE应用服务器Glassfish V2与Web服务器Apache进行整合,以实现更强大的服务架构。...
### GlassFish和Ant安装与配置 #### 一、概述 本文档主要介绍如何在Windows平台上安装和配置GlassFish服务器以及Ant构建工具,并在Eclipse IDE中进行相应的设置,以便能够顺利地开发、构建和部署Java Web应用程序...
当我们谈论"Glassfish单机集群jk_little"时,这意味着我们要在一台机器上设置一个Glassfish集群,并利用JK模块(mod_jk)实现负载均衡。 首先,"httpd.conf"是Apache HTTP服务器的主要配置文件。在这个场景中,它被...
GlassFish Server,作为Java EE(Enterprise Edition)的开源参考实现,是Java开发者和企业级应用部署的重要平台。这个服务器提供了一个全面的环境,用于开发、测试和运行符合Java EE规范的应用程序。Java EE是一个...
《Glassfish安装手册及源文件详解》 Glassfish是一款开源的应用服务器,它是Java EE平台的实现,为企业级应用提供了一套完整的开发、部署环境。在本文中,我们将深入探讨如何安装Glassfish,以及如何利用Ant工具...
Apache作为前端代理,需要配置负载均衡规则,以将请求分发到Glassfish集群的不同实例。这通常涉及修改Apache的httpd.conf文件,设置mod_jk模块的配置。 ### 4. 小结 Glassfish集群的搭建是一项技术含量较高的工作,...
5. **云就绪**:作为一款现代应用服务器,GlassFish 4.0具备良好的云适应性,能够轻松地在虚拟化环境和云平台上部署,支持动态扩展和自动负载均衡。 6. **持续集成与测试**:白皮书会涵盖如何利用GlassFish与各种...
这个案例涵盖了使用Java 8语言、NetBeans IDE、GlassFish应用服务器以及PostgreSQL数据库进行Web应用程序开发的基础知识。让我们详细了解一下这些关键组件及其在Web开发中的作用。 首先,Java Server Pages(JSP)...
NetBeans8 0 2+GlassFish4 1 或者WildFly 8 0 2 +MySQL5 6 23 也可以稳步到这里一坐:http: tryrefine iteye com blog 2184106">Java EE 7官司方例子 也是《Java EE 7 Essentials》(中文翻译《Java EE 7精粹》 ...