docker-library / cassandra

Docker Official Image packaging for Cassandra
Apache License 2.0
262 stars 281 forks source link

Using swarm mode to create a cassandra cluster with multiple machine (instance) #139

Closed Danissss closed 6 years ago

Danissss commented 6 years ago

Hi, I would like to open an issue about creating a cluster with multiple machine (instance) that exist in same subnet.

I know this question is kind of duplicated from issue #94 , but after I read all the response, I still get very confused.

Assume that I enabled the swarm mode and let other machine join the swarm as worker, and also, I create the overlay network by sudo docker network create --driver overlay --scope swarm cassandra-net

Indeed, I tried many different yaml file from internet, such as this one. However, when I tried to compose it with docker stack deploy, all the services failed to create node ID NAME MODE REPLICAS IMAGE PORTS fz0p7gvutwip cassandra_cassandra-1 replicated 0/1 cassandra:latest *:30010->7000/tcp,*:30011->7199/tcp,*:30012->7001/tcp,*:30013->9160/tcp,*:30014->9042/tcp mv49l208lq57 cassandra_cassandra-2 replicated 0/1 cassandra:latest *:30000->7000/tcp,*:30001->7199/tcp,*:30002->7001/tcp,*:30003->9160/tcp,*:30004->9042/tcp xveitbg29boc cassandra_cassandra-3 replicated 0/1 cassandra:latest *:30005->7000/tcp,*:30006->7199/tcp,*:30007->7001/tcp,*:30008->9160/tcp,*:30009->9042/tcp

Then, I tried manually create the service by sudo docker service create --replicas 3 --name "tesetCluster" --network cassandra-net cassandra the services can successfully create 3 cassandra container and use the network cassandra-net But, after I check the nodetool status sudo docker exec -it e4f77b71a6fa nodetool status

I only got one node for that container

Datacenter: datacenter1 Status=Up/Down |/ State=Normal/Leaving/Joining/Moving -- Address Load Tokens Owns (effective) Host ID Rack UN 10.0.0.25 103.69 KiB 256 100.0% 9732c109-42ad-4d39-8d4c-d631bd7e8237 rack1

I know that I didn't modify the seeds and broadcast_seeds for each cassandra container, but I don't know how to setup the seed for all containers that I created by using service and make those containers point to (see) each other to make a cluster.

And could I ask how to create the correct yaml file for stack deploy to do that.

Thank you very much. PS. all ports for cassandra opened in each instance (since they use same security group)

yosifkit commented 6 years ago

Duplicate of #94