docker-library / cassandra

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

How to restart the cassandra after modify the cassandra.yaml file? #140

Closed Danissss closed 6 years ago

Danissss commented 6 years ago

Hi, I have been trying to make a cassandra cluster using docker swarm and the official cassandra image, but I noticed that after I changed the cassandra.yaml file (e.g. change the seeds), and then I run the nodetool status, the node ip is still the same. So, I am wondering this happened because I didn't properly restart the cassandra after I modified the cassandra.yaml file.

However, when I try service cassandra restart or /etc/init.d/cassandra restart, I always got [....] Restarting Cassandra: cassandra
/etc/init.d/cassandra: 72: ulimit: error setting limit (Operation not permitted)
. ok

And then the result from nodetool status is still the same as before. Therefore, I couldn't make the new node to see the seed node (ps. these two nodes are distributed at different machine/instances)

I am just wondering how to restart the cassandra or how to make the change to cassandra.yaml effective.

Thank you so much!

yosifkit commented 6 years ago

Neither of these will work: service cassandra restart or /etc/init.d/cassandra restart since there is no supervisor or init system running in the container. Cassandra is the only thing running in the container; if the cassandra process (ie the jvm) exits then the container will exit.

Restarting the container (docker restart, or stop/start) is the expected interface for interacting with the process in the container.

Danissss commented 6 years ago

Hi, thank you for your reply.

I tried docker container restart after I modified the cassandra.yaml file inside the container (for example, I changed the seeds from 1.1.1.1 to 1.1.1.2, so that to make the node to see other node). however, after I restart the container, the seeds went to back to 1.1.1.1. So do you know how to apply the changes to cassandra.yaml file after I modified it?

And also, I have been trying to make a cassandra cluster with docker swarm mode with multiple virtual machine and using overlay network (created by docker network create), and I tried every possible combinations of yaml file (for stack -c composefile.yaml cassandra), but none of them work. I also made sure the every port is open for both virtual machine and container. After I changed the seeds (in cassandra.yaml)for each cassandra containers, they just don't see each other. May I ask you for some suggestions?

Thank you so much!

wglambert commented 6 years ago

If you want to persist changes to the file then you want to mount it was a volume, for help with making a cluster/swarm see https://github.com/docker-library/cassandra/issues/94#issuecomment-311839953

Closing since there isn't any error in the image and you'd get better help with questions at the Docker Community Forums, the Docker Community Slack, or Stack Overflow.