Install MongoDB 3.4 on yum in CentOS 7

Source: Internet
Author: User
Tags install mongodb mongodb query

Install MongoDB 3.4 on yum in CentOS 7

Install MongoDB 3.4 on yum in CentOS 7.

Step 1 check whether the yum source is configured for Mongodb

Switch to the yum directory cd/etc/yum. repos. d/

View File ls

The second part does not add the yum source.

Create File touch mongodb-3.4.repo

Edit this file vi mongodb-3.4.repo

Content:

Cat/etc/yum. repos. d/mongodb-3.4.repos

Mongodb-org-3.4

Name = MongoDB Repository

Baseurl = https://repo.mongodb.org/yum/redhat/?releasever/mongodb-org/3.4/x86_64/

Gpgcheck = 1

Enabled = 1

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

You can modify gpgcheck = 0 to save gpg verification.

Update all packages before installation: yum update (optional)

Then install: yum install-y mongodb-org

View mongo installation location whereis mongod

View the modified configuration file vi/etc/mongod. conf.

Start cmdd: systemctl start cmdd. service

Stop mongod: systemctl stop mongod, service

Disable the firewall for Internet access:

CentOS 7.0 uses firewall as the firewall by default. Here, it is changed to iptables firewall.

Disable firewall:

Systemctl stop firewalld. service # stop firewall

Systemctl disable firewalld. service # disable firewall startup

Use mongodb: mongo 192.168.60.102: 27017

> Use admin

> Show dbs

> Show collections

After Mongodb is restarted, log on to the admin account and create a super privilege user.

Use admin

Db. createUser ({user: 'root', pwd: 'root', roles: [{"role": "root", "db": "admin"}]});

Configuration

Fork = true # Allow programs to run in the background

# Auth = true # Start Authentication

Logpath =/data/db/mongodb/logs/mongodb. log logappend = true # log writing mode: Set true to append. By default, dbpath =/data/db/mongodb/data/# data storage directory is overwritten.

Pidfilepath =/data/db/mongodb/logs/mongodb. pid # process ID. If it is not specified, no PID file is found at startup. Default.

Port = 27017

# Bind_ip = 192.168.2.73 # bind an IP address. The default value is 127.0.0.1, which can only be set to true through local connection #. Modify the data directory storage mode. The files of each database are stored in different folders in the specified directory of DBPATH. # With this option, you can configure MongoDB to store data on different disk devices to increase write throughput or disk capacity. The default value is false. # It is recommended that you configure the option at the beginning.

Directoryperdb = true # disable logs # enable operation logs corresponding to journal to ensure the write persistence and data consistency. The journal directory is created under the dbpath directory.

Nojournal = true ##

Max connections # maximum number of connections. Default Value: Depends on the system (that is, the ulimit and file descriptor) restrictions. # MongoDB does not limit its own connections. If the setting is greater than the system limit, it is invalid. The system limit prevails. # Set the value to be greater than the connection pool and total connections to prevent connections during peak hours. # Note: The value cannot be greater than 20000. MaxConns = 1024

For more MongoDB tutorials, see the following:

Introduction to MongoDB documents, collections, and databases

MongoDB 3 shard deployment and Fault Simulation

Install MongoDB in CentOS 6.5 yum

Quick installation of MongoDB using CentOS 7 yum

MongoDB query operations

Quickly build MongoDB clusters on Azure virtual machines

Principles of MongoDB replica set

MongoDB 3.4 remote connection authentication failed

Install MongoDB3.4 database system in Ubuntu 16.04

MongoDB authoritative guide 2nd PDF complete with bookmarks directory download see

MongoDB details: click here
MongoDB: click here

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.