一、安装Glassfish V2
不用多
讲
,可以参考下面的文章。
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 n
ode
1 --cluster
test-
cluster instance1
成功显示:
Command create-instance executed successfully.
asadmin create-instance --nodeagent n
ode2
--cluster
test-
cluster instance
2
成功显示:
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:
s
yncinstances
这个参数是干嘛的呢?
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和验证它咯。
有个很详细的介绍在这里:
但是是E文地。下面我介绍一下吧。
1、 下载一个
Sun Java System Web Server,这里我们下载的是7.0版
下载后安装就可以咯。
地址是:
这里,人家老外说了,强烈推荐再下载一个Sun App Server来为Web Server安装load balancer的plugin(插件)。
NOTE:
要下载带HADB版本的。
为什么呢?
因为老外还说,你要是够勇敢,也可以在下面的链接里学到怎么样手工配置你的load balancer插件。
不过上面介绍的都是unix版本的安装方法,windows咱就老实点吧,下个App Server。
还要提一句,里面说的aslb包可以在下面的地址找:
不多说了,一步步装好Web Server,都默认就行。