如何使ActiveMQ使用全局主机名而不是hostname.local?

我正在两台计算机上运行activeMQ。我看到machine1使用从终端获取的主机名

$ hostname
NILSWAP01

我也在日志中看到了它。

INFO | Apache activeMQ 5.15.10 (localhost,ID:NILSWAP01-60292-1574286577214-0:1) is starting
INFO | Listening for connections at: tcp://NILSWAP01:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600

但是在另一台机器上,我看到它使用hostname.local而不是常规主机名。

$ hostname
NILSWAP02
INFO | Apache activeMQ 5.15.10 (localhost,ID:NILSWAP02.local-60292-1574286577214-0:1) is starting
INFO | Listening for connections at: tcp://NILSWAP02.local:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600

为什么会这样?如何确保我的第二台计算机也仅使用常规的全局主机名?

我正在使用macOS 10.14.6。

经纪人配置:

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

        <destinationPolicy>
            <policyMap>
              <policyEntries>
                <policyEntry topic=">" >
                    <!-- 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 createConnector="false"/>
        </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>
            <!-- DOS protection,limit concurrent connections to 1000 and frame size to 100MB -->
            <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
        </transportConnectors>

        <!-- 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>
zxcvbnmasd1234 回答:如何使ActiveMQ使用全局主机名而不是hostname.local?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3062128.html

大家都在问