简体   繁体   中英

What is the default port for JMX in ActiveMQ?

I am using ActiveMQ 5.3.2 and 5.6.0. In ActiveMQ 5.3.2, the default settings for JMX is

SUNJMX="-Dcom.sun.management.jmxremote"

In ActiveMQ 5.6.0, the default settings for JMX is

ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote"

So, these settings have no port definition. Could you tell me ActiveMQ is really starting JMX connection with these settings? If so, what is the default port to connect as I cannot connect to 1099. If port is randomly selected, how to find the port which ActiveMQ is using?

Thanks.

Default port is 1099. This can be override by passing jmx parameters as argument to activeMQ in activeMQ start script(activemq.bat or .sh file) . Use property

Dcom.sun.management.jmxremote.port for setting JMX port

if you run ActiveMQ Broker in a Spring Boot, this is a simple way to configure the JMX port to the value 11099:

    BrokerService broker = new BrokerService();

    broker.getManagementContext().setConnectorPort(11099);
    broker.getSystemUsage().getStoreUsage().setLimit(100_000_000L);
    broker.getSystemUsage().getTempUsage().setLimit(100_000_000L);

    TransportConnector connector = new TransportConnector();
    connector.setUri(new URI("tcp://localhost:61616?wireFormat.maxInactivityDuration=3000000&wireFormat.maxInactivityDurationInitalDelay=1000000"));

    broker.addConnector(connector);
    broker.start();

By default it doesn't appear to bind to a "default activemq jmx port" however you can modify the activemq file (or environment variables to add one). JMX if you don't specify a port doesn't open one by expicitly stating one .

For instance uncomment this line (or an equivalent in the activemq file for older versions)

 # ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.port=11099 "

So I guess you could think of that as the "default if you uncomment its config line".

Also when you issue a "stop" command and it doesn't pass a --jmxurl (default is port 11099 in the activemq version I run) it does default to attempting to contact service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi even though the default config isn't listening on that port without modifying configs first. Weird.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM