• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to test the failover in a cluster?  RSS feed

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I configured a cluster with 2 Jboss nodes. And I wrote a simple WebService which just printout "Hello World". I deploy this WebService on the nodes.

Assumed calling the WebService is as follow:
http://node1_addr:8080/TestWebService/
and
http://node2_addr:8080/TestWebService/

Now I stop the node1 and try to call up the WebService at node1 with
http://node1_addr:8080/TestWebService/.

I hope this will change over to node2 since they are clustered. But I get error.

What could be wrong?
 
author
Bartender
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are missing the load balancer. What you are doing right now is sending requests to individual servers. What you really want to do is send your requests to a load balancer and let it decide to which app server instance to forward the request.

This should get you started: http://community.jboss.org/wiki/usingmodjk12withjboss
 
Thomas Chang
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So far I understood, load-balancing and clustering are two different things.

I don't want to test the load-balancing since I know how to test it. I just want to test the clustering.

Maybe what I am doing now is wrong. But how can I test the clustering?

I read this article (http://docs.jboss.org/jbossas/jboss4guide/r4/html/cluster.chapt.html). I thought after I added <distributable/> in web.xml I can test the clustering in the way I mentioned earlier.

Regards
 
Peter Johnson
author
Bartender
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are correct in that you can use load balancing without clustering - each app server could work on its own. However, for clustering to work, you need a single point of entry that distributes the load among the cluster - it is this "distributer" that understand the layout of the cluster and provides a single point of entry to the cluster to the clients. And it is this distributor that handles the situation of a server going down and automatically routes traffic to the running servers.

The other possibility is that each client needs to be aware of the cluster and automatically route requests to another server in the cluster if the originally selected server is non responding. In your example, the client that used http://node1_addr:8080, on seeing that node1_addr was down should then try node2_addr. (I recall doing something like this many years ago with a load test client that I wrote.)
 
Thomas Chang
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Peter,

I think you should be one of the authors of the book "jboss in action"? I read the Chapter 12.2.2 "Creating a clustered EJB" and wrote the program. I can test the program locally, that means I start the JBoss locally on my PC and deploy the ejbonto this Jboss. But later as I deployed the ejb to a remote JBoss AS on the LINUX machine and try to run the Client against the remote ejb, I got following errors, though I've set the 'java.naming.provider.url' with the remote IP.

What could e the reason?

 
Peter Johnson
author
Bartender
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Double-check the JNDI tree to see how the bean was registered. This will help: http://community.jboss.org/wiki/DisplayTheJNDITreeWithTheJMXConsole
 
Thomas Chang
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter Johnson wrote:Double-check the JNDI tree to see how the bean was registered. This will help: http://community.jboss.org/wiki/DisplayTheJNDITreeWithTheJMXConsole


Thanks.

The JNDI is ok. It's the problem of firewall. The firewall blocks the communication between the two machines. It's solved now.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!