3 Replies Latest reply on Nov 21, 2007 10:33 AM by Brian Stansberry

    HASingleton-problem on >2 nodes

    Michael Sorg Newbie

      Up to now I've used 2 jboss-instances (4.0.5) where one special service has been configured as a hasingleton. I've never had any problem with it, everything worked fine.
      But now my infrastructure has changed: I have 3 additional machines in the cluster but the mentioned special service should still run on one of two dedicated machines (due to load-balancing-purposes).

      Let's say the different 'jbosses' on my machines are named A, B, C, D and E, machine A and B are the ones which are prepared to run the HASingleton-service

      Now very strange behaviour occurs:
      1.) The HASingleton-service will only be started if A or B are booted first. If e.g. 'C' is booted first and 'A' afterwards the HASingleton will not be started
      2.) If I boot with sequence 'A-B-C' and stop 'A' afterwards 'B' will not start the HASingleton. But if I stop 'C' too, 'B' starts the HASingleton immediately - although 'C' is not configured for HASingleton.

      Now my questions:
      Did I misunderstood the concept of HASingleton? Is it necessary to configure each jboss in the cluster for HASingleton (means: deploy my Singleton-Service in 'deploy-hasingleton' on each machine)? In this case HASingleton would not fulfill my requirements and I have to find another solution
      Or is just some additional configuration necessary to make this scenario working?

      Thanks in advance,


        • 1. Re: HASingleton-problem on >2 nodes
          Brian Stansberry Master

          Please describe exactly how you are deploying your singleton. I can guess from what you wrote, but I want to be sure.

          My guess is that you packaged your singleton code in a sar and in the sar's jboss-service.xml included an mbean for your service and an mbean for an HASingletonController to control your service. Then you deployed the sar in deploy/ on A and B.

          If that's what you did, it should work the way you want, and if it doesn't we need to investigate why not.

          • 2. Re: HASingleton-problem on >2 nodes
            Michael Sorg Newbie

            I did it exactly the way you guessed. The only difference is that I deployed the sar in 'deploy-hasingleton/'.
            The descriptor 'deploy-hasingleton-service.xml' is present in 'deploy'

            • 3. Re: HASingleton-problem on >2 nodes
              Brian Stansberry Master

              Put it in deploy, not deploy-hasingleton. Only one server in the cluster will even look at the contents of deploy-hasingleton, and if that server isn't one of the ones you want your service will not get deployed.

              The deploy-hasingleton dir allows you to deploy stuff like ears, wars, ejb jars etc as singletons. With those types of things you can't directly specify an HASingletonController mbean to manage invoking a "startSingleton" and "stopSingleton" method on the deployment. So instead we wrote a service that will do an ordinary deployment of the contents of deploy-hasingleton only on the master node.

              You're deploying an mbean, which gives you flexibility to do it the way I described. Put your sar in deploy on A and B.