Redhat the installation of MongoDB

Source: Internet
Author: User

1. Create a Mongodb-org-3.0.repo file

[Email protected] local]# Vi/etc/yum.repos.d/mongodb-org-3.0.repo

2, add the following in the Mongodb-org-3.0.repo file

[Mongodb-org-3.0]name=mongodb repositorybaseurl=http://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/ X86_64/gpgcheck=0enabled=1

3, perform the following command to install

sudo yum install-y mongodb-org

Display the information that was already installed successfully

---------------------------------------------------------------------------------------------------------------                                                                                                                                               Total-------------------------------------------------------------------  552 kb/s |    MB 00:01:27 Running Transaction checkrunning transaction testtransaction test succeededrunning transaction installing                                                                                                                           : mongodb-org-shell-3.0.2-1.el7.x86_64                                                                                                                           1/5 Installing: mongodb-org-tools-3.0.2-1.el7.x86_64 2/5 Installing: mongodb-org-                                                                                                                          Mongos-3.0.2-1.el7.x86_64 3/5 Installing: Mongodb-org-seRver-3.0.2-1.el7.x86_64                                                                                                                                 4/5 Installing: mongodb-org-3.0.2-1.el7.x86_64 5/5 in verification: mongodb-org-3.0.2-1.el7.x86_6                                                                                                                                 4                                                                                                                          1/5 in verification: mongodb-org-server-3.0.2-1.el7.x86_64                                                                                                                          2/5 in verification: mongodb-org-mongos-3.0.2-1.el7.x86_64   3/5                                                                                                   Verified in: mongodb-org-tools-3.0.2-1.el7.x86_64                        4/5 in verification: mongodb-org-shell-3.0.2-1.el7.x86_64                                                                                                                            5/5 installed: mongodb-org.x86_64 0:3.0.2-1.el7 Installed as dependency: mongodb-org-mongos.x86_64 0:3.0.2-1.el7 mongodb-org-server.x86_64 0:3.0.2-1.el7 m ongodb-org-shell.x86_64 0:3.0.2-1.el7 mongodb-org-tools.x86_64 0:3.0.2-1.el7 finished!


4, after installation, mongodb default data file in /var/lib/mongo, log file in /var/log/mongodb. If you need to specify the data file directory and log directory yourself, repair it in /etc/mongod.conf . If you need to switch users to run MongoDB, modify the permissions of the data file and log file directories to the specified user


5, execute the following command to start MongoDB

[[email protected] local]# sudo service mongod start



6, close execute the following command (the shutdown command provided in the official documentation, sudo service Mongod stop executes, the process persists causing port occupancy)

Mongod  --shutdown  --dbpath/var/lib/mongo




Note: 1, the following reasons are generally modified data files directory and log file directory, and do not have the appropriate permissions to the user running MongoDB. WORKAROUND: Authorize

Mongod.service-sysv:mongo is a scalable, document-oriented database.   Loaded:loaded (/etc/rc.d/init.d/mongod)   active:failed (Result:exit-code) since five 2015-05-08 13:54:05 CST; 2min 13s Ago  process:4493 Execstart=/etc/rc.d/init.d/mongod Start (code=exited, Status=1/failure)

Note: 2, the following error is typically performed after the sudo service Mongod stop, while the MONGODB process is not closed. Workaround: Close by Mongod--shutdown--dbpath/var/lib/mongo


Note: 3, the default MongoDB is not permission for users, authorization needs to be set in /etc/mongod.conF, add user in MongoDB shell

Bye[[email protected] local]# MONGO 192.168.xx.xxmongodb Shell version:3.0.2connecting to:192.168.xx.xx/test> Switched to DB admin> Db.createuser ({User: "root", pwd: "joeyon1985", Roles: ["ReadWrite"]}) successfully added US ER: {"user": "Root", "roles": ["ReadWrite"]}> db.createuser ({User: "root", pwd: "joeyon1985", Roles: ["Readwri TE "]})



Add by joeyon1985


Redhat the installation of MongoDB

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.