I've recently setup ActiveMQ 5.4.2 in a JDBC Master-Slave sandbox configuration 
on localhost (CentOS 5.4 i686) with Java(TM) SE Runtime Environment (build 
1.6.0_14-b08). The JDBC driver is mysql-connector-java-5.1.14-bin.jar. The 
database is mysql-server-5.0.77-4.el5_4.2.

It becomes master, but never registers it's brokerName in the database. I can 
submit persistent messages and the successfully get logged in ACTIVEMQ_MSGS. 
The entire schema was created automatically by ActiveMQ. 

2010-12-17 20:34:51,793 | INFO  | Attempting to acquire the exclusive lock to 
become the Master broker | org.apache.activemq.store.jdbc.DefaultDatabaseLocker 
| main
2010-12-17 20:34:51,810 | INFO  | Becoming the master on dataSource: 
org.apache.commons.dbcp.basicdatasou...@3b1f38 | 
org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main

mysql> select * from ACTIVEMQ_LOCK;
+----+------+-------------+
| ID | TIME | BROKER_NAME |
+----+------+-------------+
|  1 | NULL | NULL        | 
+----+------+-------------+
1 row in set (0.00 sec)

mysql> select count(*) from ACTIVEMQ_MSGS;
+----------+
| count(*) |
+----------+
|     1000 | 
+----------+
1 row in set (0.00 sec)


The brokerName has been set in the running configuration for the <broker/>.
 <broker xmlns="http://activemq.apache.org/schema/core"; 
brokerName="ec2-174-129-179-24.compute-1.amazonaws.com" 
dataDirectory="${activemq.base}/data" destroyApplicationContextOnStop="true" 
persistent="true" useShutdownHook="false" useJmx="true">

I have also tried adding 
-Dactivemq.hostname=ec2-174-129-179-24.compute-1.amazonaws.com to the init 
script, but it doesn't have any affect either.

Complete configuration below.

Any input greatly appreciated!


Erik Osterman
<e...@osterman.com>
http://www.osterman.com





<beans
  xmlns="http://www.springframework.org/schema/beans";
  xmlns:amq="http://activemq.apache.org/schema/core";
  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="locations">
      <value>file:${activemq.base}/conf/credentials.properties</value>
    </property>      
  </bean>

  <broker xmlns="http://activemq.apache.org/schema/core"; 
brokerName="ec2-174-129-179-24.compute-1.amazonaws.com" 
dataDirectory="${activemq.base}/data" destroyApplicationContextOnStop="true" 
persistent="true" useShutdownHook="false" useJmx="true">
    <managementContext>
      <managementContext createConnector="false"/>
    </managementContext>

    <networkConnectors>
      <networkConnector uri="multicast://default"/>
    </networkConnectors>


    <persistenceAdapter>
      <jdbcPersistenceAdapter dataDirectory="${activemq.base}/data" 
dataSource="#mysql-ds" />
    </persistenceAdapter>

    <plugins>
      <statisticsBrokerPlugin/>
    </plugins>
        
    <systemUsage>
      <systemUsage>
        <memoryUsage>
          <memoryUsage limit="20 mb"/>
        </memoryUsage>
        <storeUsage>
          <storeUsage limit="1 gb"/>
        </storeUsage>
        <tempUsage>
          <tempUsage limit="100 mb"/>
        </tempUsage>
      </systemUsage>
    </systemUsage>
  
    <transportConnectors>
      <!-- <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/> -->
      <transportConnector name="stomp" 
uri="stomp://0.0.0.0:61612?transport.closeAsync=false"/> 
      <transportConnector name="stomp+nio" 
uri="stomp+nio://0.0.0.0:61613?transport.closeAsync=false"/> 
    </transportConnectors>

  </broker>

  <import resource="jetty.xml"/>

  <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="activemq"/>
    <property name="password" value="activemq"/>
    <property name="maxActive" value="200"/>
    <property name="poolPreparedStatements" value="true"/>
  </bean>
 
</beans>





Reply via email to