Chanchal Kumar writes:
It can be embarrassing to give your supposedly distributable code to the test team to let them throw it in a cluster only to see it explode. For such moments, its pretty handy that you, at least, run a smoke test to prove that your code is indeed cluster-safe.
And the best part is that it doesn't even take 5 minutes to do so for Glassfish / Sailfin to setup a simple cluster configuration on your local machine. Here's how (the commands are self-explanatory, if you need details chip in a line and I shall get back):
$> ant -f setup-gt; ant -f setup-gt; ant -f setup-gt; ant -f setup-gt; ant -f setup-gt; ant -f setup-cluster.xml
$> asadmin start-domain
$> asadmin create-cluster myCluster
$> asadmin create-node-agent myNodeAgent
$> asadmin create-instance --nodeagent myNodeAgent --cluster myCluster firstInstance
$> asadmin create-instance --nodeagent myNodeAgent --cluster myCluster secondInstance
$> asadmin start-node-agent myNodeAgent
$> asadmin deploy --target myCluster myClusterSafeApp.ear
For a quick primer before trying out some real life clustering beyond your development environment, please read this nice guide.