Search code examples
dockercassandra-2.0boot2docker

cqlsh to Cassandra single node running in docker


I am learning cassandra 2.1.1:

I have a docker container running a cassandra node. I am able to csqlsh into the cassandra node itself from within the node. It says "127.0.0.1:4096". I am aware it is localhost and has something to do with "listen_address" in the cassandra.yml setting.

When using the boot2docker ip address it does not work. I have started the container with -p port 4096 & 9160 but with no luck. I have tried to change "listen_address" to the boot2docker ip address, but same error when cqlsh

Info:
1. the cqlsh client and the cassandra node is running cassandra 2.1.1
2. I have started cassandra on the node by running ./cassandra

Any suggestions?

Thanks


Solution

  • Happened to me, able to cqlsh within container, but unable to connect from outside the docker container host, when I realized using v2.1 that DOES NOT use 9160:

    From the cqlsh documentation:

    So, you should get clqsh client to use IP of the host containing the docker container at 9042 and not 9106. Use docker ps and netstat -atun | grep LIST and telnet to confirm the right port is in LISTEN status.

    docker run -d -p 9042:9042 cassandra:2.2
    docker run -d -p 9042:9042 poklet/cassandra
    

    Requirements

    In Cassandra 2.1, the cqlsh utility uses the native protocol. In Cassandra 2.1, which uses the Datastax python driver, the default cqlsh listen port is 9042.

    In Cassandra 2.0, the cqlsh utility uses the Thrift transport. In Cassandra 2.0.x, the default cqlsh listen port is 9160.

    Cassandra cqlsh - connection refused