Article From:https://www.cnblogs.com/renmengkai/p/9125622.html

First of all, when I install MongoDB, I have a problem:

Because the MongoDB version is updated, now the official website download page is the 3.6 version of the download. But the installation fails and will prompt “

your system has not been modify

The problem should be that the compatibility of the win10 version is not perfect, so it is recommended to download the 3.4 version: 3.4 version, I download.

The following article is reproduced by self seeking blogs (deleting)

MongoDBIt is a non relational database written in C++ language. It is an open source database system based on distributed file storage. Its content is similar to JSON object. Its field values can contain other documents, arrays and array of documents. It is very flexible.

MongoDBSupport a variety of platforms, including Windows, Linux, Mac OS, Solaris, and so on, and the corresponding installation packages can be found on their official website (https://www.mongodb.com/download-center).

In this section, let’s take a look at the installation process.

1. Related links

  • official website: https://www.mongodb.com
  • official document: https://docs.mongodb.com
  • GitHub:https://github.com/mongodb”
  • Chinese tutorial: http://www.runoob.com/mongodb/mongodb-tutorial.html

2. WindowsLower installation

Here directly in the official website (as shown in Figure 1-29) click the DOWNLOAD button to download the MSI installation package.

Figure 1-29 MongoDB official network

When the download is completed, double click it to install and specify the installation path of the MongoDB, for example, the installation path I specified here is C:\MongoDB\Server\3.4, as shown in Figure 1-30. Of course, you can choose the path on your own.

Figure 1-30 specifies the installation path

Click the Next button to execute the installation.

After the installation is successful, enter the installation directory of MongoDB, here is C:\MongoDB\Server\3.4, and create the same directory data in the bin directory, as shown in Figure 1-31.

Figure 1-31 new data directory

Then enter the data folder, create a new sub folder DB to store the data directory, as shown in Figure 1-32.

Figure 1-32 new DB directory

After that, open the command line, enter the bin directory of the MongoDB installation directory, run the MongoDB service:

 

 

Please remember to replace the path here to your host MongoDB installation path.

After running, there will be some output information, as shown in Figure 1-33.

Figure 1-33 running results

So we start the MongoDB service.

But if we want to use MongoDB all the time, we cannot close the command line. If an accident is closed or restarted, the MongoDB service can not be used. This is obviously not what we want. So, next, we need to configure MongoDB as system service.

First, run the command line with the administrator mode. Note that this must be run as an administrator, otherwise the configuration may fail, as shown in Figure 1-34.

Figure 1-34 runs as an administrator

Search CMD in the start menu, find the command line, and right-click it to run as an administrator.

Then a new log file is built to create a new logs level directory in the bin directory, and then a new mongodb.log file is built to save the MongoDB’s run log, as shown in Figure 1-35.

Figure 1-35 new mongodb.log file

Enter the following contents under the command line:

 

 

This means binding IP to 0.0.0.0 (that is, any IP can access), specifying the log path, database path and port, specifying the service name. It should be noted that there is still a need to replace the path to your MongoDB installation path. You can install the service after you run the command.The line results are shown in Figure 1-36.Figure 1-36 running results

If there is no error prompt, it is proved that the MongoDB service has been installed successfully.

You can view the system service on the service management page, as shown in Figure 1-37.

Figure 1-37 system service page

Then it can set up its boot mode, such as automatic start or manual start, so that we can manage MongoDB services very conveniently.

When the service is started, it can be used under the command linemongoThe command enters the MongoDB command interaction environment, as shown in Figure 1-38.

Figure 1-38 command line mode

In this way, the MongoDB configuration under Windows is completed.

3. LinuxLower installation

Here, take MongoDB 3.4 as an example to illustrate the installation process of MongoDB.

Ubuntu

First, import the MongoDB’s GPG key:

 

 

The apt-get source list is then created, and the commands corresponding to each system version are as follows.

  • Ubuntu 12.04The corresponding commands are as follows:
  • Ubuntu 14.04The corresponding commands are as follows:
  • Ubuntu 16.04The corresponding commands are as follows:

Then update the apt-get source:

 

 

Then install MongoDB:

 

 

After the installation is completed, the MongoDB is run, and the command is as follows:

 

 

After running the command, MongoDB runs on the 27017 port, and the data files are saved under the /data/db path.

In general, we configure MongoDB on Linux for remote connections, so we also need to configure the remote connection of the MongoDB and the username and password.

Then, enter the MongoDB command line:

 

 

Now we have entered the command line interaction mode of MongoDB. Under this mode, run the following commands:

 

 

In this way, we created a user with a user name of admin and a password of admin123, giving the highest permissions.

Then we need to modify the configuration file of MongoDB.

 

 

And then modify itnetSome are:

 

 

After this configuration, MongoDB can be remotely accessed.

In addition, you need to add the following permission authentication configuration.

 

 

After the configuration is completed, we need to restart the MongoDB service. The commands are as follows:

 

 

In this way, remote connection and permission authentication are completed.

CentOSAnd Red Hat

First, add the MongoDB source:

 

 

Then modify the following and save:

 

 

Then executeyumCommand installation:

 

 

The command to start the MongoDB service here is as follows:

 

 

The commands for stopping and reloading MongoDB services are as follows:

 

 

For remote connection and authentication configuration, you can refer to the same way before.

More Linux distribution MongoDB installation can refer to official document: https://docs.mongodb.com/manual/administration/install-on-linux/.

4. MacLower installation

It is recommended to use Homebrew installation and execute directlybrewThe command can:

 

 

Then create a new folder /data/db for storing MongoDB data.

The command to start the MongoDB service here is as follows:

 

 

The commands for stopping and restarting the MongoDB service are:

 

 

5. Visualization tools

Here is a visualization tool, RoboMongo/Robo 3T, which is easy to use, powerful, the official website is https://robomongo.org/, the three big platforms are all supported, and the download link is https://robomongo.oRg/download.

In addition, there is a simple and easy to use visual tool, Studio 3T, which also has a convenient graphical management interface, the official website is https://studio3t.com, and it also supports three big platforms, and the download link is https://studio3T.com/download/.

Reprint, please specify: static search [Python3 web crawler development] 1.4.2-MongoDB installation

Leave a Reply

Your email address will not be published. Required fields are marked *