如何解决无法使用主机名和公共 IP 访问 ActiveMQ-Artemis 主页
我有两个具有类似配置的 ActiveMQ-Artemis 实例。它们都在 Azure 上的 Ubuntu VM 上运行。我为两者都设置了主机名——假设它们是 prod01.sys 和 prod02.sys。两者都解析为公共 IP。我可以 ping prod01.sys 和 prod02.sys 来确认。但是,只有 prod01.sys:8443 解析到 Artemis 主页(或实际控制台的 prod01.sys:8443/console)。我可以使用私有 IP 访问两者。
我不确定如何进一步诊断。这是我的 bootstrap.xml 文件:
prod01.sys
<broker xmlns="http://activemq.org/schema">
<jaas-security domain="activemq"/>
<server configuration="file:/var/lib/broker-HA/etc//broker.xml"/>
<web bind="https://0.0.0.0:8443"
path="web"
keyStorePath="/{path}/keystore.ks"
keyStorePassword="{secret}">
<app url="jolokia" war="/opt/jolokia/jolokia-war-1.3.5.war"/>
<app url="activemq-branding" war="activemq-branding.war"/>
<app url="artemis-plugin" war="artemis-plugin.war"/>
<app url="console" war="console.war"/>
</web>
</broker>
prod02.sys
<broker xmlns="http://activemq.org/schema">
<jaas-security domain="activemq"/>
<server configuration="file:/var/lib/broker-HA/etc//broker.xml"/>
<web bind="https://0.0.0.0:8443"
path="web"
keyStorePath="/{path}/keystore.ks"
keyStorePassword="{secret}">
<app url="jolokia" war="/opt/jolokia/jolokia-war-1.3.5.war"/>
<app url="activemq-branding" war="activemq-branding.war"/>
<app url="artemis-plugin" war="artemis-plugin.war"/>
<app url="console" war="console.war"/>
</web>
</broker>
jolokia-access.xml 是相同的:
<restrict>
<cors>
<allow-origin>*://*</allow-origin>
<strict-checking/>
</cors>
</restrict>
<restrict>
<cors>
<allow-origin>*://*</allow-origin>
<strict-checking/>
</cors>
</restrict>
这里是端口和 ifconfig
prod01.sys
$ sudo lsof -i -P -n | grep LISTEN
systemd-r 1072 systemd-resolve 13u IPv4 30148 0t0 TCP 127.0.0.53:53 (LISTEN)
sshd 1667 root 3u IPv4 34444 0t0 TCP *:22 (LISTEN)
sshd 1667 root 4u IPv6 34446 0t0 TCP *:22 (LISTEN)
omsagent 30804 omsagent 16u IPv4 91358169 0t0 TCP *:25324 (LISTEN)
npmd_agen 30854 omsagent 4u IPv6 91361297 0t0 TCP *:8084 (LISTEN)
java 88458 activemq 17u IPv6 76117836 0t0 TCP *:35259 (LISTEN)
java 88458 activemq 18u IPv6 76117837 0t0 TCP *:9876 (LISTEN)
java 88458 activemq 19u IPv6 76117838 0t0 TCP *:33835 (LISTEN)
java 88458 activemq 75u IPv6 76115615 0t0 TCP *:1099 (LISTEN)
java 88458 activemq 76u IPv6 76115616 0t0 TCP 10.40.50.17:46775 (LISTEN)
java 88458 activemq 156u IPv6 76118634 0t0 TCP *:61616 (LISTEN)
java 88458 activemq 193u IPv6 76118635 0t0 TCP *:5500 (LISTEN)
java 88458 activemq 223u IPv6 76119321 0t0 TCP *:8443 (LISTEN)
rpcbind 95821 root 8u IPv4 53547139 0t0 TCP *:111 (LISTEN)
rpcbind 95821 root 11u IPv6 53547142 0t0 TCP *:111 (LISTEN)
$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet {private IP} netmask 255.255.255.0 broadcast {IP}.255
inet6 fe80::20d:3aff:fe04:1301 prefixlen 64 scopeid 0x20<link>
ether 00:0d:3a:04:13:01 txqueuelen 1000 (Ethernet)
RX packets 188638370 bytes 46501451447 (46.5 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 194295204 bytes 46824612750 (46.8 GB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 8125028 bytes 1891996483 (1.8 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 8125028 bytes 1891996483 (1.8 GB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
prod02.sys
$ sudo lsof -i -P -n | grep LISTEN
rpcbind 735 root 8u IPv4 16921 0t0 TCP *:111 (LISTEN)
rpcbind 735 root 11u IPv6 16924 0t0 TCP *:111 (LISTEN)
systemd-r 998 systemd-resolve 13u IPv4 20488 0t0 TCP 127.0.0.53:53 (LISTEN)
sshd 1337 root 3u IPv4 22325 0t0 TCP *:22 (LISTEN)
sshd 1337 root 4u IPv6 22327 0t0 TCP *:22 (LISTEN)
java 10408 activemq 17u IPv6 7185953 0t0 TCP *:45983 (LISTEN)
java 10408 activemq 18u IPv6 7185954 0t0 TCP *:9876 (LISTEN)
java 10408 activemq 19u IPv6 7185955 0t0 TCP *:42375 (LISTEN)
java 10408 activemq 75u IPv6 7185956 0t0 TCP *:1099 (LISTEN)
java 10408 activemq 76u IPv6 7177821 0t0 TCP 10.40.50.12:43339 (LISTEN)
java 10408 activemq 149u IPv6 7184849 0t0 TCP *:8443 (LISTEN)
omsagent- 24987 omsagent 16u IPv4 15027544 0t0 TCP *:25324 (LISTEN)
npmd_agen 25037 omsagent 4u IPv6 15027058 0t0 TCP *:8084 (LISTEN)
$ ifconfig
eth0: flags=4163<UP,MULTICAST> mtu 1500
inet {private IP} netmask 255.255.255.0 broadcast {private}.255
inet6 fe80::20d:3aff:fee5:2a38 prefixlen 64 scopeid 0x20<link>
ether 00:0d:3a:e5:2a:38 txqueuelen 1000 (Ethernet)
RX packets 33770791 bytes 11475793216 (11.4 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 34878913 bytes 8169417229 (8.1 GB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 2580078 bytes 375020191 (375.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2580078 bytes 375020191 (375.0 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
我不确定从这里开始调查什么。对我来说特别困惑的是prod01.sys带出首页,解析到公网IP,但是直接使用公网IP却上不去首页。我接下来应该看哪里?我不确定问题是出在 Azure、Ubuntu 还是 Artemis 上。
以下是有效和无效的总结:
对于 prod01,这些工作:
https://prod01.sys:8443
https://{Azure machine name}:8443
https://{private IP}:8443
这个失败(虽然可以ping通)
https://{public IP}:8443
对于 prod02,这些工作:
https://{Azure machine name}:8443
https://{private IP}:8443
但是这些都失败了(虽然它们可以ping通)
https://prod02.sys:8443
https://{public IP}:8443
解决方法
ActiveMQ Artemis 配置对我来说看起来不错。我会检查 VM 操作系统防火墙规则和 Azure 网络安全组。
在尝试连接到 ActiveMQ Artemis 之前,您可以尝试连接到 sshd 以测试您的 Azure/OS 网络配置。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。