activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MQ Newbie <su...@sphsearch.sg>
Subject Slave automatically switch to Master even though Master is up
Date Fri, 28 Dec 2007 08:27:28 GMT

Hi,

I started the Master broker followed by the Slave broker. Everything was
running fine at the beginning but I don;t understand how the Slave could
took over as Master even the Master broker is up. Please help.

See logs before and after ****** :


I have used the following configuration:

Master:
======

 <broker xmlns="http://activemq.org/config/1.0" brokerName="mq01">
  
    <!-- Destination specific policies using destination names or wildcards
-->
    <destinationPolicy>
      <policyMap>
        <policyEntries>

          <policyEntry topic="FOO.>" producerFlowControl="false"
memoryLimit="1mb">
            <dispatchPolicy>
              <strictOrderDispatchPolicy/>
            </dispatchPolicy>
            <subscriptionRecoveryPolicy>
              <lastImageSubscriptionRecoveryPolicy/>
            </subscriptionRecoveryPolicy>
          </policyEntry>

        </policyEntries>
      </policyMap>
    </destinationPolicy>


    <!-- The transport connectors ActiveMQ will listen to -->
    <transportConnectors>
       <transportConnector name="openwire" uri="tcp://mq01:61616"
discoveryUri="multicast://default"/>
    </transportConnectors>


    <!-- Or if you want to use pure JDBC without a journal -->
    <persistenceAdapter>
        <jdbcPersistenceAdapter dataSource="#mysql-ds"/>
    </persistenceAdapter>
   
    <!--  Use the following to set the broker memory limit
	<systemUsage>
	            <systemUsage>
		            <memoryUsage>
	    	            	<memoryUsage limit="10 mb" percentUsageMinDelta="20"/>
		            </memoryUsage>
		            <tempUsage>
	    	            	<tempUsage limit="100 mb"/>
		            </tempUsage>
		            <storeUsage>
	    	            	<storeUsage limit="1 gb" name="foo"/>
		            </storeUsage>
	            </systemUsage>
	    </systemUsage>
   -->
    
    <!-- Use the following to configure how ActiveMQ is exposed in JMX
    <managementContext>
       <managementContext connectorPort="1099"
jmxDomainName="org.apache.activemq"/>
    </managementContext>
    -->

  </broker>

  <!-- lets create a command agent to respond to message based admin
commands on the ActiveMQ.Agent topic -->
  <commandAgent xmlns="http://activemq.org/config/1.0"/>


  <!-- An embedded servlet engine for serving up the Admin console -->
  <jetty xmlns="http://mortbay.com/schemas/jetty/1.0">
    <connectors>
      <nioConnector port="8161" />
    </connectors>

    <handlers>
      <webAppContext contextPath="/admin"
resourceBase="${activemq.base}/webapps/admin" logUrlOnStart="true" />
      <webAppContext contextPath="/demo"
resourceBase="${activemq.base}/webapps/demo" logUrlOnStart="true" />
    </handlers>
  </jetty>



  <!-- 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://mqdb/activemq?relaxAutoCommit=true"/>
    <property name="username" value="activemq"/>
    <property name="password" value="activemq"/>
    <property name="poolPreparedStatements" value="true"/>
  </bean>



Slave:
=====

  <broker xmlns="http://activemq.org/config/1.0" brokerName="mq02"
masterConnectorURI="tcp://192.168.30.123:61616"
shutdownOnMasterFailure="false" >
  
    <!-- Destination specific policies using destination names or wildcards
-->
    <destinationPolicy>
      <policyMap>
        <policyEntries>

          <policyEntry topic="FOO.>" producerFlowControl="false"
memoryLimit="1mb">
            <dispatchPolicy>
              <strictOrderDispatchPolicy/>
            </dispatchPolicy>
            <subscriptionRecoveryPolicy>
              <lastImageSubscriptionRecoveryPolicy/>
            </subscriptionRecoveryPolicy>
          </policyEntry>

        </policyEntries>
      </policyMap>
    </destinationPolicy>


    <!-- The transport connectors ActiveMQ will listen to -->
    <transportConnectors>
       <transportConnector name="openwire" uri="tcp://mq02:61616"
discoveryUri="multicast://default"/>
    </transportConnectors>

 
    <!-- Or if you want to use pure JDBC without a journal -->
    <persistenceAdapter>
        <jdbcPersistenceAdapter dataSource="#mysql-ds"/>
    </persistenceAdapter>
   
    <!--  Use the following to set the broker memory limit
	<systemUsage>
	            <systemUsage>
		            <memoryUsage>
	    	            	<memoryUsage limit="10 mb" percentUsageMinDelta="20"/>
		            </memoryUsage>
		            <tempUsage>
	    	            	<tempUsage limit="100 mb"/>
		            </tempUsage>
		            <storeUsage>
	    	            	<storeUsage limit="1 gb" name="foo"/>
		            </storeUsage>
	            </systemUsage>
	    </systemUsage>
   -->
    
    <!-- Use the following to configure how ActiveMQ is exposed in JMX
    <managementContext>
       <managementContext connectorPort="1099"
jmxDomainName="org.apache.activemq"/>
    </managementContext>
    -->

  </broker>

  <!-- lets create a command agent to respond to message based admin
commands on the ActiveMQ.Agent topic -->
  <commandAgent xmlns="http://activemq.org/config/1.0"/>


  <!-- An embedded servlet engine for serving up the Admin console -->
  <jetty xmlns="http://mortbay.com/schemas/jetty/1.0">
    <connectors>
      <nioConnector port="8161" />
    </connectors>

    <handlers>
      <webAppContext contextPath="/admin"
