9 Replies Latest reply on May 27, 2009 11:34 AM by israelalcazar

    Only one scheduler across all nodes in the cluster

    jimmymani

      hi,
      how can we configure schedulers ,so that it will execute only in one node.
      when that node goes down ,scheduler should start running in another node.

      my current configuration in scheduler-servic.xml //for each node

      <mbean code="org.jboss.varia.scheduler.Scheduler"
       name="Order:service=Scheduler">
       <attribute name="StartAtStartup">true</attribute>
       <attribute name="SchedulableClass">org.jboss.scheduler.OrderUpdateScheduler</attribute>
       <attribute name="InitialStartDate">NOW</attribute>
       <attribute name="SchedulePeriod">20000</attribute>
       <attribute name="InitialRepetitions">-1</attribute>
       </mbean>
      


      please let me know what changes i have to do on this.
      Jboss version-4.2.2
      Jimmy

        • 1. Re: Only one scheduler across all nodes in the cluster
          brian.stansberry

          Add

          <depends>jboss.ha:service=HASingletonDeployer,type=Barrier</depends>


          to your Scheduler's mbean config.

          See http://wiki.jboss.org/wiki/Wiki.jsp?page=HASingletonDeployer, " HASingleton Deployments Using a Barrier" for background on what that does.

          • 2. Re: Only one scheduler across all nodes in the cluster
            jimmymani

            thanks
            its working fine
            new configuration is

            <mbean code="org.jboss.varia.scheduler.Scheduler"
             name="Order:service=Scheduler">
             <depends>jboss.ha:service=HASingletonDeployer,type=Barrier</depends>
             <attribute name="StartAtStartup">true</attribute>
             <attribute name="SchedulableClass">org.jboss.scheduler.OrderUpdateScheduler</attribute>
             <attribute name="InitialStartDate">NOW</attribute>
             <attribute name="SchedulePeriod">20000</attribute>
             <attribute name="InitialRepetitions">-1</attribute>
            
             </mbean>
            


            • 3. Re: Only one scheduler across all nodes in the cluster

              Hi All,

              I am using scheduler in clustered environment.
              Following is jboss-service.xml

              <?xml version="1.0" encoding="UTF-8"?>
              <server>
              <mbean code="org.jboss.varia.scheduler.Scheduler"
               name="com.covad:service=Scheduler">
               <depends>jboss.ha:service=HASingletonDeployer,type=Barrier</depends>
               <attribute name="StartAtStartup">true</attribute>
               <attribute name="SchedulableClass">com.covad.scheduler.HearBeatScheduler</attribute>
               <attribute name="InitialStartDate">NOW</attribute>
               <attribute name="SchedulePeriod">60000</attribute>
               <attribute name="InitialRepetitions">-1</attribute>
               </mbean>
              </server>
              


              I have configured two nodes on two different machines.
              This HeartBeatScheduler class publishes messages on the JMS topic.

              I want only one node to publish the message.But both nodes are publishing the messages.

              I am using Jboss 4.2.1 GA and i am deploying the same .sar in both the machines.

              Please suggest me where i am going wrong.

              Thanks,
              Pavan.

              • 4. Re: Only one scheduler across all nodes in the cluster

                Hi All,

                Please let me know how did you deploy in jboss.

                Is this ***-service.xml is inside .sar or deployed seperately in /deploy folder.

                This is not working for me.Please help me.

                Thanks,
                Pavan.

                • 5. Re: Only one scheduler across all nodes in the cluster
                  brian.stansberry

                  Your XML looks fine. Whether you deploy it packaged in a sar or directly in deploy depends on whether you need to include anything else with the -service.xml. Whichever way you choose shouldn't effect how it works.

                  Are you sure the two nodes are forming a cluster?

                  • 6. Re: Only one scheduler across all nodes in the cluster

                    Hi,

                    Following is the message on my console:

                    10:50:27,533 INFO [TreeCache] viewAccepted(): MergeView::[10.88.192.129:2355|1]
                     [10.88.192.129:2355, 10.88.192.141:1528], subgroups=[[10.88.192.129:2355|0] [10
                    .88.192.129:2355], [10.88.192.141:1528|0] [10.88.192.141:1528]]
                    


                    This tells that they are in cluster right?

                    Let me tell you how i deployed.
                    I have ejb jar file deployed in all/deploy folder in both the nodes.Then i pasted the following code in schedule-service.xml which is inside all/deploy
                    folder.
                    <mbean code="org.jboss.varia.scheduler.ScheduleManager"
                     name="jboss:service=ScheduleManager">
                     <attribute name="StartAtStartup">true</attribute>
                     <attribute name="FixedRate">true</attribute>
                     </mbean>
                    
                     <mbean code="com.covad.scheduler.HearBeatScheduler"
                     name="com.covad:service=HearBeatScheduler">
                     </mbean>
                    
                    
                     <mbean code="org.jboss.varia.scheduler.SingleScheduleProvider"
                     name="jboss:service=SingleScheduleProvider">
                     <depends>jboss.ha:service=HASingletonDeployer,type=Barrier</depends>
                     <depends optional-attribute-name="ScheduleManagerName">jboss:service=ScheduleManager</depends>
                     <depends optional-attribute-name="TargetName">com.covad:service=HearBeatScheduler</depends>
                     <attribute name="TargetMethod">perform()</attribute>
                     <attribute name="DateFormat"></attribute>
                     <attribute name="StartDate">NOW</attribute>
                     <attribute name="Period">10000</attribute>
                     <attribute name="Repetitions">-1</attribute>
                     </mbean>


                    .Did i deploy in the correct way or should i deploy in all/deploy-hasingleton folder?

                    Please help me.

                    Thanks,
                    Pavan.

                    • 7. Re: Only one scheduler across all nodes in the cluster
                      brian.stansberry

                       

                      "tpawankumar" wrote:
                      Hi,

                      Following is the message on my console:
                      10:50:27,533 INFO [TreeCache] viewAccepted(): MergeView::[10.88.192.129:2355|1]
                       [10.88.192.129:2355, 10.88.192.141:1528], subgroups=[[10.88.192.129:2355|0] [10
                      .88.192.129:2355], [10.88.192.141:1528|0] [10.88.192.141:1528]]
                      


                      This tells that they are in cluster right?


                      No, that tells you a service using JBoss Cache formed a cluster; the one you want isn't using JBoss Cache. Look for "New cluster view for partition " in the logs.

                      • 8. Re: Only one scheduler across all nodes in the cluster
                        israelalcazar

                        I'm newby JBoss Admin and I'm trying to make a cluster scheduler similar to your example. This is my jboss-service.xml:

                        <?xml version="1.0" encoding="UTF-8"?>


                        jboss.ha:service=HASingletonDeployer,type=Barrier
                        true
                        mbean.scheduler.Notifier
                        NOW
                        15000
                        -1




                        When I deploy the service in cluster via server\all\farm directory, I obtain the following error message:

                        17:14:46,015 INFO [ClusterFileTransfer] Finished push of file notificador.sar t
                        o cluster.
                        17:14:46,046 ERROR [FarmMemberService] Incomplete Deployment listing:

                        --- MBeans waiting for other MBeans ---
                        ObjectName: ats.mbean.scheduler.notificador:service=Scheduler
                        State: CONFIGURED
                        I Depend On:
                        jboss.ha:service=HASingletonDeployer,type=Barrier



                        I have checked HASingletonDeployer MBean is up in jmx-console......I dont know what is my problem....I would appreciate if you could help me.

                        Thank in advance,

                        • 9. Re: Only one scheduler across all nodes in the cluster
                          israelalcazar

                          Sorry my jboss-service.xml is:

                          <?xml version="1.0" encoding="UTF-8"?>
                          <server>
                           <mbean code="org.jboss.varia.scheduler.Scheduler"
                           name="ats.mbean.scheduler.notificador:service=Scheduler">
                           <depends>jboss.ha:service=HASingletonDeployer,type=Barrier</depends>
                           <attribute name="StartAtStartup">true</attribute>
                           <attribute name="SchedulableClass">mbean.scheduler.Notifier</attribute>
                           <attribute name="InitialStartDate">NOW</attribute>
                           <attribute name="SchedulePeriod">15000</attribute>
                           <attribute name="InitialRepetitions">-1</attribute>
                           </mbean>
                          </server>
                          


                          Thank in advance,