activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ttmdev <joe.fernan...@ttmsolutions.com>
Subject Re: Simple network of brokers + faultPersistenceAdapterFactory - Journal is locked
Date Tue, 31 Jul 2007 14:31:23 GMT

I ran across a similar set of problems when setting up a 3-broker NoB on my
Windows XP machine and addressed it by simply assigning each broker it's own
separate ${activemq.base}. If you don't do that, you end up with a shared
file system Master/Slave configuration.  Here's my configuration:

<broker brokerName="localhost" useJmx="true"
xmlns="http://activemq.org/config/1.0">
  
        
    <!-- Use the following to configure how ActiveMQ is exposed in JMX -->
    <managementContext>
       <managementContext connectorPort="1099"
jmxDomainName="org.apache.activemq"/>
    </managementContext>
   

    <!-- In ActiveMQ 4, you can setup destination policies -->  
    <destinationPolicy>
      <policyMap><policyEntries>
        
          <policyEntry topic="FOO.>">
            <dispatchPolicy>
              <strictOrderDispatchPolicy />
            </dispatchPolicy>
            <subscriptionRecoveryPolicy>
              <lastImageSubscriptionRecoveryPolicy />
            </subscriptionRecoveryPolicy>
          </policyEntry>

      </policyEntries></policyMap>
    </destinationPolicy>  
  
    <persistenceAdapter>
        <journaledJDBC journalLogFiles="5"
dataDirectory="${activemq.base}/activemq-data"/>      
    </persistenceAdapter>
  
    <transportConnectors>
       <transportConnector name="openwire" uri="tcp://localhost:61616"
discoveryUri="multicast://default"/>
       <transportConnector name="ssl"     uri="ssl://localhost:61617"/>
       <transportConnector name="stomp"   uri="stomp://localhost:61613"/>
    </transportConnectors>
    
    <networkConnectors>
      <!-- This broker is going to just listen for other brokers -->     
      <!-- 
       <networkConnector name="default-nc" uri="multicast://default"/>
      -->        
    </networkConnectors>
    
    <plugins>
    
    <!--  use JAAS to authenticate using the login.config file on the
classpath to configure JAAS -->
    <!-- <jaasAuthenticationPlugin configuration="activemq-domain" />  -->   
   
    </plugins>
    
  </broker>  
  
  
  <broker brokerName="localhost2" useJmx="true"
xmlns="http://activemq.org/config/1.0">
  
    <!-- Use the following to configure how ActiveMQ is exposed in JMX -->
    <managementContext>
       <managementContext connectorPort="1098"
jmxDomainName="org.apache.activemq"/>
    </managementContext>
    

    <!-- In ActiveMQ 4, you can setup destination policies -->  
    <destinationPolicy>
      <policyMap><policyEntries>
        
          <policyEntry topic="FOO.>">
            <dispatchPolicy>
              <strictOrderDispatchPolicy />
            </dispatchPolicy>
            <subscriptionRecoveryPolicy>
              <lastImageSubscriptionRecoveryPolicy />
            </subscriptionRecoveryPolicy>
          </policyEntry>

      </policyEntries></policyMap>
    </destinationPolicy>  
  
    <persistenceAdapter>
        <journaledJDBC journalLogFiles="5"
dataDirectory="/tmp/amq-base2/activemq-data"/>      
    </persistenceAdapter>
  
    <transportConnectors>
       <transportConnector name="openwire2" uri="tcp://localhost:61618"
discoveryUri="multicast://default"/>       
    </transportConnectors>
    
    <networkConnectors>      
      <networkConnector name="localhost2"
uri="static://(tcp://localhost:61616)" />      
    </networkConnectors>
    
    <plugins>    
    <!--  use JAAS to authenticate using the login.config file on the
classpath to configure JAAS -->
    <!-- <jaasAuthenticationPlugin configuration="activemq-domain" /> -->    
    </plugins>
    
  </broker>  
  
  
  <broker brokerName="localhost3" useJmx="true"
