Install MongoDB in centos (secondary modification)

Source: Internet
Author: User
Tags install mongodb

1. Download the installation package
Wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-1.8.2.tgz

Decompress the package after the download is complete.
Tar zxf mongodb-linux-i686-1.8.2.tgz
 
2. Installation preparation
Move MongoDB to the/usr/local/mongdb folder
 
Music mongodb-linux-i686-1.8.2/usr/local/MongoDB
 
Create Database folders and log files
Mkdir/usr/local/MongoDB/Data
Touch/usr/local/MongoDB/logs
 
Add the MongoDB startup project to RC. Local to ensure that MongoDB is started when the server is started.
 
Echo "/usr/local/MongoDB/bin/mongod -- dbpath =/usr/local/MongoDB/data-logpath =/usr/local/MongoDB/logs-logappend -- auth-Port = 27017 ">/etc/rc. local
 
CD to the bin folder in the MongoDB directory to start MongoDB
 
/Usr/local/MongoDB/bin/mongod -- dbpath =/usr/local/MongoDB/data -- logpath =/usr/local/MongoDB/logs -- logappend -- auth -- Port = 27017 -- fork

(The fork parameter specifies how the mango process runs)
The output indicates that MongoDB is started.
 
3. Go to the CLI management interface of the database.
CD to the bin folder in the MongoDB directory and execute the command./Mongo
Run as follows:
 
 
If the database cannot be connected, it is a problem with the mongod. Lock file under the Data Directory. You can use the following repair command,
Mongod -- repair

The following is the experience of colleagues in the Development Department.
Note the following for data migration: place the data file in the specified location and run the repair command before starting the mongod service. The command is as follows:
Mongod -- repair
Then start the mongod service.
Check that ports 27017 and 28017 are unblocked.

Pay attention to user permissions.

The above is an individual original. For details, please indicate the original position.

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.