Activemq clustering kahadb zookeeper
Bonjour à tous,
Je suis novice en la matière et je tente d'implémenter une solution Apache ActiveMQ 5.14.1 couplée avec Zookeeper 3.4.9. Mon problème : configurer un cluster ActiveMQ avec kahadb puisque les autres solutions sont aujourd'hui dépréciées d'après le site d'apache lui même. Je tente donc de suivre la documentation officielle (qui semble avoir un bug au niveau de l'affichage de ha.xml puisqu'il ne s'affiche pas
Citation:
The actual contents of the configuration file follows:
Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20
:/) : http://activemq.apache.org/kahadb-master-slave.html
J'ai trois VM activemq01, activemq02 et activemq03 sur lesquelles j'ai installé une instance d'activemq et une instance de zookeeper. J'ai donc :
activemq01 : activemq-a et zookeeper-a
activemq02 : activemq-b et zookeeper-b
activemq03 : activemq-c et zookeeper-c
L'objectif étant bien sur de faire de la haute dispo pour qu'en cas de crash d'une instance d'activemq une autre prenne le relais. Au niveau de zookeeper, j'ai fais mes tests, l'une des trois instances est leader et les deux autres follower et si le leader tombe un des follower est bien élu comme leader, pas de problème. Par contre, impossible de clusteriser les instances d'activemq...
Je démarre mes trois instances activemq sans problème, mais les queues et topics existants sur activemq-a ne se répliquent pas sur -b et -c. J'ai bien mes trois fichiers de configuration : ha.xml, ha-broker.xml et activemq.xml mais j'ai un gros doute sur ha.xml et ha-broker.xml (que j'ai nommé ha-activemq-a.xml/ha-activemq-c.xml/ha-activemq-c.xml puisque le site d'apache n'en donne pas d'exemples. Je vous les mets à la suite pour avoir votre avis.
activemq.xml :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| <!-- START SNIPPET: example -->
<beans
xmlns="http://www.springframework.org/schema/beans"
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.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.conf}/credentials.properties</value>
</property>
</bean>
<bean id="logQuery" class="io.fabric8.insight.log.log4j.Log4jLogQuery"
lazy-init="false" scope="singleton"
init-method="start" destroy-method="stop">
</bean>
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="activemq-a" persistent="true">
<destinationPolicy>
<policyMap>
<policyEntries>
<policyEntry topic=">" >
<pendingMessageLimitStrategy>
<constantPendingMessageLimitStrategy limit="1000"/>
</pendingMessageLimitStrategy>
</policyEntry>
</policyEntries>
</policyMap>
</destinationPolicy>
<managementContext>
<managementContext createConnector="false"/>
</managementContext>
<persistenceAdapter>
<kahaDB directory="activemq-data" journalMaxFileLength="32mb"/>
</persistenceAdapter>
<systemUsage>
<systemUsage>
<memoryUsage>
<memoryUsage percentOfJvmHeap="70" />
</memoryUsage>
<storeUsage>
<storeUsage limit="2 gb"/>
</storeUsage>
<tempUsage>
<tempUsage limit="1 gb"/>
</tempUsage>
</systemUsage>
</systemUsage>
<transportConnectors>
<!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
<transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
</transportConnectors>
<shutdownHooks>
<bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" />
</shutdownHooks>
</broker>
<import resource="jetty.xml"/>
</beans>
<!-- END SNIPPET: example --> |
Le même sur -b et -c avec les noms de broker qui vont bien.
ha-broker.xml (j'ai ajouté la propriété start, et supprimé le bloc persistanceAdaptater comme indiqué sur le site d'apache) :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| <!-- START SNIPPET: example -->
<beans
xmlns="http://www.springframework.org/schema/beans"
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.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.conf}/credentials.properties</value>
</property>
</bean>
<bean id="logQuery" class="io.fabric8.insight.log.log4j.Log4jLogQuery"
lazy-init="false" scope="singleton"
init-method="start" destroy-method="stop">
</bean>
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="activemq-a" persistent="true" start="false">
<destinationPolicy>
<policyMap>
<policyEntries>
<policyEntry topic=">" >
<pendingMessageLimitStrategy>
<constantPendingMessageLimitStrategy limit="1000"/>
</pendingMessageLimitStrategy>
</policyEntry>
</policyEntries>
</policyMap>
</destinationPolicy>
<managementContext>
<managementContext createConnector="false"/>
</managementContext>
<systemUsage>
<systemUsage>
<memoryUsage>
<memoryUsage percentOfJvmHeap="70" />
</memoryUsage>
<storeUsage>
<storeUsage limit="2 gb"/>
</storeUsage>
<tempUsage>
<tempUsage limit="1 gb"/>
</tempUsage>
</systemUsage>
</systemUsage>
<transportConnectors>
<transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
</transportConnectors>
<shutdownHooks>
<bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" />
</shutdownHooks>
</broker>
<import resource="jetty.xml"/>
</beans>
<!-- END SNIPPET: example --> |
Et enfin le ha.xml :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
<kahadbReplicationBroker xmlns="http://activemq.apache.org/schema/kahadb">
<replicationService>
<kahadbReplication
directory="/opt/activemq/data/kahadb"
brokerURI="xbean:ha-activemq-a.xml"
uri="kdbr://localhost:6001"
minimumReplicas="0">
<cluster>
<zookeeperCluster uri="zk://DNS_activemq01:2181;zk://DNS_activemq02:2181/;zk://DNS_activemq03:2181">
</cluster>
</kahadbReplication>
</replicationService>
</kahadbReplicationBroker>
</beans> |
Mes connaissances sur le sujet s'arrêtant là, j'ai grandement besoin d'un coup de main (un p'tit miracle de Noël ?!). Merci d'avance à vous et bonnes fêtes de fin d'année.
HappyBlue.
I am getting error when starting the activemq
Hi Happyblue,
I am also having the similar requirement to try the KahaDB replication.
When i tried your procedure, I am getting the error when starting the activemq due to the un-availability of the xmlns 'http://activemq.apache.org/schema/kahadb"'
Can you pls post the entire content of the ha.xml.
Since i changed everything
Citation:
Envoyé par
mgkrishnan
Hi Happyblue,
I am also having the similar requirement to try the KahaDB replication.
When i tried your procedure, I am getting the error when starting the activemq due to the un-availability of the xmlns 'http://activemq.apache.org/schema/kahadb"'
Can you pls post the entire content of the ha.xml.
Hi,
(i apologize, although my English isn't too bad I am prone to make mistakes).
I'm so sorry but i changed all my conf since i wrote this post.
Now i use a shared directory "/app/activemq/data/kahadb" (with mount, and i declare it in my two server in activemq.conf) to stock my kahadb. Like this my two instances of activemq can read&write in the same directory and they can be master/slave.
In my activemq.conf :
<persistenceAdapter>
<kahaDB directory="yourshareddirectoryhere"/>
</persistenceAdapter>
I hope this had helps you.
Have an happy happy blue day ;)