- 浏览: 3470673 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
wanglf1207:
EJB的确是个不错的产品,只是因为用起来有点门槛,招来太多人吐 ...
weblogic-ejb-jar.xml的元素解析 -
qwfys200:
总结的不错。
Spring Web Flow 2.0 入门 -
u011577913:
u011577913 写道也能给我发一份翻译文档? 邮件437 ...
Hazelcast 参考文档-4 -
u011577913:
也能给我发一份翻译文档?
Hazelcast 参考文档-4 -
songzj001:
DbUnit入门实战
If you want 99.999% availability of your Glassfish cluster then you
should do 2 things: 1. Use HADB for user HTTP and Session persistence,
2. get some SUN support. I cannot help you with the decision on point
2, but with point 1 I will show you how to doit.In this article I will
NOT start again to show you how to configure a Glassfish cluster,
because this is already made in this
article. Today I will present how to add HADB functionality to a existent Glassfish cluster.
Note:
Install the Glassfish cluster from the same package as HADB (sges_ee-2_1-linux.bin) because HADB related tools are only in this package and you need them for cluster configuration.
You can use 2 topologies for HADB configuration:
1. Colocated Topologie
2. Separate tier
1. Colocated Topologie means you can host the HADB on the same servers with the Cluster nodes, what can improve the CPU utilization and you will not need so many machines but can be a night mare on maintenance.
2. In Separate Tier topologie you have separate HADB machines. Using
this topologie is easy to mantain (adding/upgrading nodes should be
very easy), but you will need more machines.
Personally I used Separate Tier topology over several Virtual Machines.
1. Environment
Debian 5.0 Lenny
Java 1.6.0_12
Glassfish HADB version 2.1 (sges_ee-2_1-linux.bin)
2. Installing HADB nodes
Shared memory from HADB nodes should be configured to accept 2GB.
echo 2147483648 > /proc/sys/kernel/shmmax
echo 2147483648 > /proc/sys/kernel/shmall
or if you want to made it persistent just addit to /etc/sysctl.conf
kernel.shmmax=2147483648
kernel.shmall=2147483648
and after just run sysctl -p
Also is very important to have multipathing or double networks because all the communication between HADB and application server need to be very reliable. HADB and App nodes are communicating using UDP protocol and if 1 packet is lost then 1 persistent session get “corrupted”.
Now one of the most important things is to have the system clocks synchronized between nodes. For that just install openntpd on all nodes.
[root@randombugs]# apt-get install openntpd
Now run the setup sges_ee-2_1-linux.bin but don’t forget to set the executable bit to be able to run it.
chmod +x sges_ee-2_1-linux.bin
Read very carefully the questions and install just the HADB application and tools.
3. Configure the Glassfish Cluster
First install the glassfish from sges_ee-2_1-linux.bin (read very carefull) and also install the hadb tools and samples. Next install a normal glassfish cluster.
Read my previous article about how to install a glassfish cluster .
After installing the DAS server and the Application nodes you just run following command to create the HADB stoage area.
[root@randombugs]$ asadmin configure-ha-cluster –user admin –hosts hadb-1,hadb-2,hadb-1,hadb-2 –devicesize 512 hadb-cluster
Go in Configurations-> [hadb-config] -> Availability -> Availability Service and enable “Availability Service”
Go in Configurations-> [hadb-config] -> Availability -> Web Container Availability and enable “Availability Service”
Go in Configurations-> [hadb-config] -> Availability -> EJB Container Availability and enable “Availability Service”
Go in Configurations-> [hadb-config] -> Availability -> JMS Availability and enable “Availability Service”
For testing you should deploy clusterjsp application what it in HADB package and when you are deploying the app don’t forget to enable “Availability” option.
Now restart the whole cluster and all nodes.
I assume you already have configured a load balancer. I use Linux-HA and NOT Sun Webserver or Apache, but the ideea is the same. Now connect to “balanced” address of the cluster http://balanced-ip/clusterjsp and add some variables. You should see something like:
# Executed From Server: gf-1
# Executed Server IP Address: 192.168.0.133
# Session ID: d1c7e1d1158a9f94f5a562aba21f
[ ... snip ... ]
Data retrieved from the HttpSession:* wow = 13
* w = 1
* xxx = 1
* www = 13
To test the perssistent session just shutdown instance 192.168.0.133. After that you should see a new server with the same seesion and the same variables.
# Executed From Server: gf-2
# Executed Server IP Address: 192.168.0.134
# Session ID: d1c7e1d1158a9f94f5a562aba21f
[ ... snip ... ]
Data retrieved from the HttpSession:* wow = 13
* w = 1
* xxx = 1
* www = 13
that means is working, but don’t expect to have the session duplication instantly … it can takes some seconds depending of your machines, network etc.
Note:
I tried to create a Loadbalancer with Apache proxy balancer, but from unknown reasons sessions doesn’t persist in this configuration, but balancing is working perfectly.
4. Other useful commands
1. Remove a HADB configuration
[root@randombugs]$ asadmin remove-ha-cluster –user admin –hosts hadb-1,hadb-2,hadb-1,hadb-2 hadb-cluster
2. Check the status of the hadb database you should run on hadb management nodes
[root@randombugs]# /opt/SUNWappserver/hadb/4/bin/hadbm status hadb-core-cluster
Please enter the password for the admin system user:**********
Database Status
hadb-core-cluster FaultTolerant
3. Clearing a corupted database
[root@randombugs]# /opt/SUNWappserver/hadb/4/bin/hadbm clear hadb-cluster
Please enter the password for the database system user:**********
Please retype the password for database system user:**********
WARNING: The –dbpassword option is deprecated since it is insecure. Using this option can compromise your password. Please use either the command prompt or the –dbpasswordfile option.
Please enter the password for the admin system user:**********
This command will clear database hadb-cluster. Type “yes” or “y” to confirm this operation, anything else to cancel:yes
Database hadb-core-cluster successfully cleared.
Doing that is not enough, now you should reconfigure the DAS server:
[root@randombugs]$ asadmin configure-ha-cluster –user admin –hosts hadb-1,hadb-2,hadb-1,hadb-2 –devicesize 512 hadb-cluster
Please enter the admin password>
HADBMGMT008:The database, hadb-cluster, already exists
Command configure-ha-cluster executed successfully.
4. If you want to have a HAFaultTolerant database you should clear the database and add some spares. To configure the spare you should have minimum 2 HADB databases. Number of spare should be even and should be less or equal with the number of HADB nodes. Spare nodes are optional.
[root@randombugs]# /opt/SUNWappserver/hadb/4/bin/hadbm clear hadb-cluster -s 2
Don’t forget to reconfigure the DAS server.
On hadb management node run
[root@randombugs]# /opt/SUNWappserver/hadb/4/bin/hadbm status hadb-core-cluster
Please enter the password for the admin system user:**********
Database Status
hadb-core-cluster HAFaultTolerant
5. Stoping and starting the database
[root@randombugs]# /opt/SUNWappserver/hadb/4/bin/hadbm stop
[root@randombugs]# /opt/SUNWappserver/hadb/4/bin/hadbm start
OR
[root@randombugs]# /opt/SUNWappserver/hadb/4/bin/hadbm restart
6. Listing hadb databases
[root@randombugs]# /opt/SUNWappserver/hadb/4/bin/hadbm list
5. Problems
1. If your database have NonOperational Status then you should clear your database.
2. If your hadb pool from your server doesn’t recognize the username
and/or password and you get an error like: Unable to open connection to
HA Store: HADB-E-11601: Invalid user name or password, then you should
reconfigure hadb on das server (configure-ha-cluster)
3. Don’t use ProxyPass balancer and apache for balance. It will not
work. Use Linux-HA, Sun webserver with loadbalancer plugin or Apache
with loadbalancer plugin.
4. Other good resources for HADB problems http://wiki.glassfish.java.net/Wiki.jsp?page=TSG_HADBProblems
<script type="text/javascript">
google_ad_client = "pub-2667782929713078";
google_ad_slot = "5717543682";
google_ad_width = 468;
google_ad_height = 60;
//--></script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script><script>google_protectAndRun("ads_core.google_render_ad", google_handleError, google_render_ad);</script>
Related Posts:
发表评论
-
字符串分割--java中String.split()用法
2013-03-06 14:25 74094在java.lang包中有String.sp ... -
用 HttpServletResponseWrapper 实现 Etag 过滤器
2012-07-09 16:58 3702原文出处:http://blog.chenlb.com/200 ... -
Fitnesse使用
2012-05-05 13:27 23420Fitnesse 的使用 一,介绍 Fitnesse是一种 ... -
Customizing the new FitNesse parser
2012-05-05 13:13 2090FitNesse began its life using ... -
java application中内嵌ActiveX控件
2011-11-14 15:57 5466我这里用的是SWT/JFace开发application,SW ... -
Google Java Developer Tools Downloads
2011-08-09 00:04 2306WindowBuilder Pro原来叫WindowB ... -
Jalita
2011-08-06 00:49 1520Jalita (Java light terminal ada ... -
【转】用Java写字符终端界面
2011-07-29 13:13 2077终端界面GUI开源项目charva。 这个框架让你可以用开发 ... -
[转]mybatis下的分页,支持所有的数据库
2011-07-21 13:21 14785大 家都知道,mybatis的自带分页方法只是逻 ... -
Java framework for text- & console-based forms?
2011-07-21 01:06 1669charva jcurses JNA , ... -
JNA(Java Native Access)学习入门
2011-07-21 01:04 22520Java Native Access 项目 在 ... -
JAVA上加密算法的实现用例
2011-06-25 12:38 4836来源:www.ibm.com ... -
如何将GlassFish作为Windows服务运行
2011-05-18 23:21 2315本文档来自GlassFish官方网站,详细介绍了将 G ... -
JAVA UDP打洞必备知识点---NAT
2011-05-05 12:56 8604一、引言 RFCl631 ... -
Keystore概念,Keytool工具使用
2011-04-28 16:20 2862近来由于项目需要做Single Sign On, 研究了一 ... -
利用Eclipse Profile Plugin监控分析Tomcat性能
2011-04-18 16:14 3669目前新版本的Eclipse在启动应用服务器的时候有一个新的选 ... -
m2eclipse: Eclipse is running in a JRE, but a JDK is required
2011-02-04 23:43 2507Eclipse 安装了Maven插件,启动Eclipse ... -
利用JNative实现Java调用动态库
2010-10-18 00:43 2059由于项目要求,需要用J ... -
RHEL5支持大内存
2010-10-08 16:19 2949安装 RHEL 5 ,硬件为 4G 内存,安装完成 ... -
Windows Server 2003 和 Windows 2000 提供大内存支持
2010-10-08 16:19 1815本文介绍物理地址扩展 ...
相关推荐
maven-glassfish-plugin-2.1.jar
glassfish-3.1.2.2 dearby使用类库
maven-glassfish-plugin-2.1-sources.jar
java ee 6 with glassfish 3 java ee 6 with glassfish 3
这是sun最新的petStore项目,内含源代码。 可以部署成功。 env: ant1.7 jdk1.6 glassfish2.1 或netbean
Beginning Java EE 6 Platform with GlassFish 3, Second Edition is this first tutorial book on the final (RTM) version of the Java EE 6 Platform. Step by step and easy to follow, this book describes ...
Java EE 6 with GlassFish 3 Application Server.rar
Java EE 5 with Glassfish Application Server 英文版 (pdf)
beginning_java_ee_6_with_glassfish_3_2nd_edition 国外最新J2EE教材
NULL 博文链接:https://cobble19.iteye.com/blog/1628098
GlassFish4的下载和安装的详细步骤,下载地址,配置等。附带有GlassFish3的安装简述
glassfish集群搭建手册glassfish集群搭建手册glassfish集群搭建手册
jmaki development with sun glassfish v3
2010 - Beginning Java EE 6 with GlassFish 3 2e (Apress)
Glassfish 集群技术揭秘Glassfish 集群技术揭秘
Glassfish部署web项目
Glassfish中关于tomcat介绍 Glassfish中关于tomcat介绍 Glassfish中关于tomcat介绍 Glassfish中关于tomcat介绍
glassfish 安装配置文档 发布、eclipse调试
GlassFish 的安装和启动,中文的呀
GlassFish 是一款强健的商业兼容应用服务器,达到产品级质量,可免费用于开发、部署和重新分发。开发者可以免费获得源代码,还可以对代码进行更改。 GlassFish 是用于构建 Java EE 5应用服务器的开源开发项目的名称...