我很难通过JMX连接到Docker容器内的Cassandra。我在AWS中运行(这意味着我获得了NATted IP)。以下是我尝试过的事情:
FROM cassandra:latest
COPY ./jmxremote.password /etc/cassandra/jmxremote.password
运行chmod 400 /etc/cassandra/jmxremote.password
COPY ./jmxremote.password /etc/java-8-openjdk/management/jmxremote.password
docker run -P -d -e" JVM_OPTS = -Djava.rmi.server.hostname = 10.0.1.12" -e" LOCAL_JMX =否" -e
这会引发以下异常:
java.rmi.ConnectException: Connection refused to host: 10.0.1.12; nested exception is:
java.net.ConnectException: Connection refused
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:130)
at javax.management.remote.rmi.RMIServerImpl_Stub.newClient(Unknown Source)
at javax.management.remote.rmi.RMIConnector.getConnection(RMIConnector.java:2432)
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:308)
at sun.tools.jconsole.ProxyClient.tryConnect(ProxyClient.java:368)
at sun.tools.jconsole.ProxyClient.connect(ProxyClient.java:313)
at sun.tools.jconsole.VMPanel$2.run(VMPanel.java:294)
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at java.net.Socket.<init>(Socket.java:434)
at java.net.Socket.<init>(Socket.java:211)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:148)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
... 9 more
有人可以就这个在过去几天完全阻止我的问题提供指导或帮助吗?提前感谢您的时间并分享您的知识。
干杯, Sudoer
答案 0 :(得分:1)
我关闭了jmx身份验证:
Dockerfile:
FROM cassandra
RUN sed -i 's/JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=true"/JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=false"/g' /etc/cassandra/cassandra-env.sh
RUN sed -i '/password/d' /etc/cassandra/cassandra-env.sh
搬运工-compose.yml:
environment:
- LOCAL_JMX=no
- JVM_EXTRA_OPTS=-Djava.rmi.server.hostname=127.0.0.1