0
votes

I am trying to run a network of broker with 2 brokers on the same network but on 2 different virtual machines.

Because of some internal constraints I have to use a custom jmx port. I am using the Tanuki wrapper to launch ActiveMQ on an Ubuntu server.

Here is the relevant part of my activemq.xml

<broker xmlns="http://activemq.apache.org/schema/core" advisorySupport="false" useJmx="true" brokerName="test1" dataDirectory=".../data/activemq">
    <networkConnectors>
        <networkConnector uri="multicast://1.2.3.4:101234?group=test" 
            dynamicOnly="true"
            networkTTL="3"
            prefetchSize="1"
            decreaseNetworkConsumerPriority="true" 
            userName="user"
            password="password"/>
    </networkConnectors>

    <transportConnectors>
        <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"  rebalanceClusterClients="true" updateClusterClients="true" />
        <transportConnector name="nio" uri="nio://0.0.0.0:61617"  rebalanceClusterClients="true" updateClusterClients="true" discoveryUri="multicast://1.2.3.4:101234?group=test"  />
    </transportConnectors>
    ...
    <managementContext>
        <managementContext createConnector="false"/>
    </managementContext>
    ...
</broker>

Here is the relevant part of wrapper.conf:

# Uncomment to enable jmx
wrapper.java.additional.1=-Dcom.sun.management.jmxremote
wrapper.java.additional.2=-Dcom.sun.management.jmxremote.port=4321
wrapper.java.additional.3=-Dcom.sun.management.jmxremote.authenticate=false
wrapper.java.additional.4=-Dcom.sun.management.jmxremote.ssl=false

When running ActiveMQ on both broker, I see the process with the expected options:

activemq 30682 30680 3 13:27 ? 00:00:30 java -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=4321 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djavax.net.ssl.keyStore=../../conf/broker.ks -Djavax.net.ssl.trustStore=../../conf/broker.ts -Dcom.sun.management.jmxremote -Dorg.apache.activemq.UseDedicatedTaskRunner=true -Djava.util.logging.config.file=logging.properties -Dactivemq.conf=../../conf -Dactivemq.data=../../data -Xms2048m -Xmx2048m -Djava.library.path=../../bin/linux-x86-64/ -classpath ../../bin/wrapper.jar:../../bin/activemq.jar -Dwrapper.key=y4TuwO32Hj6kN7w8 -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.pid=30680 -Dwrapper.version=3.2.3 -Dwrapper.native_library=wrapper -Dwrapper.service=TRUE -Dwrapper.cpu.timeout=10 -Dwrapper.jvmid=1 org.tanukisoftware.wrapper.WrapperSimpleApp org.apache.activemq.console.Main start

The port is open on the running shorewall.

The network of broker is up but I cannot connect to the jmx using jvisualvm with server_dns:4321. It returns the error "cannot connect to server_dns:4321 using service:jmx:rmi:///jndi/rmi://server_dns:4321/jmxrmi

I can see some traffic on the port via tcpdump.

Could anybody tell me what I am doing wrong or how I should use ActiveMQ as a Network Of Broker with a custom jmx port?

1
when I check the port in use I see that 2 jmx ports are listen by activemq. It listen to the custom 4321 and the standard 1099. When setting useJmx to false in activemq.xml I see that only the custom port is still in use. But still I cannot connect to it. I have heard that Network Of Brokers are also using the JMX interface to communicate. How can I see the port that is really used by the 2 brokers?Antoine Wils
By reading again the network of broker documentation I figured out that I wrongly configured it. I made each of my 2 brokers both a master/slave and a node in the network of broker. This network cannot work because one of the 2 nodes will always be slave and thus not active at any time. But still after dropping the network part I cannot connect to the JMX. I am now trying to set 2 master/slave pairs in one network of broker. I'll post my observation if relevant afterwardsAntoine Wils
I finally made the change not to have 2 running nodes in my network of brokers (2 pairs of master slave, each of them being a node in the network). Unfortunately this didn't help on enabling the connection to the JMXAntoine Wils

1 Answers

1
votes

JMX needs 2 open ports. An extra one is necessary for rmi. I figured it out thanks to this post: Apache ActiveMQ browser can't connect to JMX console

In my case the fix is to change the configuration of my wrapper to expose the rmi port and open the port on the firewall

# Uncomment to enable jmx
wrapper.java.additional.1=-Dcom.sun.management.jmxremote
wrapper.java.additional.2=-Dcom.sun.management.jmxremote.port=4321
wrapper.java.additional.3=-Dcom.sun.management.jmxremote.port=8765
wrapper.java.additional.4=-Dcom.sun.management.jmxremote.authenticate=false
wrapper.java.additional.5=-Dcom.sun.management.jmxremote.ssl=false