You can perform the following steps using a single asadmin command, create-converged-lb.
Create a load balancer configuration.
Use the asadmin create-converged-lb-config command.
Add a reference to a cluster or stand-alone server instance for the load balancer to manage.
Use the asadmin create-converged-lb-ref command.
While you perform the iterative process of setting up and defining the cluster deployment, it is recommended that --autocommit be set to false. By default, this option is set to false, primarily to prevent generation of intermediate converged load balancer files, which would get generated for every change in domain.xml, which impact the converged load balancer's view of its configuration. After the cluster deployment definition has reached a stable point in evolution, set --autocommit to true.
The following series of asadmin commands sets up a cluster, a node agent, and a self-load-balanced converged load balancer.
asadmin> create-cluster cluster1 Command create-cluster executed successfully. asadmin>create-node-agent --user admin --passwordfile pass.txt --host host1 nodeagent1 Command create-node-agent executed successfully. asadmin>create-node-agent --user admin --passwordfile pass.txt --host host1 nodeagent2 Command create-node-agent executed successfully. asadmin>create-instance --user admin --passwordfile pass.txt --nodeagent nodeagent1 --cluster cluster1 cluster1_instance1 Command create-instance executed successfully. asadmin> create-instance --user admin --passwordfile pass.txt --nodeagent nodeagent2 --cluster cluster1 cluster1_instance2 Command create-instance executed successfully. asadmin> create-converged-lb --user admin --passwordfile pass.txt --configfile clb.xml --autocommit=true --lbenableallinstances=true --target cluster1 clb-1 Command create-converged-lb executed successfully. asadmin> start-node-agent nodeagent1 Command start-node-agent started successfully. asadmin> start-node-agent nodeagent2 Command start-node-agent started successfully. asadmin> start-cluster cluster1 cluster1_instance1 is running, does not require restart cluster1_instance2 is running, does not require restart Command start-cluster executed successfully. |
If the cluster was already started when you created the load balancer, you must restart the cluster to start the load balancer.
For more information about these asadmin commands, see the Sun GlassFish Communications Server 2.0 Reference Manual.