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

The installation and startup method of mongodb

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to install and start mongodb". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to install and start mongodb.

Official document

Installation: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/

Startup and shutdown: https://docs.mongodb.com/v3.6/tutorial/manage-mongodb-processes/#terminate-mongod-processes

At present, there are two installation methods, one is to install rpm directly, and the other is to use tar package to decompress.

Direct installation of rpm

1. Configure / etc/security/limits.conf parameters

2. The configuration / etc/yum.repos.d/mongodb-org-3.6.repo file is as follows

[mongodb-org-3.6]

Name=MongoDB Repository

Baseurl= https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.6/x86_64/

Gpgcheck=1

Enabled=1

Gpgkey= https://www.mongodb.org/static/pgp/server-3.6.asc

3. Yum install-y mongodb-org

The mongod user is automatically established, the data directory / var/lib/mongo and the log directory / var/log/mongodb are automatically established, the permissions of these two directories are paid to the mongod user, the configuration file / etc/mongod.conf is automatically established, and the mongod service is automatically added to the service, and systemctl start mongod can be executed.

Tar installation

1. Yum install libcurl openssl is required (this step is required for version 4.0, but not for version 3.6)

2. Establish mongodb user, configuration / etc/security/limits.conf parameters

3. Extract the tar package and authorize mongodb users to extract the directory.

4. Configure the bash_profile file path to add the bin directory of the decompressed directory

5. Edit the configuration file of mongodb and execute the mongod command to invoke the configuration file.

Mongod-f / mongodb/mongodb.conf

Start

Use the mongod command, followed by parameters

Close

Method 1.

Use admin

Db.shutdownServer ()

Method 2.

Mongod-shutdown

Method 3.

Kill-- do not add-9

Close Replica Set

Db.adminCommand ({shutdown: 1, force: true})

Experimental case

[mongodb@zabbixtest1] $mongod-f / mongodb/mongodb.conf

About to fork child process, waiting until server is ready for connections.

Forked process: 25496

Child process started successfully, parent exiting

[mongodb@zabbixtest1 ~] $ps-ef | grep mongo

Mongodb 25496 1 0 22:59? 00:00:02 mongod-f / mongodb/mongodb.conf

[mongodb@zabbixtest1] $mongod-- shutdown

There doesn't seem to be a server running with dbpath: / data/db

[mongodb@zabbixtest1] $mongod-- shutdown-f / mongodb/mongodb.conf

Killing process with pid: 25496

At this point, I believe that everyone on the "mongodb installation and startup method" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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