Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Start of the MongoDB service

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report