Mongodb background running, mongodb background
By default, if shell is disabled, mongodb stops running.
To run it in the background, you only need to add the -- fork function at startup.
You can add -- logappend to the Log Path to prevent logs from being deleted.
Bin/mongodb -- fork -- dbpath = // -- logpath = // -- logappend
Run it in the background. If you want to disable it, send shutdownServer () to it ()
1. Common commands: $./mongod> use admin> db. shutdownServer ()
Note that this command is only allowed locally or an authenticated client.
2. If this is a master-slave replication cluster, it will be closed after version 1.9.1 following the steps below
- Check the data update time from Mongodb
- If the time difference between all the slave Mongodb and the master database exceeds 10, the mongodb will not be closed at this time (in this case, we can configure timeoutSecs to update the data from the Mongodb)
- If there is a time difference between Mongodb and the primary service within 10 seconds, the primary server will be shut down and wait until the updates from the primary service are complete and closed.
3. If you do not have up-to-date data from Mongodb and want to force disable the service, you can add force: true. The command is as follows:> db. adminCommand ({shutdown: 1, force: true})> // or> db. shutdownServer ({force: true })
4. Shut down the server at a specified time-out. The command is the same as above, and a timeoutsec is added: parameter> db. adminCommand (shutdown: 1, force: true, timeoutsec: 5)> // or> db. shutdownServer ({force: true, timeoutsec: 5 })
Who knows about mongodb's mapreduce?
Map: it can be understood as the data to be filled. In SQL, it is like the portion of the where condition to be filtered;
Reduce: it can be understood as the field to be displayed;
Because mapreduce is very difficult for beginners to understand. We recommend that you start with the simple group method;
In addition, the performance of MapReduce is very low. Unless the background statistics are performed, do not use MapReduce or query it as the front-end data access method.
When I install mongodb, I run mongodexe, but the results on the Internet are different. Why?
-Nojournal