Shoshin - Steve's blog

Creating standalone and clustered instances in GlassFish

mercredi juil. 09, 2008

Get all the bat scripts here. Define first a passwordfile.txt :
AS_ADMIN_PASSWORD=adminadmin AS_ADMIN_ADMINPASSWORD=adminadmin AS_ADMIN_MASTERPASSWORD=changeit
set the environment :
set AS_HOME=S:\appserver set PATH=%AS_HOME%\bin;%PATH% set PATH=%AS_HOME%\lib;%PATH% set GF_AS_HOST=localhost set GF_AS_DOMAIN_NAME=domain2 set GF_AS_DOMAIN_DIR=%AS_HOME%\domains set GF_AS_DOMAIN_PROFILE=cluster REM Node Agent settings set GF_AS_NA_DIR=%AS_HOME%\nodeagents set GF_AS_NA_NAME=primary-node-agent set GF_AS_NA_PORT=%GF_AS_BASE_PORT%10
REM Instance settings (dev is a standalone one, without cluster)
set GF_AS_INSTANCE_NAME=dev set GF_AS_INSTANCE_BASE_PORT=70 set GF_AS_INSTANCE_HTTP_PORT=%GF_AS_INSTANCE_BASE_PORT%80 set GF_AS_INSTANCE_HTTP_SSL_PORT=%GF_AS_INSTANCE_BASE_PORT%81 set GF_AS_INSTANCE_JMS_PORT=%GF_AS_INSTANCE_BASE_PORT%76 set GF_AS_INSTANCE_JMX_PORT=%GF_AS_INSTANCE_BASE_PORT%86 set GF_AS_INSTANCE_IIOP_PORT=%GF_AS_INSTANCE_BASE_PORT%30 set GF_AS_INSTANCE_IIOP_SSL_PORT=%GF_AS_INSTANCE_BASE_PORT%40 set GF_AS_INSTANCE_IIOP_MUT_AUTH_PORT=%GF_AS_INSTANCE_BASE_PORT%50
set GF_AS_CLUSTER_NAME=Cluster1 set GF_AS_CLUSTER_INSTANCE_NAME=prod set GF_AS_CLUSTER_INSTANCE_NA_NAME=%GF_AS_NA_NAME%
set GF_AS_CLUSTER_INSTANCE_CONFIG_NAME=%GF_AS_CLUSTER_NAME%-config set GF_AS_CLUSTER_INSTANCE_CONFIG_NAME=%GF_AS_INSTANCE_NAME%-config
set GF_AS_CLUSTER_INSTANCE_BASE_PORT=60 set GF_AS_CLUSTER_INSTANCE_HTTP_PORT=%GF_AS_CLUSTER_INSTANCE_BASE_PORT%80 set GF_AS_CLUSTER_INSTANCE_HTTP_SSL_PORT=%GF_AS_CLUSTER_INSTANCE_BASE_PORT%81 set GF_AS_CLUSTER_INSTANCE_JMS_PORT=%GF_AS_CLUSTER_INSTANCE_BASE_PORT%76 set GF_AS_CLUSTER_INSTANCE_JMX_PORT=%GF_AS_CLUSTER_INSTANCE_BASE_PORT%86 set GF_AS_CLUSTER_INSTANCE_IIOP_PORT=%GF_AS_CLUSTER_INSTANCE_BASE_PORT%30 set GF_AS_CLUSTER_INSTANCE_IIOP_SSL_PORT=%GF_AS_CLUSTER_INSTANCE_BASE_PORT%40 set GF_AS_CLUSTER_INSTANCE_IIOP_MUT_AUTH_PORT=%GF_AS_CLUSTER_INSTANCE_BASE_PORT%50
set GF_AS_BASE_PORT=90 set GF_AS_ADMIN_PORT=%GF_AS_BASE_PORT%48 set GF_AS_INSTANCE_PORT=%GF_AS_BASE_PORT%80 set GF_AS_JMS_PORT=%GF_AS_BASE_PORT%76 set GF_AS_JMX_PORT=%GF_AS_BASE_PORT%86 set GF_AS_ORB_PORT=%GF_AS_BASE_PORT%30 set GF_AS_ORB_SSL_PORT=%GF_AS_BASE_PORT%40 set GF_AS_ORB_MUT_AUTH_PORT=%GF_AS_BASE_PORT%50 set GF_AS_HTTP_SSL_PORT=%GF_AS_BASE_PORT%81
set GF_ECHO=TRUE set GF_VERBOSE=FALSE set GF_TERSE=FALSE set GF_SECURE=FALSE
create a Domain
call setEnv.bat set AS_ADMIN_PROFILE=%GF_AS_DOMAIN_PROFILE% asadmin.bat create-domain --instanceport %GF_AS_INSTANCE_PORT% --adminport %GF_AS_ADMIN_PORT% --domainproperties jms.port=%GF_AS_JMS_PORT%:domain.jmxPort=%GF_AS_JMX_PORT%:orb.listener.port=%GF_AS_ORB_PORT%:orb.ssl.port=%GF_AS_ORB_SSL_PORT%:orb.mutualauth.port=%GF_AS_ORB_MUT_AUTH_PORT%:http.ssl.port=%GF_AS_HTTP_SSL_PORT% --domaindir %GF_AS_DOMAIN_DIR% --echo=%GF_ECHO% --adminuser admin --passwordfile "passwordfile.txt" --savemasterpassword %GF_AS_DOMAIN_NAME%
Following Louis's advice , we do add am-configurator.enabled=false into the file domains//config/domain-registry Start the Admin Server
asadmin.bat start-domain --verbose=%GF_VERBOSE% --user admin --passwordfile "passwordfile.txt" --echo=%GF_ECHO% --domaindir %GF_AS_DOMAIN_DIR% %GF_AS_DOMAIN_NAME%
create a node agent :
asadmin.bat create-node-agent --host %GF_AS_HOST% --port %GF_AS_ADMIN_PORT% --agentport %GF_AS_NA_PORT% --secure=%GF_SECURE% --agentdir=%GF_AS_NA_DIR% --user admin --savemasterpassword --passwordfile passwordfile.txt %GF_AS_NA_NAME%
Start the node-agent
asadmin.bat start-node-agent --startinstances --agentdir=%GF_AS_NA_DIR% -u admin --passwordfile "passwordfile.txt" --verbose=%GF_VERBOSE% --echo=%GF_ECHO% %GF_AS_NA_NAME%
create a standalone instance
asadmin.bat create-instance --systemproperties HTTP_LISTENER_PORT=%GF_AS_INSTANCE_HTTP_PORT%:HTTP_SSL_LISTENER_PORT=%GF_AS_INSTANCE_HTTP_SSL_PORT%:IIOP_LISTENER_PORT=%GF_AS_INSTANCE_IIOP_PORT%:IIOP_SSL_LISTENER_PORT=%GF_AS_INSTANCE_IIOP_SSL_PORT%:IIOP_SSL_MUTUALAUTH_PORT=%GF_AS_INSTANCE_IIOP_MUT_AUTH_PORT%:JMX_SYSTEM_CONNECTOR_PORT=%GF_AS_INSTANCE_JMX_PORT%:JMS_PROVIDER_PORT=%GF_AS_INSTANCE_JMS_PORT% -u admin --passwordfile "passwordfile.txt" --host %GF_AS_HOST% --port %GF_AS_ADMIN_PORT% --nodeagent %GF_AS_NA_NAME% --echo=%GF_ECHO% --secure=%GF_SECURE% %GF_AS_INSTANCE_NAME%
start the instance
asadmin.bat start-instance --echo=%GF_ECHO% -u admin --passwordfile "passwordfile.txt" --host %GF_AS_HOST% --port %GF_AS_ADMIN_PORT% %GF_AS_INSTANCE_NAME%
create a cluster
asadmin.bat create-cluster --systemproperties HTTP_LISTENER_PORT=%GF_AS_CLUSTER_INSTANCE_HTTP_PORT%:HTTP_SSL_LISTENER_PORT=%GF_AS_CLUSTER_INSTANCE_HTTP_SSL_PORT%:IIOP_LISTENER_PORT=%GF_AS_CLUSTER_INSTANCE_IIOP_PORT%:IIOP_SSL_LISTENER_PORT=%GF_AS_CLUSTER_INSTANCE_IIOP_SSL_PORT%:IIOP_SSL_MUTUALAUTH_PORT=%GF_AS_CLUSTER_INSTANCE_IIOP_MUT_AUTH_PORT%:JMX_SYSTEM_CONNECTOR_PORT=%GF_AS_CLUSTER_INSTANCE_JMS_PORT% -u admin --passwordfile "passwordfile.txt" --host %GF_AS_HOST% --port %GF_AS_ADMIN_PORT% --echo=%GF_ECHO% --secure=%GF_SECURE% %GF_AS_CLUSTER_NAME%
create a clustered instance :
asadmin.bat create-instance --cluster %GF_AS_CLUSTER_NAME% --nodeagent %GF_AS_NA_NAME% --systemproperties HTTP_LISTENER_PORT=%GF_AS_CLUSTER_INSTANCE_HTTP_PORT%:HTTP_SSL_LISTENER_PORT=%GF_AS_CLUSTER_INSTANCE_HTTP_SSL_PORT%:IIOP_LISTENER_PORT=%GF_AS_CLUSTER_INSTANCE_IIOP_PORT%:IIOP_SSL_LISTENER_PORT=%GF_AS_CLUSTER_INSTANCE_IIOP_SSL_PORT%:IIOP_SSL_MUTUALAUTH_PORT=%GF_AS_CLUSTER_INSTANCE_IIOP_MUT_AUTH_PORT%:JMX_SYSTEM_CONNECTOR_PORT=%GF_AS_CLUSTER_INSTANCE_JMX_PORT%:JMS_PROVIDER_PORT=%GF_AS_CLUSTER_INSTANCE_JMS_PORT% -u admin --passwordfile "passwordfile.txt" --host %GF_AS_HOST% --port %GF_AS_ADMIN_PORT% --echo=%GF_ECHO% --secure=%GF_SECURE% %GF_AS_CLUSTER_INSTANCE_NAME% echo *** Go to the asadmin console , go to the configurations/Cluster1-config , check the JMS and JMX ports in the System Properties ***
start the cluster
asadmin.bat start-cluster -u admin --passwordfile "passwordfile.txt" --host %GF_AS_HOST% --port %GF_AS_ADMIN_PORT% --echo=%GF_ECHO% --secure=%GF_SECURE% %GF_AS_CLUSTER_NAME%
start the clustered instance
asadmin.bat create-cluster --systemproperties HTTP_LISTENER_PORT=%GF_AS_CLUSTER_INSTANCE_HTTP_PORT%:HTTP_SSL_LISTENER_PORT=%GF_AS_CLUSTER_INSTANCE_HTTP_SSL_PORT%:IIOP_LISTENER_PORT=%GF_AS_CLUSTER_INSTANCE_IIOP_PORT%:IIOP_SSL_LISTENER_PORT=%GF_AS_CLUSTER_INSTANCE_IIOP_SSL_PORT%:IIOP_SSL_MUTUALAUTH_PORT=%GF_AS_CLUSTER_INSTANCE_IIOP_MUT_AUTH_PORT%:JMX_SYSTEM_CONNECTOR_PORT=%GF_AS_CLUSTER_INSTANCE_JMX_PORT%:JMS_PROVIDER_PORT=%GF_AS_CLUSTER_INSTANCE_JMS_PORT% -u admin --passwordfile "passwordfile.txt" --host %GF_AS_HOST% --port %GF_AS_ADMIN_PORT% --echo=%GF_ECHO% --secure=%GF_SECURE% %GF_AS_CLUSTER_NAME%
List the node-agents :
asadmin.bat list-node-agents --secure=%GF_SECURE% -u admin --passwordfile "passwordfile.txt" --echo=%GF_ECHO% --host %GF_AS_HOST% --port %GF_AS_ADMIN_PORT% domain
List the instances :
asadmin.bat list-instances -u admin --passwordfile "passwordfile.txt" --host %GF_AS_HOST% --echo=%GF_ECHO% --secure=%GF_SECURE% --port %GF_AS_ADMIN_PORT% domain
List the Clusters
asadmin.bat list-clusters -u admin --passwordfile "passwordfile.txt" --host %GF_AS_HOST% --echo=%GF_ECHO% --secure=%GF_SECURE% --port %GF_AS_ADMIN_PORT% domain

