You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Mykola <mp...@gmail.com> on 2007/08/31 15:56:01 UTC

Running a HA network of brokers

Hi all
After problems with Master/Slave configuration over MySQL when master broker
hangs up after some time, we decided to switch to the Network of Brokers to
achieve HA

I setup 2 brokers on 61616 and 61716 ports with following configs

<pre>
<beans>

<!-- Allows us to use system properties as variables in this configuration
file -->
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>

<broker brokerName="localhost" useJmx="false"
xmlns="http://activemq.org/config/1.0"
dataDirectory="${activemq.base}/data">

<transportConnectors>
	<transportConnector name="openwire" uri="tcp://localhost:61716"/>
</transportConnectors>

<networkConnectors>
	<networkConnector uri="static:(tcp://localhost:61616)"/>
</networkConnectors>

</broker>

</beans>
</pre>

Second one is the same just symmetrical port numbers.

After that I wrote in Connection pool I'm using for both sending and
receiving messages 
jms.remotehost.uri=failover:(tcp://localhost:61616,tcp://localhost:61716)

<pre>
	<bean id="jmsConnectionFactory"
		class="org.apache.activemq.pool.PooledConnectionFactory"
		init-method="start" destroy-method="stop" depends-on="jmsBroker">
		<property name="connectionFactory">
			<bean
				class="org.apache.activemq.ActiveMQConnectionFactory">
				<property name="brokerURL"
					value="${jms.remotehost.uri}" />
				<property name="redeliveryPolicy">
					<bean class="org.apache.activemq.RedeliveryPolicy">
						<property name="backOffMultiplier" value="3"/>
						<property name="useExponentialBackOff" value="true"/>
						<property name="maximumRedeliveries" value="11"></property>
						<property name="initialRedeliveryDelay" value="2000"></property>
					</bean>
				</property>
			</bean>
		</property>
	</bean>

</pre>

As a result, only messages that are sent to one of the queues get consumed,

The question is how can it be fixed the best way.
All I need is HA for message queue, but I'd also like both brokers work
effectively when they are up,
The only solution I see is declare two connection factories, but that is
extensive way since i will need to duplicate a lot of things, is there any
better way?

Thanks in advance for any answers.
-- 
View this message in context: http://www.nabble.com/Running-a-HA-network-of-brokers-tf4360281s2354.html#a12426843
Sent from the ActiveMQ - User mailing list archive at Nabble.com.