Get the App
SLTechnology News&Howtos  ›  Database  › 

Start of the MongoDB service

Shulou Source: shulou.com Published: 2022-06-01 04:17:19 11月16日 Update

Mongo startup configuration file:

In mongo.conf:

Port=27017

Dbpath=/usr/local/mongodb/data/

Logpath=/usr/local/mongodb/log/mongodb.log

Fork = true

The following articles are reproduced

Original address: http://www.cnblogs.com/oec2003/archive/2011/11/03/2742000.html

Primitive mode

Only when the service of MongoDB is started can you use the function of MongoDB. Usually, a command window is opened and the following command is entered to start the service:

Configuration file mode

If you don't want to enter a lot of tedious parameters on the command line every time you start, you can save the parameter information in the configuration file. Create a configuration file called mongodb.cnf and put it in the same directory as the gadgets. The contents of the file are as follows:

Dbpath= "d:\ database\ mongodb\ data"

Then enter the following command in the command window to start the service

It seems similar to the above method, but you still need to specify a configuration file, but if the parameter is more than-dbpath, you can write all the parameters in the configuration file, which will be much more convenient when called on the command line.

Daemon mode

The two ways to start the service described above require the opening of a command line window, and the service stops when the window is closed. We can use the-- fork parameter to run mongodb's service in the background, which is relatively safe. -- the fork parameter is used with the-- logpath parameter.

Tags: Parameters commands files services configuration method time input face original security tedious almost information content function original text only background address Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Microsoft Xiaomi Apple Huawei