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

Install Glassfish 2.1 with HADB

    博客分类:
  • Java
阅读更多
Glassfish Logo

Glassfish Logo


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.

Co-located Topology

Co-located Topology


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.

Separate Tier

Separate Tier

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.

Glassfish HADB installation. Warning! Contains nudity :)

Glassfish HADB installation. Warning! Contains nudity :)

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 = &quot;pub-2667782929713078&quot;; google_ad_slot = &quot;5717543682&quot;; google_ad_width = 468; google_ad_height = 60; //--&gt;</script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script><script>google_protectAndRun(&quot;ads_core.google_render_ad&quot;, google_handleError, google_render_ad);</script>

 

Related Posts:

分享到:
评论

相关推荐

    GlassFish源码

    在这个特定的压缩包中,我们看到的似乎是GlassFish 2.1版本的源代码,这个版本发布于2010年,主要支持的是Java EE 5规范。 Java EE 5是Java企业级平台的一个重要里程碑,它简化了企业应用的开发,引入了许多新特性...

    glassfish-3.1.2.2 dearby使用类库

    《glassfish-3.1.2.2 使用Dearby类库详解》 Glassfish是一款开源的应用服务器,由Oracle公司维护,广泛应用于Java EE应用程序的部署和管理。在Glassfish 3.1.2.2版本中,Dearby库是其核心组件之一,它为Java平台...

    maven-glassfish-plugin-2.1.jar

    maven-glassfish-plugin-2.1.jar

    maven-glassfish-plugin-2.1-sources.jar

    maven-glassfish-plugin-2.1-sources.jar

    java ee 6 with glassfish 3

    《Apress - Beginning Java EE 6 Platform with GlassFish 3: From Novice to Professional》和《Beginning Java™ EE 6 Platform with GlassFish™ 3: From Novice to Professional》这两本书籍可以作为深入学习的...

    glassfish安装

    《Glassfish安装详解》 Glassfish,作为Oracle公司开源的一款Java EE应用服务器,是开发者进行企业级Java应用程序部署的重要平台。本文将详细讲解如何安装和配置Glassfish,以帮助初学者快速入门。 首先,理解...

    Beginning Java EE 6 with GlassFish 3, 2nd Edition

    ### 关于《Beginning Java EE 6 with GlassFish 3, 2nd Edition》的知识点解析 #### 一、Java EE 6 平台概述 **Java Enterprise Edition (Java EE)** 是Oracle公司(前身为Sun Microsystems)开发的一个企业级Java...

    GlassFish2.0的安装

    GlassFish 2.0 是 Sun Microsystems 推出的一款免费且开源的 Java EE 服务器,它基于 Java Platform, Enterprise Edition (Java EE) 5规范,提供了包括EJB 3.0、JSF 1.2、Servlet 2.5、JSP 2.1、JAX-WS 2.0、JAXB ...

    Java EE 6 with GlassFish 3 Application Server

    在"Java EE 6 with GlassFish 3 Application Server"中,我们可以学习到以下几个关键知识点: 1. **模块化**:Java EE 6引入了模块化的概念,允许开发者根据需要选择要使用的Java EE组件,如EJB(Enterprise ...

    glassfish-ose-4.0 白皮书

    Java EE 7引入了多项新特性,如WebSocket、JAX-RS 2.0(用于RESTful服务)、JPA 2.1(Java Persistence API,用于对象关系映射)、JSF 2.2(JavaServer Faces,用于构建用户界面)等,提升了开发效率和应用性能。...

    glassfish集群搭建手册

    标题《Glassfish集群搭建手册》指的是利用Oracle提供的Glassfish应用服务器软件进行集群配置的详细指南。此手册涵盖了在不同场景下通过图形化界面和命令行方式搭建集群的整个过程,并且描述了如何配置集群环境以支持...

    glassfish安装配置文档

    GlassFish 安装配置文档 GlassFish 是一个基于 Java 的开源应用服务器,提供了一个强大且灵活的平台来部署和管理基于 Java 的应用程序。本文档将指导 readers 通过安装和配置 GlassFish 服务器,并将其与 Eclipse ...

    glassfish-3.1.2.2.zip

    《深入解析Glassfish 3.1.2.2与Java EE 6的融合应用》 Glassfish 3.1.2.2是一款由Oracle公司开发的开源应用服务器,它是Java EE 6规范的重要实现者,提供了全面的支持和丰富的功能,为开发者提供了构建企业级Web...

    Glassfish部署web项目

    ### Glassfish部署Web项目知识点详解 #### 一、概述 **Glassfish** 是一款开源的Java EE应用服务器,由Oracle公司维护。它基于Java EE标准,支持多种Java EE技术,如EJB、JPA、JSF等。由于其强大的功能和良好的...

    在linux下安装glassfish

    在Linux环境下安装与配置GlassFish应用服务器是一项技术性工作,涉及多个步骤,本文将详细解析这一过程中的关键知识点,帮助读者全面理解并掌握在Linux下安装GlassFish的完整流程。 ### 1. 安装前的环境准备 #### ...

    JSP2.1技术规范

    JSP 2.1规范确保了与各种Servlet容器的兼容性,如Tomcat、Jetty、GlassFish等,使得开发者能够在不同的环境中轻松部署和运行JSP应用。 总的来说,JSP 2.1规范通过一系列的改进和增强,为Web开发者提供了更强大的...

    GlassFish4(GlassFish3)安装

    GlassFish4的下载和安装的详细步骤,下载地址,配置等。附带有GlassFish3的安装简述

Global site tag (gtag.js) - Google Analytics