xmlns="http://activemq.org/config/1.0">
  
    
    <!-- In ActiveMQ 4, you can setup destination policies -->  
    <destinationPolicy>
      <policyMap><policyEntries>
        
          <policyEntry topic="FOO.>">
            <dispatchPolicy>
              <strictOrderDispatchPolicy />
            </dispatchPolicy>
            <subscriptionRecoveryPolicy>
              <lastImageSubscriptionRecoveryPolicy />
            </subscriptionRecoveryPolicy>
          </policyEntry>

      </policyEntries></policyMap>
    </destinationPolicy>
    
     <!-- Use the following to configure how ActiveMQ is exposed in JMX -->
    <managementContext>
       <managementContext connectorPort="1097"
jmxDomainName="org.apache.activemq"/>
    </managementContext>  
  
    <persistenceAdapter>
        <journaledJDBC journalLogFiles="5"
dataDirectory="/tmp/amq-base3/activemq-data"/>      
    </persistenceAdapter>
  
    <transportConnectors>
       <transportConnector name="openwire3" uri="tcp://localhost:61619"
discoveryUri="multicast://default"/>       
    </transportConnectors>
    
    <networkConnectors>           
      <networkConnector name="localhost3"
uri="static://(tcp://localhost:61616)" />          
    </networkConnectors>
    
    <plugins>    
    <!--  use JAAS to authenticate using the login.config file on the
classpath to configure JAAS -->
    <!-- <jaasAuthenticationPlugin configuration="activemq-domain" /> -->    
    </plugins>    
    
  </broker>

Hope this helps,  
Joe


