Skip to content

Instantly share code, notes, and snippets.

@jcrossley3
Created January 24, 2012 16:55
Show Gist options
  • Save jcrossley3/1671112 to your computer and use it in GitHub Desktop.
Save jcrossley3/1671112 to your computer and use it in GitHub Desktop.
Simulated clustering

To test clustering using a single JBoss instance on a single server, use the properties jboss.node.name, jboss.server.data.dir, and jboss.socket.binding.port-offset

In one shell, run

$JBOSS_HOME/bin/standalone.sh --server-config=standalone-ha.xml -Djboss.node.name=one -Djboss.server.data.dir=/tmp/one

In another, run

$JBOSS_HOME/bin/standalone.sh --server-config=standalone-ha.xml -Djboss.node.name=two -Djboss.server.data.dir=/tmp/two -Djboss.socket.binding.port-offset=100

Run as many as you like, providing unique values for the name, data directory and port offset to each one.

Now deploy your app as you normally would. All JBoss instances should pick it up. An unfortunate side effect of this technique is that deployed apps will bounce each time you bring up a new server, but that’s hopefully a minor inconvenience.

@wolfc
Copy link

wolfc commented Feb 2, 2012

You'll still have a conflict on jboss.server.log.dir. Maybe it's better to set jboss.server.base.dir.

@jcrossley3
Copy link
Author

Thanks, Carlo, but j.s.base.dir presents other challenges, mostly around convenient deployment, since there is now one deployments/ dir per instance, and the immutant/torquebox deployment tools don't honor j.s.base.dir. Perhaps they should, but even so, I like being able to deploy once, ala a poor-man's "domain mode". Besides, I kinda like the single, common server.log file. I was a little surprised it worked, tbh, but I see messages from each server in there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment