Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cassandra on Docker - nodetool connection issue

I was given a R&D task on running Cassandra on Docker. I'm working on XUbuntu 14.04.2 64 bit (installed on VirtualBOX in Windows7 32 bit OS).

I was following the steps given in Docker on Ubuntu and Pokle cassandra tutorials and I got a ConnectException when I tried to check the status of a particular node using the nodetool.

Following is the list of steps that I did.

asela@teamlk:~$ docker run -d --name cass1 poklet/cassandra start
7b2ddfb60adf1c270a425c4440fe263e1fe56f5dc1c3205372bee3b8626e0624

asela@teamlk:~$ docker run -d --name cass2 poklet/cassandra start $(/data/cassandra/scripts/ipof.sh cass1)
4f98a194214e603242279226bb94cee20774058e84b6d0171a8d14d648e19016

asela@teamlk:~$ docker run -d --name cass3 poklet/cassandra start $(/data/cassandra/scripts/ipof.sh cass1)
394f9ce918121c0b79ed8282ba95c8f1badd4e3536d4ad3f24c4c21651e50b3c

asela@teamlk:~$ docker ps
CONTAINER ID        IMAGE                     COMMAND              CREATED              STATUS              PORTS                                                                      NAMES
394f9ce91812        poklet/cassandra:latest   "start 172.17.0.1"   6 seconds ago        Up 3 seconds        22/tcp, 7000-7001/tcp, 7199/tcp, 8012/tcp, 9042/tcp, 9160/tcp, 61621/tcp   cass3               
4f98a194214e        poklet/cassandra:latest   "start 172.17.0.1"   31 seconds ago       Up 29 seconds       22/tcp, 7000-7001/tcp, 7199/tcp, 8012/tcp, 9042/tcp, 9160/tcp, 61621/tcp   cass2               
7b2ddfb60adf        poklet/cassandra:latest   "start"              About a minute ago   Up About a minute   22/tcp, 7000-7001/tcp, 7199/tcp, 8012/tcp, 9042/tcp, 9160/tcp, 61621/tcp   cass1               

asela@teamlk:~$ docker run -i -t poklet/cassandra nodetool -h $(/data/cassandra/scripts/ipof.sh cass1) status
nodetool: Failed to connect to '172.17.0.1:7199' - ConnectException: 'Connection refused'.

ifconfig shows me that my Docker is running on 172.17.42.1

Can someone please tell me if I have missed any configurations and/or if I have done something wrong?

like image 203
Asela Avatar asked Oct 23 '25 04:10

Asela


1 Answers

I am using Fedora 22 but I don't see why it shouldn't work on Ubuntu.

I was having the exact same problem and the following command worked for me:

docker exec cass-1 nodetool status

Notice that cass1 is the name of the docker container for the cassandra node, its used instead of the IP Address.

  • I tried this after reading this post which proved to be quite helpful.
  • The docker exec command definition - Run a command in a running container.

My output:

Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address      Load       Tokens  Owns (effective)  Host ID                               Rack
UN  172.17.0.14  51.6 KB    256     100.0%            3dec79f4-4a6f-46e6-b4d5-14b8f56b6c13  rack1
like image 58
negative Avatar answered Oct 25 '25 19:10

negative