1.MongoDB after the introduction of read and write separation, restart service time is longer, you can see the following printing:
Your mercy for graceful operations on workers are seconds
Search related data discovery can reduce the service restart time by setting the maximum timeout time, uwsgi default reload time-out is 60s, can be changed by setting Worker-reload-mercy, let's take a look at Uwsgi Official document Description:
Reload-mercy
Argument:required_argument
Parser:uwsgi_opt_set_int
Help:set the maximum time (in seconds) we wait for workers and other processes to die during Reload/shutdown
Worker-reload-mercy
Argument:required_argument
Parser:uwsgi_opt_set_int
Help:set the maximum time (in seconds) a worker can take to Reload/shutdown (default is 60)
Reload-mercy is the timeout that controls the entire UWSGI instance
Worker-reload-mercy is a timeout that controls a single worker
So add the UWSGI boot configuration file:
Worker-reload-mercy = 1
Although the service restart time has been shortened, some workers will not be able to boot when the service is deployed, or the process will be dead as the worker cannot restart over time. Later through the analysis of UWSGI configuration parameters, find Lazy-apps This parameter, look at the Official document description:
Lazy-apps
Argument:no_argument
Parser:uwsgi_opt_true
Help:load apps in each worker instead of the master
When loading apps, each worker is responsible for loading, not the Master fork, and after adding this parameter, the service restart time is gone, the service can be restarted quickly, and the worker will not die. So far also did not understand the specific why, have a clear classmate tell a sound.
2.MongoDB replica set when the official document description only needs to fill in a MongoDB instance address, but the actual measurement found that there is a problem, if the completed MongoDB instance is not available, restart the service at this time, the service can not connect to the MONGODB replication cluster, therefore, Recommended to connect the replication cluster, write a few MongoDB instance address, as far as possible to write the whole, so that even if there is an instance is not available, but also through other instances to get the entire cluster of information
Note: MongoDB client is using the pymongo2.7 version