resourceBase="${activemq.base}/webapps/admin" logUrlOnStart="true" />
      <webAppContext contextPath="/demo"
resourceBase="${activemq.base}/webapps/demo" logUrlOnStart="true" />
    </handlers>
  </jetty>



  <!-- 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://mqdb/activemq?relaxAutoCommit=true"/>
    <property name="username" value="activemq"/>
    <property name="password" value="activemq"/>
    <property name="poolPreparedStatements" value="true"/>
  </bean>



LOGS

Master:
======

ACTIVEMQ_HOME: /usr/app/apache-activemq-5.0.0
ACTIVEMQ_BASE: /usr/app/apache-activemq-5.0.0
Loading message broker from: xbean:activemq.xml
INFO  BrokerService                  - Using Persistence Adapter:
JDBCPersistenceAdaptor(org.apache.commons.dbcp.BasicDataSource@4c221e9e)
INFO  BrokerService                  - ActiveMQ 5.0.0 JMS Message Broker
(mq01) is starting
INFO  BrokerService                  - For help or more information please
see: http://activemq.apache.org/
INFO  ManagementContext              - JMX consoles can connect to
service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
INFO  JDBCPersistenceAdapter         - Database driver recognized:
[mysql-ab_jdbc_driver]
INFO  DefaultDatabaseLocker          - Attempting to acquire the exclusive
lock to become the Master broker
INFO  DefaultDatabaseLocker          - Becoming the master on dataSource:
org.apache.commons.dbcp.BasicDataSource@4c221e9e
INFO  TransportServerThreadSupport   - Listening for connections at:
tcp://mq01:61616
INFO  TransportConnector             - Connector openwire Started
INFO  BrokerService                  - ActiveMQ JMS Message Broker (mq01,
ID:sgjms01.sphsearch.com-39105-2019326477811-0:0) started
WARN  BrokerRegistry                 - Broker localhost not started so using
mq01 instead
INFO  TransportConnector             - Connector vm://localhost Started
INFO  log                            - Logging to
org.slf4j.impl.JCLLoggerAdapter(org.mortbay.log) via
org.mortbay.log.Slf4jLog
INFO  log                            - jetty-6.1.4
INFO  WebConsoleStarter              - ActiveMQ WebConsole initialized.
INFO  /admin                         - Initializing Spring FrameworkServlet
'dispatcher'
INFO  log                            - ActiveMQ Console at
http://0.0.0.0:8161/admin
INFO  log                            - ActiveMQ Web Demos at
http://0.0.0.0:8161/demo
INFO  log                            - Started
SelectChannelConnector@0.0.0.0:8161
******
INFO  TransportConnection            - Slave Broker mq02 is attached



Slave
=====

ACTIVEMQ_HOME: /usr/app/apache-activemq-5.0.0
ACTIVEMQ_BASE: /usr/app/apache-activemq-5.0.0
Loading message broker from: xbean:activemq.xml
INFO  BrokerService                  - Using Persistence Adapter:
JDBCPersistenceAdaptor(org.apache.commons.dbcp.BasicDataSource@51f6f27b)
INFO  BrokerService                  - ActiveMQ 5.0.0 JMS Message Broker
(mq02) is starting
INFO  BrokerService                  - For help or more information please
see: http://activemq.apache.org/
INFO  ManagementContext              - JMX consoles can connect to
service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
INFO  JDBCPersistenceAdapter         - Database driver recognized:
[mysql-ab_jdbc_driver]
******
INFO  DefaultDatabaseLocker          - Attempting to acquire the exclusive
lock to become the Master broker
INFO  DefaultDatabaseLocker          - Becoming the master on dataSource:
org.apache.commons.dbcp.BasicDataSource@51f6f27b
INFO  TransportServerThreadSupport   - Listening for connections at:
tcp://mq02:61616
INFO  TransportConnector             - Connector openwire Started
INFO  TransportConnector             - Connector vm://mq02 Started
INFO  MasterConnector                - Starting a network connection between
vm://mq02#0 and tcp://null:0 has been established.
INFO  BrokerService                  - ActiveMQ JMS Message Broker (mq02,
ID:sgjms02.sphsearch.com-41158-1198828853013-1:0) started
INFO  MasterConnector                - Slave connection between vm://mq02#0
and tcp:///mq01:61616 has been established.
WARN  BrokerRegistry                 - Broker localhost not started so using
mq02 instead
INFO  TransportConnector             - Connector vm://localhost Started
INFO  log                            - Logging to
org.slf4j.impl.JCLLoggerAdapter(org.mortbay.log) via
org.mortbay.log.Slf4jLog
INFO  log                            - jetty-6.1.4
WARN  log                            - Can't reuse
/tmp/Jetty_0_0_0_0_8161_admin__admin__9l5s6p, using
/tmp/Jetty_0_0_0_0_8161_admin__admin__9l5s6p_59761
INFO  WebConsoleStarter              - ActiveMQ WebConsole initialized.
INFO  /admin                         - Initializing Spring FrameworkServlet
'dispatcher'
INFO  log                            - ActiveMQ Console at
http://0.0.0.0:8161/admin
WARN  log                            - Can't reuse
/tmp/Jetty_0_0_0_0_8161_demo__demo__uj3swb, using
/tmp/Jetty_0_0_0_0_8161_demo__demo__uj3swb_59762
INFO  log                            - ActiveMQ Web Demos at
http://0.0.0.0:8161/demo
INFO  log                            - Started
SelectChannelConnector@0.0.0.0:8161



-- 
View this message in context: http://www.nabble.com/Slave-automatically-switch-to-Master-even-though-Master-is-up-tp14523353s2354p14523353.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message