HornetQ static cluster not working
pablorocha Apr 2, 2018 3:39 PMHi
I have a HornetQ running on machine A (server0), with the following configuration:
<configuration xmlns="urn:hornetq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd"> <paging-directory>${data.dir:../data}/paging</paging-directory> <bindings-directory>${data.dir:../data}/bindings</bindings-directory> <journal-directory>${data.dir:../data}/journal</journal-directory> <journal-min-files>10</journal-min-files> <large-messages-directory>${data.dir:../data}/large-messages</large-messages-directory> <connectors> <connector name="netty"> <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class> <param key="host" value="${hornetq.remoting.netty.host:localhost}"/> <param key="port" value="${hornetq.remoting.netty.port:5445}"/> </connector> <connector name="netty-throughput"> <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class> <param key="host" value="${hornetq.remoting.netty.host:localhost}"/> <param key="port" value="${hornetq.remoting.netty.batch.port:5455}"/> <param key="batch-delay" value="50"/> </connector> <!-- connector to the server1 --> <connector name="server1-connector"> <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class> <param key="host" value="${hornetq.remoting.netty.host:172.22.10.33}"/> <param key="port" value="5445"/> </connector> </connectors> <acceptors> <acceptor name="netty"> <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class> <param key="host" value="${hornetq.remoting.netty.host:0.0.0.0}"/> <param key="port" value="${hornetq.remoting.netty.port:5445}"/> </acceptor> <acceptor name="netty-throughput"> <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class> <param key="host" value="${hornetq.remoting.netty.host:0.0.0.0}"/> <param key="port" value="${hornetq.remoting.netty.batch.port:5455}"/> <param key="batch-delay" value="50"/> <param key="direct-deliver" value="false"/> </acceptor> </acceptors> <!-- <broadcast-groups> --> <!-- <broadcast-group name="bg-group1"> --> <!-- <group-address>231.7.7.7</group-address> --> <!-- <group-port>9876</group-port> --> <!-- <broadcast-period>5000</broadcast-period> --> <!-- <connector-ref>netty</connector-ref> --> <!-- </broadcast-group> --> <!-- </broadcast-groups> --> <!-- <discovery-groups> --> <!-- <discovery-group name="dg-group1"> --> <!-- <group-address>231.7.7.7</group-address> --> <!-- <group-port>9876</group-port> --> <!-- <refresh-timeout>10000</refresh-timeout> --> <!-- </discovery-group> --> <!-- </discovery-groups> --> <cluster-connections> <cluster-connection name="my-cluster"> <address>jms</address> <connector-ref>netty</connector-ref> <static-connectors> <connector-ref>server1-connector</connector-ref> </static-connectors> </cluster-connection> </cluster-connections> <security-settings> <security-setting match="#"> <permission type="createNonDurableQueue" roles="guest"/> <permission type="deleteNonDurableQueue" roles="guest"/> <permission type="consume" roles="guest"/> <permission type="send" roles="guest"/> </security-setting> </security-settings> <address-settings> <!--default for catch all--> <address-setting match="#"> <dead-letter-address>jms.queue.DLQ</dead-letter-address> <expiry-address>jms.queue.ExpiryQueue</expiry-address> <redelivery-delay>0</redelivery-delay> <max-size-bytes>10485760</max-size-bytes> <message-counter-history-day-limit>10</message-counter-history-day-limit> <address-full-policy>BLOCK</address-full-policy> </address-setting> </address-settings> </configuration>
I have another HornetQ running on machine B (server1), with the configuration below:
<configuration xmlns="urn:hornetq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd"> <paging-directory>${data.dir:../data}/paging</paging-directory> <bindings-directory>${data.dir:../data}/bindings</bindings-directory> <journal-directory>${data.dir:../data}/journal</journal-directory> <journal-min-files>10</journal-min-files> <large-messages-directory>${data.dir:../data}/large-messages</large-messages-directory> <connectors> <connector name="netty"> <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class> <param key="host" value="${hornetq.remoting.netty.host:localhost}"/> <param key="port" value="${hornetq.remoting.netty.port:5445}"/> </connector> <connector name="netty-throughput"> <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class> <param key="host" value="${hornetq.remoting.netty.host:localhost}"/> <param key="port" value="${hornetq.remoting.netty.batch.port:5455}"/> <param key="batch-delay" value="50"/> </connector> <!-- connector to the server0 --> <connector name="server0-connector"> <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class> <param key="host" value="${hornetq.remoting.netty.host:172.22.9.7}"/> <param key="port" value="5445"/> </connector> </connectors> <acceptors> <acceptor name="netty"> <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class> <param key="host" value="${hornetq.remoting.netty.host:0.0.0.0}"/> <param key="port" value="${hornetq.remoting.netty.port:5445}"/> </acceptor> <acceptor name="netty-throughput"> <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class> <param key="host" value="${hornetq.remoting.netty.host:0.0.0.0}"/> <param key="port" value="${hornetq.remoting.netty.batch.port:5455}"/> <param key="batch-delay" value="50"/> <param key="direct-deliver" value="false"/> </acceptor> </acceptors> <!-- <broadcast-groups> --> <!-- <broadcast-group name="bg-group1"> --> <!-- <group-address>231.7.7.7</group-address> --> <!-- <group-port>9876</group-port> --> <!-- <broadcast-period>5000</broadcast-period> --> <!-- <connector-ref>netty</connector-ref> --> <!-- </broadcast-group> --> <!-- </broadcast-groups> --> <!-- <discovery-groups> --> <!-- <discovery-group name="dg-group1"> --> <!-- <group-address>231.7.7.7</group-address> --> <!-- <group-port>9876</group-port> --> <!-- <refresh-timeout>10000</refresh-timeout> --> <!-- </discovery-group> --> <!-- </discovery-groups> --> <cluster-connections> <cluster-connection name="my-cluster"> <address>jms</address> <connector-ref>netty</connector-ref> <!-- <discovery-group-ref discovery-group-name="dg-group1"/> --> <static-connectors> <connector-ref>server0-connector</connector-ref> </static-connectors> </cluster-connection> </cluster-connections> <security-settings> <security-setting match="#"> <permission type="createNonDurableQueue" roles="guest"/> <permission type="deleteNonDurableQueue" roles="guest"/> <permission type="consume" roles="guest"/> <permission type="send" roles="guest"/> </security-setting> </security-settings> <address-settings> <!--default for catch all--> <address-setting match="#"> <dead-letter-address>jms.queue.DLQ</dead-letter-address> <expiry-address>jms.queue.ExpiryQueue</expiry-address> <redelivery-delay>0</redelivery-delay> <max-size-bytes>10485760</max-size-bytes> <message-counter-history-day-limit>10</message-counter-history-day-limit> <address-full-policy>BLOCK</address-full-policy> </address-setting> </address-settings> </configuration>
As I researched, the Load Balancer Client Side was supposed to be working because the HornetQ would be a cluster.
The problem is that the Load Balancer Client Side does not work.
My questions are:
Is there something wrong with setting up hornetq-configuration.xml? Should the cluster be working?
If the configuration of these files is correct, what do I have to do in order to have an load Balancer Client Side?
On the client side I have the following configuration:
<bean id="hornetConnectionFactory" class="org.hornetq.jms.client.HornetQJMSConnectionFactory"> <property name="failoverOnInitialConnection" value="true"/> <property name="clientFailureCheckPeriod" value="10000"/> <constructor-arg name="ha" value="true" /> <constructor-arg> <list> <bean class="org.hornetq.api.core.TransportConfiguration"> <constructor-arg value="org.hornetq.core.remoting.impl.netty.NettyConnectorFactory" /> <constructor-arg> <map key-type="java.lang.String" value-type="java.lang.Object"> <!-- HornetQ standalone instance details --> <entry key="host" value="172.22.10.33" /> <entry key="port" value="5445" /> </map> </constructor-arg> </bean> <bean class="org.hornetq.api.core.TransportConfiguration"> <constructor-arg value="org.hornetq.core.remoting.impl.netty.NettyConnectorFactory" /> <constructor-arg> <map key-type="java.lang.String" value-type="java.lang.Object"> <!-- HornetQ standalone instance details --> <entry key="host" value="localhost"/> <entry key="port" value="5445" /> </map> </constructor-arg> </bean> </list> </constructor-arg> </bean>
Could someone help me?
Thank you very much in advance.