我在运行Zookeeper
和ActiveMQ
的 3个虚拟机中配置了此端口。
root@mom3:~# ufw status verbose
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip
To Action From
-- ------ ----
22 ALLOW IN Anywhere
2881 ALLOW IN Anywhere
2888 ALLOW IN Anywhere
3888 ALLOW IN Anywhere
61616 ALLOW IN Anywhere
61617 ALLOW IN Anywhere
22 (v6) ALLOW IN Anywhere (v6)
2881 (v6) ALLOW IN Anywhere (v6)
2888 (v6) ALLOW IN Anywhere (v6)
3888 (v6) ALLOW IN Anywhere (v6)
61616 (v6) ALLOW IN Anywhere (v6)
61617 (v6) ALLOW IN Anywhere (v6)
当我尝试启动ActiveMQ
时,它会获得一个随机端口来使用它:
INFO | Master started: tcp://mom1.company.com:37649
WARN | Store update waiting on 1 replica(s) to catch up to log position 0.
WARN | Store update waiting on 1 replica(s) to catch up to log position 0.
WARN | Store update waiting on 1 replica(s) to catch up to log position 0.
但是,当我停用防火墙时,ActiveMQ
通常启动。
如何在每次使用相同的端口,以便在防火墙中创建新规则?
修改
根据@ Daniel的建议,这是我对activemq.xml
文件的配置。
<persistenceAdapter>
<replicatedLevelDB
directory="${activemq.data}/leveldb"
replicas="3"
bind="tcp://0.0.0.0:0:61616"
zkAddress="mom1.company.com:2881,mom2.company.com:2881,mom3.company.com:2881"
zkPassword="password"
zkPath="/activemq/leveldb-stores"
hostname="mom3.company"
/>
</persistenceAdapter>
...
<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&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="ssl" uri="ssl://0.0.0.0:61617?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
</transportConnectors>
答案 0 :(得分:2)
因为你正在写一个关于一个动物园管理员的事情,所以当我使用主/从复制的levelDB设置时,我记得这个日志行我会继续并假设你也在使用它。如果情况确实如此,那么您在那里看到的端口就是主服务器启动的“绑定”端口,以便客户端将自己附加到并开始复制数据。可以使用replicatedLevelDB部分中的bind参数在代理XML配置中轻松配置此端口,例如
<broker brokerName="broker" ... >
...
<persistenceAdapter>
<replicatedLevelDB
directory="activemq-data"
replicas="3"
bind="tcp://0.0.0.0:<myDesiredPort>"
zkAddress="zoo1.example.org:2181,zoo2.example.org:2181,zoo3.example.org:2181"
zkPassword="password"
zkPath="/activemq/leveldb-stores"
hostname="broker1.example.org"
/>
</persistenceAdapter>
...
</broker>
然后将始终使用“myDesiredPort”作为绑定端口。由于通常61619是未设置此参数的默认端口,因此您现在可能已经配置了此元素,但是使用bind =“tcp://0.0.0.0:0”动态选择一个。有关复制的levelDB的更多说明和可用参数的完整列表,请参阅documentation
希望这可以解决您的问题,如果这不是您的设置,请将您的经纪人配置添加到您的问题中,这样可以更容易找到真正的罪魁祸首而无需猜测。