The initial mongodb------Create MongoDB as a Windows service

Source: Internet
Author: User
Tags create mongodb

The last time I wrote about basic MongoDB installation, may not be very detailed, but also written very bad, but we will say in detail, if you deploy MongoDB on your Windows computer.

1. Configure Environment variables

If it's going to be a lot of trouble to go into the bin directory of the MongoDB on the cmd every time, then we'll just add it directly to the environment variable.

First right click on My Computer click Properties, find advanced system settings, then enter

And then we see the environment variables.

Then click Enter to find the path column

The path path is stored in the bin path of each application, as long as it is configured here, you can use the EXE on the bin directory to execute the program on CMD.

Use ";" between each path Separate the MongoDB bin directory and add it to it.

Then we open cmd and we can use Mongod, MONGO and so on.

Two. Add MongoDB as a Windows service

There are two ways to add MongoDB as a Windows service, like starting a MONGO instance, you can start with a command directly or with a configuration file. But the basic is the same, the configuration file is nothing more than the parameters in it.

Because I already have two MongoDB service on my computer, so I'll show you the way to the configuration file directly.

First, you create a folder to put your database, and then build the following directory

DB is to put the database file, logs log file, config is put configuration file

Now let's see what's in the config file.

The first two are very understood, the third is the open log function, this log is not our usual log, is used for a single MongoDB instance emergency recovery.

The fourth one is log file append.

The last one is the port

Save it and we're ready to go.

You need to open cmd as an administrator (remember, you must, or the creation fails)

The command is MongoDB--auth--install--servicename "dbmongo_self"--servicedisplayname "dbmongo_self"-F E:\MongoDB_Self\db_ Drivertest\config\mongodb.conf

If you just build a MongoDB service, as long as the servicename parameters can be, if you want to build a few more servicedisplayname, or will create a failure

Once created, we go to service Manager to see

Then click on the start-up just fine.

And then you can connect with Robomongo.

The initial mongodb------Create MongoDB as a Windows service

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.