activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From patzerbud <patzer...@hotmail.com>
Subject failover broker configuration
Date Fri, 07 May 2010 20:53:46 GMT

I have a few questions related to the proper configuration of a failover
broker. My environment is: 
linux, java 1.5, and ActiveMQ 5.3.1

I have two brokers - a primary (clients connect using the failover protocol
but with randomize=false, so they will always use the primary unless it is
down) and a failover.

Here's the primary's config:
<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="emst-primary"
			dataDirectory="${activemq.base}/data"
			destroyApplicationContextOnStop="true" >

        <destinationPolicy>
            <policyMap>
              <policyEntries>
                <policyEntry topic=">" producerFlowControl="true"
memoryLimit="5mb" useCache="false">
                  <pendingSubscriberPolicy>
                    <vmCursor />
                  </pendingSubscriberPolicy>
                </policyEntry>
                <policyEntry queue=">" producerFlowControl="true"
memoryLimit="5mb" useCache="false">
                </policyEntry>
              </policyEntries>
            </policyMap>
        </destinationPolicy>

        <managementContext>
            <managementContext createConnector="false"/>
        </managementContext>

		<networkConnectors>
		</networkConnectors>

		<persistenceAdapter>
			<kahaDB directory="${activemq.base}/data/kahadb"
					indexWriteBatchSize="100"
					journalMaxFileLength="33554432"
					enableIndexWriteAsync="true"
					enableJournalDiskSyncs="false" />
		</persistenceAdapter>

		<systemUsage>
			<systemUsage>
				<memoryUsage>
					<memoryUsage limit="512 mb"/>
				</memoryUsage>
				<storeUsage>
					<storeUsage limit="2 gb" name="data-store"/>
				</storeUsage>
				<tempUsage>
					<tempUsage limit="100 mb"/>
				</tempUsage>
			</systemUsage>
		</systemUsage>

        <transportConnectors>
            <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
        </transportConnectors>

    </broker>
    <import resource="jetty.xml"/>
</beans>

And here's the failover's config:
<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="emst-failover"
			dataDirectory="${activemq.base}/data"
			destroyApplicationContextOnStop="true" >

        <destinationPolicy>
            <policyMap>
              <policyEntries>
                <policyEntry topic=">" producerFlowControl="true"
memoryLimit="5mb" useCache="false">
                  <pendingSubscriberPolicy>
                    <vmCursor />
                  </pendingSubscriberPolicy>
                </policyEntry>
                <policyEntry queue=">" producerFlowControl="true"
memoryLimit="5mb" useCache="false">
                </policyEntry>
              </policyEntries>
            </policyMap>
        </destinationPolicy>

        <managementContext>
            <managementContext createConnector="false"/>
        </managementContext>

		<!-- The store and forward broker networks ActiveMQ will listen to -->
		<networkConnectors>
			<networkConnector name="bridge-to-primary"
						   uri="static:(tcp://10.0.33.31:61616)"
						   dynamicOnly="false"
						   duplex="true"
						   prefetchSize="1">
				<excludedDestinations>
					<queue physicalName="Consumer.*.VirtualTopic.>"/>
				</excludedDestinations>
				<staticallyIncludedDestinations>
					<topic
physicalName="VirtualTopic.EMSystems.SharedServices.DirectoryServices"/>
				</staticallyIncludedDestinations>
			</networkConnector>
		</networkConnectors>

		<persistenceAdapter>
			<kahaDB directory="${activemq.base}/data/kahadb"
					indexWriteBatchSize="100"
					journalMaxFileLength="33554432"
					enableIndexWriteAsync="true"
					enableJournalDiskSyncs="false" />
		</persistenceAdapter>

		<systemUsage>
			<systemUsage>
				<memoryUsage>
					<memoryUsage limit="512 mb"/>
				</memoryUsage>
				<storeUsage>
					<storeUsage limit="2 gb" name="data-store"/>
				</storeUsage>
				<tempUsage>
					<tempUsage limit="100 mb"/>
				</tempUsage>
			</systemUsage>
		</systemUsage>

        <transportConnectors>
            <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
        </transportConnectors>

    </broker>
    <import resource="jetty.xml"/>
</beans>

Here's the console view of the Primary:

http://old.nabble.com/file/p28491323/primary.png 

Here's the console view of the Failover:

http://old.nabble.com/file/p28491323/failover.png 

Finally, my questions:

1. Why does it look like all of the messages on the Failover instance are
still pending?
2. Shouldn't they have been dequeued from the Failover when they were
consumed from the primary?

Last time I shutdown the Primary I believe there were a lot of messages in
my app server logs about rejecting duplicate messages. So I don't think
there is any harm in having them on the Failover node. (Someone please
correct me if I'm wrong!)

3. Given that I am using multiple servers for failover - and not
load-balancing - are the configurations above correct? Or can they be
improved?

Finally, there are a ton of messages in the "advisory" topics. Is there any
way to purge these? (Deleting these is bad - since that breaks the failover
(i.e. it no longer queues up any messages published to the primary).

http://old.nabble.com/file/p28491323/advisory.png 

TIA,

Mike L. (aka patzerbud)

-- 
View this message in context: http://old.nabble.com/failover-broker-configuration-tp28491323p28491323.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message