简体   繁体   English

ActiveMQ 中 JMX 的默认端口是什么?

[英]What is the default port for JMX in ActiveMQ?

I am using ActiveMQ 5.3.2 and 5.6.0.我使用的是 ActiveMQ 5.3.2 和 5.6.0。 In ActiveMQ 5.3.2, the default settings for JMX is在 ActiveMQ 5.3.2 中,JMX 的默认设置是

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

In ActiveMQ 5.6.0, the default settings for JMX is在 ActiveMQ 5.6.0 中,JMX 的默认设置是

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?你能告诉我 ActiveMQ 真的用这些设置启动了 JMX 连接吗? 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?如果是这样,我无法连接到1099,因此默认连接的端口是什么。如果端口是随机选择的,如何找到ActiveMQ正在使用的端口?

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) .默认端口是 1099。这可以通过将 jmx 参数作为参数传递给 activeMQ 启动脚本(activemq.bat 或 .sh 文件)中的 activeMQ 来覆盖。 Use property使用财产

Dcom.sun.management.jmxremote.port for setting JMX port dcom.sun.management.jmxremote.port用于设置 JMX 端口

if you run ActiveMQ Broker in a Spring Boot, this is a simple way to configure the JMX port to the value 11099:如果您在 Spring Boot 中运行 ActiveMQ Broker,这是一种将 JMX 端口配置为值 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).默认情况下,它似乎没有绑定到“默认的 activemq jmx 端口”,但是您可以修改 activemq 文件(或添加一个环境变量)。 JMX if you don't specify a port doesn't open one by expicitly stating one .如果您不指定端口,JMX 将不会通过明确声明 one 来打开一个端口。

For instance uncomment this line (or an equivalent in the activemq file for older versions)例如,取消注释此行(或旧版本的 activemq 文件中的等效

 # 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.此外,当您发出“停止”命令并且它没有传递--jmxurl (在我运行的 activemq 版本中默认为端口 11099)时,它默认尝试联系service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi即使默认配置没有在不先修改配置的情况下侦听该端口。 Weird.奇怪的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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