Your AppServer should look like this in the admin console : 

Finally add the Enterprise Manager add-ons : Read S:/appserver/addons/caps/readme.html ! Having set the following values in S:\appserver\addons\caps\installDomain2_dev.properties
caps.domain.name=domain2
caps.admin.port=9048
caps.admin.user=admin
caps.admin.secure=false
caps.target=dev
caps.override.password.file=passwordfile.txt
AS_ADMIN_PASSWORD=adminadmin
AS_ADMIN_MASTERPASSWORD=changeit
caps.stcms.os=win32
caps.uddi.install=true
caps.stcms.install=false
Now run the EM scripts :
cd S:\appserver\addons\caps call S:\appserver\bin\asant.bat -f install.xml -Dinstall.properties=installDomain2_dev.properties -verbose -debug -logfile S:\appserver\addons\caps\appserver_addons_cap_antInstallerDomain2_dev.log
Stop and restart all running the scripts in the here under order :
  • call stopClusteredInstance.bat
  • call stopCluster.bat
  • call stopInstance.bat
  • call stopNodeAgent.bat
  • call stopAdminServer.bat
  • call startAdminServer.bat
  • startNodeAgent.bat
  • call startCluster.bat
  • startClusteredInstance.bat
  • call startInstance.bat


Or faster, you could run \Application_Server_scripts\stopAll.bat then \Application_Server_scripts\startAll.bat ...

