Cassandra docker - unable to connect through JMX

Viewed 2108

I'm having a hard time connecting through JMX to Cassandra inside a docker container. I'm running in AWS (which means I get a NATted IP). Here are the things I've tried:

  1. Created jmxremote.password file
  2. Added jmxremote.password file to enable jmx connection. My Dockerfile from which I've created my image:

FROM cassandra:latest

COPY ./jmxremote.password /etc/cassandra/jmxremote.password

RUN chmod 400 /etc/cassandra/jmxremote.password

COPY ./jmxremote.password /etc/java-8-openjdk/management/jmxremote.password

  1. I built the image using the above docker file
  2. Run the container:

    docker run -P -d -e "JVM_OPTS=-Djava.rmi.server.hostname=10.0.1.12" -e "LOCAL_JMX=no" -e

This throws the following exception:

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

  1. I tried setting listen_address in cassandra.yaml file to my host IP (10.0.1.12) since this is set to the docker IP by default. Same result
  2. I also tried setting the environment variable "CASSANDRA_START_RPC=true" when starting the container but I am hitting the same issue

Can someone please provide pointers or help regarding this issue which has completely blocked me for the past couple of days? Thanks in advance for your time and sharing your knowledge.

Cheers, Sudoer

1 Answers
Related