Last active
March 24, 2022 10:13
-
-
Save rodneytamblyn/822d9b1b1c8f2f8d7df1c792720d4382 to your computer and use it in GitHub Desktop.
docker cassandra graceful shutdown and safe restart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| alias shutdown="cass-gracefulStopDatabase-and-reboot" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cass-gracefulStopDatabase-and-reboot() { | |
| logger -s "ob3 - Cassandra database docker container is gracefully stopping....." | |
| docker exec -it MYCASSANDRACONTAINERNAME nodetool flush | |
| docker exec -it MYCASSANDRACONTAINERNAME nodetool stopdaemon | |
| #dont stop docker database or it wont automatically restart on reboot | |
| logger -s "ob3 - C* stopped but container still running. Restart with docker stop database and docker start database" | |
| #don't just use shutdown as we have aliased that and it will loop... | |
| #continue shutdown/restart | |
| /usr/sbin/shutdown $1 $2 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment