I'm looking to setup a development testing environment and while I have things mostly setup I'm having difficulty connecting from the host machine (which is running Visual Studio) to the Cassandra cluster in docker (using Docker Desktop for Windows). I'm guessing I'm just messing up the configuration settings and/or missing a setting; but cannot determine how to make this work (it does work for single node; just not multiple nodes, which is what I want to work with)
What I have setup:
docker run --name tnode1 -d -e CASSANDRA_CLUSTER_NAME=tcluster -e CASSANDRA_DC=TDC1 -e CASSANDRA_RACK=TRAC1 -e CASSANDRA_BROADCAST_ADDRESS=10.0.75.2 -e CASSANDRA_ENDPOINT_SNITCH=GossipingPropertyFileSnitch cassandra
I've also tried with the -p switch
docker run --name tnode1 -d -p 9042:9042 -e CASSANDRA_CLUSTER_NAME=tcluster -e CASSANDRA_DC=TDC1 -e CASSANDRA_RACK=TRAC1 -e CASSANDRA_BROADCAST_ADDRESS=10.0.75.2 -e CASSANDRA_ENDPOINT_SNITCH=GossipingPropertyFileSnitch cassandra
This seems to work in terms of if I put data in this and then connect to 10.0.75.2 from Visual Studio, everything works as I'd expect it to. The issue comes when I go to add another node.
I've tried a number of ways, but it seems like they all end up with the second note starting up and then exiting and never joining the cluster. If I leave out the CASSANDRA_BORADCAST_ADDRESS when setting up tnode1 then the cluster works, but I cannot get to it from Visual Studio.
Second Node (General Information)
docker inspect -f '{{ .NetworkSettings.IPAddress }}' tnode1 returns 172.17.0.2 docker exe -it tnode1 nodetool status has the address as 10.0.75.2
Second Node (Attempt 1)
docker run --name tnode2 -d -e CASSANDRA_CLUSTER_NAME=tcluster -e CASSANDRA_DC=TDC1 -e CASSANDRA_RACK=TRAC1 -e CASSANDRA_SEEDS=172.17.0.2 ca ssandra result: running nodetool status doesn't show tnode2 ... running docker ps -a shows "Exited (3) 30 seconds ago" for status
Second Node (Attempt 2)
docker run --name tnode2 -d -e CASSANDRA_CLUSTER_NAME=tcluster -e CASSANDRA_DC=TDC1 -e CASSANDRA_RACK=TRAC1 -e CASSANDRA_SEEDS=10.0.75.2 ca ssandra result: running nodetool status doesn't show tnode2 ... running docker ps -a shows "Exited (3) 28 seconds ago" for status
It seems as if the seed value isn't connecting and the new node then stops as a result. Again if I take out the broadcast address then the node creation works, but I cannot connect from the host machine; I've attempted to add listener address, and -p parameter on tnode1 creation, but similar results.
Any assistance would be greatly appreciated.
The following compose cluster definition works for me, I can connect with cqlsh from the Docker host and run the test cql.
The memory is adjusted down from the default 1.5G as every time I brought up a new node, the previous node would exit due to a lack of memory in the Docker VM.