Read also the "Monitoring: Adding an Application Server Instance to Enterprise Manager" doc on line ...


Go to the as admin console, under Applications / Web Applications / SeeBeyondSunOneDeployer ...

...Deploy it on all targets :



Now in EM, in the left frame "Explorer" click "JavaEE" / "Manage Servers tab" "Add Application Server", select "Sun Java System Application Server Domain(9.1)" in the "Server Type" drop down list

Then  "Add Application Server", select "Sun Java System Application Server Instance(9.1)" in the "Server Type" drop down list, set the instance name "dev" and the HTTP port "7080"


You finally see your instance server :


[8] Comments
Like this post? del.icio.us | furl | slashdot | technorati | digg
Comments:

hi steve,

great post. can you do one on JMQ clustering as well?

regards chris

Posted by Christian Brennsteiner on juillet 10, 2008 at 07:51 AM CEST #

Hi Chris,
Thanks for your feedback, greatly welcome :) I think my colleague Louis plan to write a new entry on that topic : JavaMQ HA and clustering with MySQL, I will be happy also to read his article, so Louis ... we look forward to read your post :)
Cheers,
Steve

Posted by Steve Pincaud on juillet 10, 2008 at 10:34 AM CEST #

Hello Steve,

Very good post. Would you be able to explain what happens at each step like for example why do we node agent before creating the cluster and stand alone. or please point me to document that explains. I am trying to understand internal artifacts.

Thanks
Raghu

Posted by Raghavulu Kodumuri on juillet 24, 2008 at 11:40 PM CEST #

Also, Can we use domain clustering for Non-JBI projects/components or is strictly for JBI components.

Thanks
Raghu

Posted by Raghavulu Kodumuri on juillet 24, 2008 at 11:47 PM CEST #

see also Louis's entry about JavaMQ HA with MySQL at http://blogs.sun.com/polyblog/entry/jms_high_availability_in_caps

Posted by Steve Pincaud on août 11, 2008 at 11:56 AM CEST #

Steve,

I got a question, I am wondering in case of Shared Instances what is the purpose of "server" instance? Can't we make server not to start? It's just waste of resources if I am going to use only shared instances to deploy both CAPS and Non CAPS projects.

Secondly in the eManager when I click deployer it only shows DAS, it doesn't show Application Server instance. If we can't deploy to a particular instance using eManager, then why do we need eManager deployer option unless we have multiple domains.

Thanks
Raghu

Posted by Raghu on septembre 11, 2008 at 10:17 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed