Yum installation and installation of MongoDB 3.4 under CENTOS7 system

Source: Internet
Author: User

Yum installation and installation of MongoDB 3.4 under CENTOS7 system

The first step is to see if there is a MongoDB configuration yum source

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

View File ls

The second part does not exist add Yum source

Create a file Touch Mongodb-3.4.repo

Edit the 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

Here you can modify the gpgcheck=0, eliminating the GPG verification

Update all packages before installing: Yum update (optional operation)

Then install: Yum install-y mongodb-org

View MONGO installation location Whereis Mongod

View Modify Profile: vi/etc/mongod.conf

Start Mongod:systemctl start Mongod.service

Stop Mongod:systemctl Stop Mongod,service

External network access requires the firewall to be turned off:

CentOS 7.0 defaults to using firewall as the firewall, where the iptables firewall is changed.

Close firewall:

Systemctl Stop Firewalld.service #停止firewall

Systemctl Disable Firewalld.service #禁止firewall开机启动

Using Mongodb:mongo 192.168.60.102:27017

>use Admin

>show DBS

>show Collections

After you restart MongoDB, login to the admin account to create a super-privileged user

Use admin

Db.createuser ({User: ' root ', pwd: ' Root ', roles:[{"role": "Root", "db": "Admin"}]});

Configuration

Fork=true # # Allows programs to run in the background

#auth =true # # Start Certification

Logpath=/data/db/mongodb/logs/mongodb.log logappend=true # Write Log mode: set to True for append. The default is to overwrite the dbpath=/data/db/mongodb/data/# # data store Directory

PIDFILEPATH=/DATA/DB/MONGODB/LOGS/MONGODB.PID # Process ID, no PID file is started when it is not specified. Default defaults.

port=27017

#bind_ip =192.168.2.73 # bind address. By default, 127.0.0.1 can only be set to true via local connection # to modify the data directory Storage mode, and each database file is stored in a different folder DBPath the specified directory. # with this option, MongoDB can be configured to store data on different disk devices to increase write throughput or disk capacity. The default is False. # It is recommended to configure the secondary option at the beginning

Directoryperdb=true # Disable log # corresponding to journal enable action log to ensure write persistence and data consistency, create journal directory in DBPath Directory

Nojournal = true # #

Max Connections # Maximum number of connections. Default value: Depends on the system (that is, the Ulimit and file descriptor) limits. # MongoDB does not restrict its own connections. When the setting is greater than the system limit, it is not valid, whichever is the system limit. # Set the value above the size of the connection pool and the total number of connections to prevent spikes in the connection. Note: You cannot set this value to greater than 20000. maxconns=1024


Yum installation and installation of MongoDB 3.4 under CENTOS7 system

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.