GlassFish Server Open Source Edition 3.1 Milestone 1 - Clustering Demo The basic clustering features available with MS1 will be demonstrated using the following script. Team This demo is brought to you by the core clustering infrastructure team:
- Jennifer Chou
- Jerome Dochez
- Byron Nevins
- Bhakti Mehta
- Tom Mueller
- Vijay Ramachandran
- Bill Shannon
- Sheetal Vartak
Setup
- Install GlassFish Server Open Source Edition 3.1 software on 2 servers, referred to as node1 and node2 in these instructions. The DAS will run on node1.
- Set environment variable ENABLE_REPLICATION=true (to do command replication)
- This is required since command replication is switched off by default till all CLIs are verified and modified, if required, to work in the cluster environment
- This variable must be set before start-domain is run.
- Since deploy replication isn't working yet, don't see this variable until ready to demonstrate command replication
- asadmin create-local-instance must use --system-properties to specify ports
- This is required because the key-value replacement in domain.xml is targeted for MS2 only
 The demonstration consists of running a DAS with a cluster, c1, that contains three instances. The DAS and instance 1 will run on node1 and instance 2 and 3 will run on node2. The HTTP ports for the instances are 18080, 18080, and 38080 for instances 1, 2 and 3 respectively. On node1:
asadmin start-domain
asadmin create-cluster c1
asadmin create-local-instance --cluster c1 --systemproperties HTTP_LISTENER_PORT=18080:HTTP_SSL_LISTENER_PORT=18181:IIOP_SSL_LISTENER_PORT=13800:IIOP_LISTENER_PORT=13700:JMX_SYSTEM_CONNECTOR_PORT=17676:IIOP_SSL_MUTUALAUTH_PORT=13801:JMS_PROVIDER_PORT=18686:ASADMIN_LISTENER_PORT=14848 in1
On node2:
asadmin --host node1 --port 4848 create-local-instance --cluster c1 --systemproperties HTTP_LISTENER_PORT=18080:HTTP_SSL_LISTENER_PORT=18181:IIOP_SSL_LISTENER_PORT=13800:IIOP_LISTENER_PORT=13700:JMX_SYSTEM_CONNECTOR_PORT=17676:IIOP_SSL_MUTUALAUTH_PORT=13801:JMS_PROVIDER_PORT=18686:ASADMIN_LISTENER_PORT=14848 in2
asadmin --host node1 --port 4848 create-local-instance --cluster c1 --systemproperties HTTP_LISTENER_PORT=38080:HTTP_SSL_LISTENER_PORT=38181:IIOP_SSL_LISTENER_PORT=33800:IIOP_LISTENER_PORT=33700:JMX_SYSTEM_CONNECTOR_PORT=37676:IIOP_SSL_MUTUALAUTH_PORT=33801:JMS_PROVIDER_PORT=38686:ASADMIN_LISTENER_PORT=34848 in3
Deploy an application to the cluster. The http://wiki.glassfish.java.net/attach/3.1MS1ClusteringDemo/helloworld.war file is attached to this wiki page.
asadmin deploy --target c1 helloworld.war
Start the instances. On node1:
asadmin start-local-instance in1
Browse through to the list of <config> and to the list of <server>
- notice how DAS has 4 server elements – instances each have one and only one server.
- notice that DAS has all the <config> elements while instances have just one or two.
Mention that this "idiot-proof"s instances in one respect – they can't foul-up others' config elements, only DAS can do that! Show directory structure on node2
ls glassfish/nodeagent/node2
Show contents of domain.xml
vi glassfish/domains/domain1/config/domain.xml
Restart the domain with command replication active
asadmin stop-domain
export ENABLE_REPLICATION=true
asadmin start-domain
Remember to plug email from Vijay with wiki page on how to convert commands for replicated execution. Run commands with cluster target and show replication on all instances in a cluster
asadmin create-jdbc-connection-pool --datasourceclassname org.apache.derby.jdbc.ClientDataSource --restype javax.sql.XADataSource --target c1 sample_jdbc_pool
asadmin create-iiop-listener --target c1 --listeneraddress 192.168.1.100 --iiopport 1400 sample_iiop_listener
asadmin create-connector-connection-pool --target c1 --raname jmsra --connectiondefinition javax.jms.QueueConnectionFactory jms/qConnPool
Use a browser and show the following links to show how the command is automatically replicated to all instances in a cluster
- http://host:port/management/domain/resources/jdbc-connection-pool
- http://host:port/management/domain/configs/config/c1-config/iiop-service/iiop-listener
- http://host:port/management/domain/resources/connector-connection-pool
Show the domain.xml file on in3 to show how it has been modified Run command with instance target and show replication only to that instance
asadmin create-connector-connection-pool --target in2 --raname jmsra --connectiondefinition javax.jms.QueueConnectionFactory jms/instanceOnlyConnPool
Use a browser and show the following links to show how the command is automatically replicated to the instance only
- http://host:port/management/domain/resources/jdbc-connection-pool
- http://host:port/management/domain/configs/config/c1-config/iiop-service/iiop-listener
- http://host:port/management/domain/resources/connector-connection-pool
Run commands and show replication
asadmin delete-jdbc-connection-pool --target c1 sample_jdbc_pool
asadmin delete-iiop-listener --target c1 sample_iiop_listener
asadmin delete-connector-connection-pool --target c1 jms/qConnPool
Use a browser and show that the delete commands' effect
- http://host:port/management/domain/resources/jdbc-connection-pool
- http://host:port/management/domain/configs/config/c1-config/iiop-service/iiop-listener
- http://host:port/management/domain/resources/connector-connection-pool
Stop and delete the instances. On node1:
asadmin stop-instance in1
asadmin stop-instance in2
asadmin delete-local-instance in1
Mention that the second command here stops an instance on a remote node. On node2:
asadmin stop-local-instance in3
asadmin --host node1 --port 4848 delete-local-instance in2
asadmin --host node1 --port 4848 delete-local-instance in3
Delete the cluster and stop the domain. On node1:
asadmin delete-cluster c1
asadmin stop-domain
|