Uploaded image for project: 'JBoss A-MQ'
  1. JBoss A-MQ
  2. ENTMQ-581

A broker that shuts down as part of loosing its persistence store is not unregistered from Zookeeper.

    XMLWordPrintable

Details

    • Hide

      Using Fabric deploy two broker containers that both use the same config:

      broker.xml
      <beans
        xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
        http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
      
          <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
              <property name="properties">
                  <bean class="org.fusesource.mq.fabric.ConfigurationProperties"/>
              </property>
          </bean>
      
        <broker useJmx="true" brokerName="jdbcBroker2" restartAllowed="false" xmlns="http://activemq.apache.org/schema/core">
      
          <ioExceptionHandler>
              <jDBCIOExceptionHandler stopStartConnectors="false"/>
          </ioExceptionHandler>
      
          <persistenceAdapter>
            <jdbcPersistenceAdapter dataSource="#mysql-ds" lockKeepAlivePeriod="1000">
              <locker>
                <lease-database-locker lockAcquireSleepInterval="2000"/>
              </locker>
            </jdbcPersistenceAdapter>
          </persistenceAdapter>
      
          <transportConnectors>
             <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
          </transportConnectors>
        </broker>
      
        <!-- MySql DataSource Sample Setup -->
        <bean id="mysql-ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
          <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
          <property name="url" value="jdbc:mysql://localhost/activemq?relaxAutoCommit=true"/>
          <property name="username" value="root"/>
          <property name="password" value=""/>
          <property name="maxActive" value="200"/>
          <property name="poolPreparedStatements" value="true"/>
        </bean>
      </beans>
      
      org.fusesource.mq.fabric.server-broker.properties
      connectors=openwire
      broker-name=amq-jdbc
      config=zk\:/fabric/configs/versions/1.2/profiles/amq-jdbc/broker.xml
      group=masterSlaveTest
      standby.pool=default
      
      • Watch the master broker connecting to the database and the slave broker trying to lock the Zookeeper node.
      • run a cluster-list to verify the setup is correct
      • Kill the underlying database and see the master broker shutting down
      • run a cluster-list again and note the master remains registered in Zookeeper
      • restart the underlying db. Note that no broker becomes the master
      Show
      Using Fabric deploy two broker containers that both use the same config: broker.xml <beans xmlns= "http: //www.springframework.org/schema/beans" xmlns:xsi= "http: //www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http: //www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http: //activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd"> <bean class= "org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" > <property name= "properties" > <bean class= "org.fusesource.mq.fabric.ConfigurationProperties" /> </property> </bean> <broker useJmx= " true " brokerName= "jdbcBroker2" restartAllowed= " false " xmlns= "http: //activemq.apache.org/schema/core" > <ioExceptionHandler> <jDBCIOExceptionHandler stopStartConnectors= " false " /> </ioExceptionHandler> <persistenceAdapter> <jdbcPersistenceAdapter dataSource= "#mysql-ds" lockKeepAlivePeriod= "1000" > <locker> <lease-database-locker lockAcquireSleepInterval= "2000" /> </locker> </jdbcPersistenceAdapter> </persistenceAdapter> <transportConnectors> <transportConnector name= "openwire" uri= "tcp: //0.0.0.0:61616" /> </transportConnectors> </broker> <!-- MySql DataSource Sample Setup --> <bean id= "mysql-ds" class= "org.apache.commons.dbcp.BasicDataSource" destroy-method= "close" > <property name= "driverClassName" value= "com.mysql.jdbc.Driver" /> <property name= "url" value= "jdbc:mysql: //localhost/activemq?relaxAutoCommit= true " /> <property name= "username" value= "root" /> <property name= "password" value=""/> <property name= "maxActive" value= "200" /> <property name= "poolPreparedStatements" value= " true " /> </bean> </beans> org.fusesource.mq.fabric.server-broker.properties connectors=openwire broker-name=amq-jdbc config=zk\:/fabric/configs/versions/1.2/profiles/amq-jdbc/broker.xml group=masterSlaveTest standby.pool= default Watch the master broker connecting to the database and the slave broker trying to lock the Zookeeper node. run a cluster-list to verify the setup is correct Kill the underlying database and see the master broker shutting down run a cluster-list again and note the master remains registered in Zookeeper restart the underlying db. Note that no broker becomes the master

    Description

      Deploying a master/slave broker pair that uses JDBC persistence via Fabric. Both broker instances use the same broker name and group name and this JDBC config:

          <ioExceptionHandler>
              <jDBCIOExceptionHandler stopStartConnectors="false"/>
          </ioExceptionHandler>
      
          <persistenceAdapter>
            <jdbcPersistenceAdapter dataSource="#mysql-ds" lockKeepAlivePeriod="1000">
              <locker>
                <lease-database-locker lockAcquireSleepInterval="2000"/>
              </locker>
            </jdbcPersistenceAdapter>
          </persistenceAdapter>
      

      If the underlying database is shut down, the master broker shuts down. However it does not un-register from Zookeeper. As a result no instance will become the master when the database has been brought up again. The previous master broker has shut down and will not be attempted to be restarted. The slave broker still waits to lock the Zookeeper node (based on the broker name) which remains in use by the master broker (that has shut down).

      The only workaround is to manually stop the master broker container or at least stop the mq-fabric bundle on the master broker container.

      Attachments

        1. dump.txt
          58 kB
        2. dump-rc2.txt
          62 kB

        Activity

          People

            ikanello1@redhat.com Ioannis Kanellos
            rhn-support-tmielke Torsten Mielke
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: