1.centos installation of MongoDB

Source: Internet
Author: User
Tags install mongodb mongo shell

First, download
Http://www.mongodb.org/downloads
Choose the right download for your system
Download path:/DATA/SRC
If none:

Mkdir-p/DATA/SRC

Second, decompression

Tar zxvf ... (Omit file name here, tab supplement)

Third, install MongoDB

Note: Cd/data/srcgroupadd mongodbuseradd mongodb-g mongodbmv MONGO (unzipped file) as root/apps/mogodbcd/appschown-r MongoDB: MongoDB mongodbcd mongodb/mkdir-p data/dbmkdir logstouch logs/mongodb.logcd MongoDB (Files copied after decompression)/bin./mongod--dbpath= /apps/mongodb/data/db/--logpath=/apps/mongodb/logs/mongodb.log--logappend--port=27107--fork

Four, random start
Vim/etc/rc.d/rc.local
Added at the end:/apps/mongodb/bin/mongod--dbpath=/apps/mongodb/data/db/--logpath=/apps/mongodb/logs/mongodb.log-- Logappend--port=27107--fork
V. Restart CentOS

Shutdown-r now

Six, into the MONGO shell
Under the Bin directory

./mongo

The following error occurred:

MongoDB Shell version:3.0.2connecting to:test2015-05-06t13:38:16.832+0800 W NETWORK Failed to connect to 127.0.0.1:2701 7, reason:errno:111 Connection refused2015-05-06t13:38:16.834+0800 E QUERY error:couldn ' t connect to server 127.0.0.1 : 27017 (127.0.0.1), connection attempt failed at connect (src/mongo/shell/mongo.js:179:14) at (Connect): 1:6 at src/m Ongo/shell/mongo.js:179exception:connect failed

Vii. Solutions:

Rm-f/apps/mongodb/data/db/mongod.lock

Viii. restart./mongo but I failed again.
Nine, (small white) I think maybe the mongod service didn't start, and then I tried.

Service Mongod Start

As a result you may have guessed it:
Mongod:unrecognized Service
From the Internet to find a bit, there is a permission problem, that is, install what is root, but Mongod is the user MongoDB (later I refer to another document to fix)
Ten, I think, I will be in the MongoDB installation directory under the bin execution

./mongod

Then I open another terminal, re-enter/apps/mongodb/mongo (extracted filename)/bin under the execution

./mongo

11, now it's done.

MongoDB Shell version:3.0.2connecting to:testwelcome to the MongoDB shell.

Note 1: Start following tomener in the Sina Weibo tutorial, hereby thank you, original: http://blog.sina.com.cn/s/blog_75ad10100101q36s.html
After reference http://www.2cto.com/database/201501/366305.html, thanks again

Note 2: Because of their own level limited, for reference only, if there are errors, please correct me, thank you!

1.centos 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.