问题描述
因此,如果我在 Docker 容器中运行 curl -u admin:password http://10.0.1.195:8161/api/jolokia
,我将收到此错误:
curl: (7) Failed to connect to 10.0.1.195 port 8161: No route to host
但是如果我在主机上的容器外运行相同的 cURL 命令,我就可以在端口 8161 上访问 ActiveMQ 主机。
此外,我可以在引用 InfluxDB 主机的同一个 Docker 容器中运行 curl http://10.0.2.111:8086/ping
。
我得出的结论是,我的问题与 ActiveMQ 有关,因为我可以连接到其他任何地方。
ActiveMQ 在单独的 EC2 实例上运行,并配置了安全组、子网和 VPC。一切正常,只有从 Docker 容器内部访问此主机是一个问题。
jetty.xml
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
...
<bean id="jettyPort" class="org.apache.activemq.web.WebConsolePort" init-method="start">
<property name="host" value="0.0.0.0" />
<property name="port" value="8161" />
</bean>
...
<bean id="Connector" class="org.eclipse.jetty.server.ServerConnector">
<constructor-arg ref="Server" />
<!-- see the jettyPort bean -->
<property name="host" value="#{systemProperties['jetty.host']}" />
<property name="port" value="#{systemProperties['jetty.port']}" />
</bean>
...
</beans>
jolokia-access.xml
<?xml version="1.0" encoding="UTF-8"?>
<restrict>
<remote>
<host>127.0.0.1</host>
<host>localhost</host>
<host>10.0.0.0/16</host>
</remote>
<deny>
<mbean>
<name>com.sun.management:type=DiagnosticCommand</name>
<attribute>*</attribute>
<operation>*</operation>
</mbean>
<mbean>
<name>com.sun.management:type=HotSpotDiagnostic</name>
<attribute>*</attribute>
<operation>*</operation>
</mbean>
</deny>
</restrict>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)