8 Replies Latest reply on Oct 20, 2004 10:56 AM by afshanz

    Cluster node count

    monu

      Hi,

      I need the number of nodes in the cluster at runtime(server count) also other information like ip address of the nodes.

      I need the above information when the server is started for the first time and when any node is added or deleted from the cluster.

      Let me know if there is any API availabe for getting the above information.

      Thanks in advance,
      Monu



        • 1. Re: Cluster node count
          slaboure

          yes, check the HAPartition (see doc) in org.jboss.ha.framework.server.ClusterPartition and its associated MBean (visible through the jmx-console)

          sacha

          • 2. Re: Cluster node count
            xibin

            I could not find it through the jmx-console. Could you point out to me which entry it is?

            I have started a 2 node cluster and the startup output says "Number of cluster members: 2" so I am pretty sure the cluster is started. I can't find the mbean entry from the jmx-console to actually check that I have two nodes.

            • 3. Re: Cluster node count
              slaboure

              http://localhost:8080/jmx-console

              => mbean = jboss:service=DefaultPartition

              check the attribute "CurrentView", you will see the list of current members


              sacha

              • 4. Re: Cluster node count
                xibin

                There is no attribute CurrentView under jboss:service=DefaultPartition.

                I see the following attributes in this mbean

                PartitionProperties
                HAPartition
                PartitionName
                State
                DeadlockDetection
                Name
                PartitionConfig

                Maybe I need a newer version of JBoss? I currently have jboss-3.2.0_tomcat-4.1.24.

                Thanks!

                • 5. Re: Cluster node count
                  vakrishnan

                  I am interested in the exact same problem. I want to programatically determine the number of active nodes in the cluster, as well as the IP address of the nodes.

                  I checked v3.2 and v3.06, and could not find the CurrentView property.

                  Also, Is it possible to write an interceptor such that a class I define gets notified each time the group membership changes?

                  • 6. Re: Cluster node count
                    vakrishnan

                    Sorry, I should have read the entire conversation before making the post.

                    I only need to implement HAMembershipListener and register it.

                    • 7. Re: Cluster node count
                      xibin

                      Just to complete the note: what I had to do was get the attribute HAPartition from MBean "jboss:service=defaultPartition". From the HAPartition object, you can call getCurrentView() and also subscribe HAMembershipChangeListener.

                      I hope this helps somebody else who is trying to achieve the same thing.

                      Xibin Zeng

                      • 8. Re: Cluster node count
                        afshanz

                        Hi,
                        I would like to know how to register to HAParatition through HAMembershipListener? could you please give an example?

                        Thanks