13.2.15

Playing with the JBoss Examples


Last week I got a chance to learn how JBOSS Architecture fits together when scaling it out.  It looks a little like this.

Jboss uses Infinispan, roughly, as a distributed, lazy cache for sessions.  In the above diagram, we visualize the fact that JGroups and Infinispan are the core peices of technology that determine the topology of JBoss at scale.  JBoss scaling can be done via "domain" mode, or standalone-ha mode.  For cloud deployments, standalone-ha is the prefered methodology.  There are multiple ways to coordinate JGroups so that JBoss can cluster without using multicast (which often is not possible in cloud environments).

 Some good links for understanding JBoss scaling.


Getting started with JBOSS blueprint apps, locally.

Given that I work at Red Hat, even though I generally spend most of my time on BigData projects, it's always nice to sample some of our other open source goodies, and having done alot of JSP/Servlet development in the past, I was delighted when I recently found out how easy it is to play around with the JBoss blueprint applications.  There are almost 40 great demost of the JBoss ecosystem which you can easily get started with.  Here's how I started trying out the different blueprints.
  1. Download the jboss jar http://www.jboss.org/download-manager/file/jboss-eap-6.3.0.GA-installer.jar
  2.  Run it! java -jar jboss-eap-3.6.0.jar.  It walks you through I nice little UI for setting up your server, initializing mvn repos , and so on.
  3. Make sure 8080 isnt being used by anything. netstat -tupln | grep 8080
  4. You will see a splash screen, just go through the defaults.
  5. Now, go to localhost:8080.  You'll see an EAP server.
  6. git clone all the blueprints :  https://github.com/jboss-developer/jboss-wfk-quickstarts/ 
  7. git checkout 2.7.x-develop (change to the dev branch w/ the latest code)
  8. Now this is the fun part. Just cd to one of the dirs (i.e. cd contacts-mobile-basic) 
  9. run: "mvn clean package jboss-as:deploy" (this goal assumes localhost deployment)
Note that on the left, I have opened a tmux pane with /home/jay/EAP-6.3.0/jboss-eap-6.3/bin/jboss-cli.sh running.  That client gives you a nice way to run commands for deploy/undeploy of apps, etc.  Of course, a similar view can be seen via localhost:8080 when you deploy.

After playing around with JBoss, to scale it in a cloud based environment, I'd highly suggest this video, which details some of the finer points around JGroups, Infinispan, and Standalone clustering.

Finally, as an example of how to test standalone distributed servers locally, you simply.
  1. Kill all jboss processes (you can find them with jps).
  2. Clean out directories if there are any old stuff in your data/ directory from starting standalone.
  3. Create a seconds standalone-ha.xml file, which has the  changes (shown below in the image... basically, we modify it to bind to the public IP instead of the private IP, so that there are no collisions).
  4. Start both jboss instances.
    1.  bin/standalone.sh --server-config=standalone-ha.xml -Djboss.server.data.dir=standalone/data1
    2.  bin/standalone.sh --server-config=standalone2-ha.xml -Djboss.server.data.dir=standalone/data2
When creating standalone2-ha.xml, just replace the IP Addresses above with your public IP.  In my case it was 10.18.....

At some point when I circle back around to this,  I will get clustering fully functional in this distributed local mode, and I will update this post.  For now this should be a good start for anyone interested in getting a JBoss clustered mode deployment working without using "domain" mode, and instead using standalone-ha mode.

Links

Advanced JBoss in the Cloud (standalone, MapReduce, and infinispan details). Video. 

4 ways to enable JGroups discovery for standalone mode clustering. (presentation)


No comments:

Post a Comment