一、 安装Glassfish V2
不用多讲,可以参考下面的文章。
http://server.it168.com/server/2007-12-05/200712051503146.shtml
NOTE:
1、 一般要加这个参数:
java -Xmx256m -jar filename.jar
2、 因为讲的是要使用Cluster的功能,所以安装的时候要用这个:
ant -f setup-cluster.xml
而不是
ant -f setup.xml
二、配置Cluster
1、启动Glassfish
asadmin start-domain domain1
最后一句看见这个就是成功了
Domain supports application server clusters and other standalone instances.
NOTE:不管是在什么时候,都强烈建议使用命令行来进行操作。
因为根据经验,“http://localhost:4848/”上所进行的设置很多情况下都是有问题
的,而且像Node Agent这些东西必须要在命令行里面才能建立和启动。
2、建立第一个Node Agent,叫做node1
asadmin create-node-agent node1
成功的话会显示:
Command create-node-agent executed successfully.
3、建立第二个Node Agent,叫做node2
asadmin create-node-agent node2
4、建立咱们的Cluster,叫做test-cluster
asadmin create-cluster test-cluster
成功的话会显示:
Command create-cluster executed successfully.
5、在Cluster上加入咱们的node1和node2,并且配置上各自管理的instance
asadmin create-instance --nodeagent node1 --cluster test-cluster instance1
成功显示:
Command create-instance executed successfully.
asadmin create-instance --nodeagent node2 --cluster test-cluster instance2
成功显示:
Using 38,081 for HTTP_LISTENER_PORT.
Using 38,182 for HTTP_SSL_LISTENER_PORT.
Using 33,821 for IIOP_SSL_LISTENER_PORT.
Using 37,677 for JMS_PROVIDER_PORT.
Using 33,701 for IIOP_LISTENER_PORT.
Using 38,687 for JMX_SYSTEM_CONNECTOR_PORT.
Using 33,921 for IIOP_SSL_MUTUALAUTH_PORT.
Command create-instance executed successfully.
6、启动Node Agent
asadmin start-node-agent --syncinstances=true node1
asadmin start-node-agent --syncinstances=true node2
会提示输入master password:
Please enter the master password [Enter to accept the default]:>
直接回车就好。
成功显示:
Command start-node-agent executed successfully.
NOTE:
syncinstances这个参数是干嘛的呢?
http://docs.sun.com/app/docs/doc/820-4046/start-node-agent-1?l=ja&a=view&q=start-node-agent
文档上这么解释的:
If set to true, forcibly synchronizes the cache repositories of all server instances with 
the central repository of the DAS. The synchronization occurs when the node agent is 
started. For more information, see Synchronizing Node Agents and the Domain Administration Server in Sun Java System Application Server 9.1 High Availability Administration Guide. Default is false.
什么的意思呢?大概就是要强制地使各个服务器实例缓存的存储库与DAS的中央存储库同步。能更安全吧。要想了解更详细自己瞅E文吧。弄完了上面这几步,集群就算是搭起来了。上http://localhost:4848/看看,不错,都有。 
三、配置和验证load balancer
好了,配置完成了,下面就该弄一个load balancer和验证它咯。
有个很详细的介绍在这里:
http://blogs.sun.com/Prashanth/entry/setting_up_load_balancing_in
但是是E文地。下面我介绍一下吧。
1、 下载一个Sun Java System Web Server,这里我们下载的是7.0版
下载后安装就可以咯。
地址是:
https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_SMI-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=SJWS-7.0U2-OTH-G-F@CDS-CDS_SMI
这里,人家老外说了,强烈推荐再下载一个Sun App Server来为Web Server安装load balancer的plugin(插件)。
http://www.sun.com/download/index.jsp?cat=Application%20%26%20Integration%20Services&tab=3&subcat=Application%20Servers
NOTE:
要下载带HADB版本的。
为什么呢?
因为只有HADB版本才带插件,老外还说,你要是够勇敢,也可以在下面的链接里学到怎么样手工配置你的load balancer插件。
http://blogs.sun.com/pjjairath/entry/installing_and_configuring_glassfish_http
不过上面介绍的都是unix版本的安装方法,windows咱就老实点吧,下个App Server。
还要提一句,里面说的aslb包可以在下面的地址找:
http://download.java.net/javaee5/external/
不多说了,一步步装好Web Server,都默认就行。
NOTE:
安装App Server的时候就有讲究了,一定要选中,load balance plugin这项。
要的就是它,不选就白费劲了。然后选中你的Web Server安装时的路径,如下:
<Web Server’s home>\https-<computer-name>
<Web Server’s home>是你的Web Server安装路径,比如默认的C:\Sun\WevServer7
<computer-name>是你的计算机名,不知道的话,……我也没辙了
都安装好后就进入激动的时刻了。
2、 安装例子明天继续……