Closing MongoDB Cleanly Closed Cluster

Currently, I have mongoDB setup with a mongos server, a configuration server and two shards of 3 mongod (master-slave) servers. I would like to make sure that when I turn them off, they will be closed so as not to lose the data that is queued, or while the server determines the shard for writing, etc.

What is the best practice for closing a MongoDB server cluster?

What order is best to close, call fsync, write locks, etc.

I would like to write a script to automate this, in order to facilitate backups, new code presses and everything else that otherwise requires the database to be in a consistent state.

+3
source share
1 answer

These best practices are still truly eliminated.

With your setup here, how will I do server maintenance.

Reserve

Find non-primary in each replica set. Run fsync and block . Copy, tar, backup. Unlock the database.

You should be able to do this successfully in a replica set. If you are really worried, you can execute fsync and lock and then shut down.

compression

You probably want to compress the data at some point. The easiest way to do this is to execute fsync and lock again, and then do db.repairDatabase (). The recovery team basically does the defragmentation / compression for you. As above, it can also be turned off with a shutdown.

, . / . , , .

, , , , " ", " node", " RAM", " ". , , .

+3

Source: https://habr.com/ru/post/1778035/


All Articles