Verifying a multicast cluster

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Verifying a multicast cluster

jlindwall
I'm trying to verify that my multicast cluster is working properly: clients on any node should receive msgs sent to any other node.

Using 5.10, on Ubuntu

In the past I have successfully created a network of brokers using a static list of urls.  I could then run a "subscriber" client that connected to host 1 via a tcp://host1:11111 url and a "publisher" that published a message to host 2 via a tcp://host2:2222 url.  The subscriber would, of course, receive the message even though it was listening on a different host in the cluster.  That's the whole point of the cluster so yay for activemq!

Now I am trying to do the same with a cluster configured via multicast and it is not working.  I use those same tcp:// urls on the two clients as shown above and each successfully connects, however the message is not received by the subscriber program.

http://activemq.apache.org/networks-of-brokers.htm

I plan to use "discovery:(multicast://default)" urls in my final production client configuration.  However, when I do that in my test programs they both connect to the same physical node in the cluster which renders my test inconclusive.  That is what lad me to try the tcp:// urls.

Is it invalid to use tcp:// urls in the clients to connect to a multicast cluster perhaps?

Here is a node's config file.... I hope this raw tag works as I expect! :)

<?xml version="1.0" encoding="UTF-8"?><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">

    <!-- Allows us to use system properties as variables in this configuration file -->
    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <value>file:${activemq.conf}/credentials.properties</value>
        </property>
    </bean>

   <!-- Allows accessing the server log -->
    <bean class="org.fusesource.insight.log.log4j.Log4jLogQuery" destroy-method="stop" id="logQuery" init-method="start" lazy-init="false" scope="singleton">
    </bean>

    <!--
        The <broker> element is used to configure the ActiveMQ broker.
    -->
    <broker xmlns="http://activemq.apache.org/schema/core" brokerName="master1" dataDirectory="${activemq.data}" advisorySupport="false">

        <destinationPolicy>
            <policyMap>
              <policyEntries>
                <policyEntry topic="&gt;">
                    <!-- The constantPendingMessageLimitStrategy is used to prevent
                         slow topic consumers to block producers and affect other consumers
                         by limiting the number of messages that are retained
                         For more information, see:

                         http://activemq.apache.org/slow-consumer-handling.html

                    -->
                  <pendingMessageLimitStrategy>
                    <constantPendingMessageLimitStrategy limit="1000"/>
                  </pendingMessageLimitStrategy>
                </policyEntry>
              </policyEntries>
            </policyMap>
        </destinationPolicy>


        <!--
           The managementContext is used to configure how ActiveMQ is exposed in
            JMX. By default, ActiveMQ uses the MBean server that is started by
            the JVM. For more information, see:

            http://activemq.apache.org/jmx.html
        -->
        <managementContext>
            <managementContext connectorPort="1222" createConnector="true"/>
        </managementContext>

        <!--
            Configure message persistence for the broker. The default persistence
            mechanism is the KahaDB store (identified by the kahaDB tag).
            For more information, see:

            http://activemq.apache.org/persistence.html
        -->
        <persistenceAdapter>
            <kahaDB directory="${activemq.data}/kahadb"/>
        </persistenceAdapter>


          <!--
            The systemUsage controls the maximum amount of space the broker will
            use before disabling caching and/or slowing down producers. For more information, see:
            http://activemq.apache.org/producer-flow-control.html
          -->
          <systemUsage>
            <systemUsage>
                <memoryUsage>
                    <memoryUsage percentOfJvmHeap="70"/>
                </memoryUsage>
                <storeUsage>
                    <storeUsage limit="100 gb"/>
                </storeUsage>
                <tempUsage>
                    <tempUsage limit="50 gb"/>
                </tempUsage>
            </systemUsage>
        </systemUsage>

        <!--
            The transport connectors expose ActiveMQ over a given protocol to
            clients and other brokers. For more information, see:

            http://activemq.apache.org/configuring-transports.html
        -->
        <transportConnectors>
            <transportConnector uri="tcp://0.0.0.0:3111" discoveryUri="multicast://default"/>
        </transportConnectors>

        <networkConnectors>
            <networkConnector uri="multicast://default" />
        </networkConnectors>

        <!-- destroy the spring context on shutdown to stop jetty -->
        <shutdownHooks>
            <bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook"/>
        </shutdownHooks>

    </broker>

    <!--
        Enable web consoles, REST and Ajax APIs and demos
        The web consoles requires by default login, you can disable this in the jetty.xml file

        Take a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details
    -->
    <import resource="jetty.xml"/>

</beans>


Thanks!
John
Reply | Threaded
Open this post in threaded view
|

Re: Verifying a multicast cluster

jlindwall
I solved my own problem.  As is so often the case, it was a case of "user shooting self in foot"

http://activemq.apache.org/networks-of-brokers.html

As mentioned in the documentation, you need to have advisories enabled for a network of brokers to function properly.  I had disabled them.

My test programs now work as expected, so yes you can use direct tcp:// urls to connect to specific nodes in a discovery-based cluster.

John
Reply | Threaded
Open this post in threaded view
|

Re: Verifying a multicast cluster

jlindwall
Just to be explicit for people looking for the solution in future, the fix was to remove advisorySupport="false" from the broker element in activemq.xml.

Change:

<broker xmlns="http://activemq.apache.org/schema/core" brokerName="master1" dataDirectory="${activemq.data}" advisorySupport="false">

To this:

<broker xmlns="http://activemq.apache.org/schema/core" brokerName="master1" dataDirectory="${activemq.data}">