j0llyr0g3r wrote:
> 
> Hey folks, 
> 
> i am really getting desperate with the configuration of a simple network
> of brokers...
> 
> What i wanted to do was:
> 
> - One instance of activeMQ
> - 3 brokers running within that instance
> - 1 Producer and 2 Consumers
> 
> In Ascii:
> 
>                Consumer    Consumer
>                      |              |     
>                 broker_A    broker_C
>                          \        / 
>                            \    /
>                              \/
>                          broker_B
>                               ^
>                               |
>                          Producer
> 
> So i thought the following broker-config.xml would do the trick:
> 
> Broker_B listens on Port 61616 and knows the brokers "A" and "C" which
> should be listening on 61617 and 61618:
> 
> Broker_B:
> 
>   <broker brokerName="broker_B" useJmx="true"
> xmlns="http://activemq.org/config/1.0">
> 
>     <!-- Use the following to configure how ActiveMQ is exposed in JMX -->
>     <managementContext>
>        <managementContext connectorPort="5555"
> jmxDomainName="org.apache.activemq"/>
>     </managementContext>
> 
>     <persistenceAdapter>
>             <journaledJDBC journalLogFiles="5"
> dataDirectory="${activemq.base}/activemq-data/broker_B/"/>
>     </persistenceAdapter>
> 
>     <destinationPolicy>
>       <policyMap><policyEntries>
> 
>           <policyEntry topic="FOO">
>             <dispatchPolicy>
>               <strictOrderDispatchPolicy />
>             </dispatchPolicy>
>             <subscriptionRecoveryPolicy>
>               <lastImageSubscriptionRecoveryPolicy />
>             </subscriptionRecoveryPolicy>
>           </policyEntry>
> 
>       </policyEntries></policyMap>
>     </destinationPolicy>
> 
> 
>     <transportConnectors>
>        <transportConnector  uri="tcp://localhost:61616"
> discoveryUri="multicast://default"/>
>     </transportConnectors>
> 
>     <networkConnectors>
>       <networkConnector 
> uri="static://(tcp://localhost:61617,tcp://localhost:61618)"
> networkTTL="99" />
>     </networkConnectors>
> 
>   </broker>
> 
> 
> Broker_A:
> 
>  <broker brokerName="broker_A" useJmx="true"
> xmlns="http://activemq.org/config/1.0">
> 
>     <!-- Use the following to configure how ActiveMQ is exposed in JMX -->
>     <managementContext>
>        <managementContext connectorPort="4444"
> jmxDomainName="org.apache.activemq"/>
>     </managementContext>
> 
>     <persistenceAdapter>
>             <journaledJDBC journalLogFiles="5"
> dataDirectory="${activemq.base}/activemq-data/broker_A/"/>
>     </persistenceAdapter>
> 
>     <!-- In ActiveMQ 4, you can setup destination policies -->
>     <destinationPolicy>
>       <policyMap><policyEntries>
>           <policyEntry topic="FOO">
>             <dispatchPolicy>
>               <strictOrderDispatchPolicy />
>             </dispatchPolicy>
>             <subscriptionRecoveryPolicy>
>               <lastImageSubscriptionRecoveryPolicy />
>             </subscriptionRecoveryPolicy>
>           </policyEntry>
>       </policyEntries></policyMap>
>     </destinationPolicy>
> 
>     <transportConnectors>
>        <transportConnector  uri="tcp://localhost:61617"
> discoveryUri="multicast://default"/>
>     </transportConnectors>
> 
>     <networkConnectors>
>       <networkConnector  uri="static://(tcp://localhost:61616)" 
> networkTTL="99"/>
>     </networkConnectors>
> 
>   </broker>
> 
> 
> Broker_C: 
> 
>  <broker brokerName="broker_C" useJmx="true"
> xmlns="http://activemq.org/config/1.0">
> 
>     <!-- Use the following to configure how ActiveMQ is exposed in JMX -->
>     <managementContext>
>        <managementContext connectorPort="6666"
> jmxDomainName="org.apache.activemq"/>
>     </managementContext>
> 
>     <persistenceAdapter>
>             <journaledJDBC journalLogFiles="5"
> dataDirectory="${activemq.base}/activemq-data/broker_C/"/>
>     </persistenceAdapter>
> 
>     <!-- In ActiveMQ 4, you can setup destination policies -->
>     <destinationPolicy>
>       <policyMap><policyEntries>
> 
>           <policyEntry topic="FOO">
>             <dispatchPolicy>
>               <strictOrderDispatchPolicy />
>             </dispatchPolicy>
>             <subscriptionRecoveryPolicy>
>               <lastImageSubscriptionRecoveryPolicy />
>             </subscriptionRecoveryPolicy>
>           </policyEntry>
> 
>       </policyEntries></policyMap>
>     </destinationPolicy>
> 
> 
>     <transportConnectors>
> 
>        <transportConnector  uri="tcp://localhost:61618"
> discoveryUri="multicast://default"/>
>     </transportConnectors>
> 
>     <networkConnectors>
>       <networkConnector  uri="static://(tcp://localhost:61616)" 
> networkTTL="99"/>
>     </networkConnectors>
> 
>   </broker>
> 
> Unfortunately, if i try to start to start active-mq via:
> 
> ./activemq
> 
> i get the following output:
> 
> ACTIVEMQ_HOME: /opt/apache-activemq-4.1.1
> ACTIVEMQ_BASE: /opt/apache-activemq-4.1.1
> Loading message broker from: xbean:activemq.xml
> INFO  BrokerService                  - ActiveMQ 4.1.1 JMS Message Broker
> (broker_A) is starting
> INFO  BrokerService                  - For help or more information please
> see: http://incubator.apache.org/activemq/
> INFO  ManagementContext              - JMX consoles can connect to
> service:jmx:rmi:///jndi/rmi://localhost:4444/jmxrmi
> INFO  JDBCPersistenceAdapter         - Database driver recognized:
> [apache_derby_embedded_jdbc_driver]
> INFO  DefaultDatabaseLocker          - Attempting to acquire the exclusive
> lock to become the Master broker
> INFO  DefaultDatabaseLocker          - Becoming the master on dataSource:
> org.apache.derby.jdbc.EmbeddedDataSource@1e55794
> INFO  JournalPersistenceAdapter      - Journal Recovery Started from:
> Active Journal: using 5 x 20.0 Megs at:
> /opt/apache-activemq-4.1.1/activemq-data/broker_A/journal
> INFO  JournalPersistenceAdapter      - Journal Recovered: 0 message(s) in
> transactions recovered.
> INFO  TransportServerThreadSupport   - Listening for connections at:
> tcp://debln099:61617
> INFO  TransportConnector             - Connector tcp://localhost:61617
> Started
> INFO  NetworkConnector               - Establishing network connection
> between from vm:?network=true to tcp://localhost:61616
> INFO  BrokerService                  - ActiveMQ 4.1.1 JMS Message Broker
> (null) is starting
> INFO  BrokerService                  - For help or more information please
> see: http://incubator.apache.org/activemq/
> INFO  JDBCPersistenceAdapter         - Database driver recognized:
> [apache_derby_embedded_jdbc_driver]
> INFO  ManagementContext              - JMX consoles can connect to
> service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
> INFO  DefaultDatabaseLocker          - Attempting to acquire the exclusive
> lock to become the Master broker
> INFO  DefaultDatabaseLocker          - Becoming the master on dataSource:
> org.apache.derby.jdbc.EmbeddedDataSource@158291
> INFO  JournalPersistenceAdapter      - Journal Recovery Started from:
> Active Journal: using 2 x 20.0 Megs at:
> /opt/apache-activemq-4.1.1/bin/activemq-data/null/journal
> INFO  JournalPersistenceAdapter      - Journal Recovered: 0 message(s) in
> transactions recovered.
> INFO  BrokerService                  - ActiveMQ JMS Message Broker (null,
> ID:debln099-46244-1185883671408-1:1) started
> INFO  TransportConnector             - Connector vm://null Started
> WARN  NetworkConnector               - Could not start network bridge
> between: vm:?network=true and: tcp://localhost:61616 due to:
> java.net.ConnectException: Connection refused
> INFO  NetworkConnector               - Network Connector bridge Started
> INFO  BrokerService                  - ActiveMQ JMS Message Broker
> (broker_A, ID:debln099-46244-1185883671408-1:0) started
> INFO  NetworkConnector               - Establishing network connection
> between from vm:?network=true to tcp://localhost:61616
> INFO  TransportConnector             - Connector vm://null Stopped
> INFO  BrokerService                  - ActiveMQ 4.1.1 JMS Message Broker
> (null) is starting
> INFO  BrokerService                  - For help or more information please
> see: http://incubator.apache.org/activemq/
> INFO  faultPersistenceAdapterFactory - Journal is locked... waiting 10
> seconds for the journal to be unlocked.
> WARN  ManagementContext              - Failed to start jmx connector:
> Cannot bind to URL [rmi://localhost:1099/jmxrmi]:
> javax.naming.NameAlreadyBoundException: jmxrmi [Root exception is
> java.rmi.AlreadyBoundException: jmxrmi]
> INFO  faultPersistenceAdapterFactory - Journal is locked... waiting 10
> seconds for the journal to be unlocked.
> INFO  faultPersistenceAdapterFactory - Journal is locked... waiting 10
> seconds for the journal to be unlocked.
> INFO  faultPersistenceAdapterFactory - Journal is locked... waiting 10
> seconds for the journal to be unlocked.
> INFO  faultPersistenceAdapterFactory - Journal is locked... waiting 10
> seconds for the journal to be unlocked.
> INFO  faultPersistenceAdapterFactory - Journal is locked... waiting 10
> seconds for the journal to be unlocked.
> INFO  faultPersistenceAdapterFactory - Journal is locked... waiting 10
> seconds for the journal to be unlocked.
> INFO  faultPersistenceAdapterFactory - Journal is locked... waiting 10
> seconds for the journal to be unlocked.
> INFO  faultPersistenceAdapterFactory - Journal is locked... waiting 10
> seconds for the journal to be unlocked.
> 
> 
> As you can see, only broker_A is starting. 
> 
> Furthermore, every broker has a separate journal directory which is empty
> before starting AMQ:
> 
> 
>     <persistenceAdapter>
>             <journaledJDBC journalLogFiles="5"
> dataDirectory="${activemq.base}/activemq-data/broker_C/"/>
>     </persistenceAdapter>
> 
> What the hack is wrong? To me the configuration seems to be right, can
> somebody release me from my misery?
> Why do the journal lock error?
> 
> Thx in advance.....
> 

-- 
View this message in context: http://www.nabble.com/Simple-network-of-brokers-%2B-faultPersistenceAdapterFactory---Journal-is-locked-tf4192402s2354.html#a11925222
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message