Unable to connect to cassandra Docker from docker host / externally

34 Views Asked by At

I have created cassandra 4.0.6 Docerfile and when testing locally i am unable to access the same on localhost cqlsh. I am getting following error response:

Connection error: ('Unable to connect to any servers', {'127.0.0.1:9042': ConnectionShutdown('Connection to 127.0.0.1:9042 was closed',)})

Where as following command works fine:

docker exec -it cassandra bash -c "cqlsh -u cassandra -p cassandra"

Following is my docker run command:

docker run -p 9842:9842 -p 127.0.0.1:9042:9042 -p 127.0.0.1:9160:9160 --network graphnetwork -e CASSANDRA_USERNAME=cassandra -e CASSANDRA_PASSWORD=cassandra -v csdata:/opt/cassandra/data -v ./logs:/opt/cassandra/logs --memory=8g --memory-reservation=512m -e ES_HEAP_SIZE=2g --name cassandra  imgcassandra 

am I missing anything?

0

There are 0 best solutions below