Getting Started with MongoDB is simple (2)

Source: Internet
Author: User

The installation of MongoDB

1. Download MongoDB: www.mongodb.org Download the latest stable version: The version I downloaded is 3.2.5

2. Extracting files

3. Do not compile ; It is a compiled binary executable

Open our Download the extracted Bin directory as follows:


The contents of the bin file;


bsondump: Export Bson structure
MONGO: Client (equivalent to Mysql.exe)
mongod: Server (equivalent to Mysqld.exe)
mongodump: Overall database export (binary, equivalent to mysqldump)
mongoimport: Export easy-to-identify JSON documents or CSV documents
mongorestore: Database Overall Import
MONGOs: Routers (Shard time)

4. Start the Mongod service

/bin/mongod--dbpath/path/to/database--logpath/path/to/log--fork--port 27017


parameter explanation :
DBPath: Data Storage Directory
LogPath: Log Store Directory
Port: Running ports (default 27017)
Fork: Background process runs

5. Error Condition:

MongoDB very occupy disk space, start to occupy about 3-4g, so we have to choose a relatively large space to store database files and log files, if it is a virtual machine, you can add a sentence--smallfiles to start;

The problem I encountered:

I also learn through the above steps to connect MongoDB, but encountered a lot of difficulties, below I tell you how I solved:

First of all, I unzipped. Start the service with the start name above and encounter this problem:

I checked the Internet: basically is the answer to not correctly exit MongoDB, is to delete the Mongo.lock file in the database, but I opened the database storage path, but did not see the lock file. Because the first time did not open the success, there will not be an incorrect exit problem. After I opened my own log file, I saw the following explanation:

See here on the basic understand, and then to write the data, the original MongoDB since the 3.0 version of the new Wiredtiger data storage engine, 3.2 after the default use of Wiredtiger, do not know why, I do not use this version of the engine? This should be the case, so follow the idea above: add--storageengine=mmapv1 after the command that starts, specify with this storage engine, then start again, then succeed.

After the time to start the client, but encountered a problem, the solution is that I used the port is 27019, and the default configuration of the port is different, changed to 27017.

The result of the connection is as follows:

Getting Started with MongoDB is simple (2)

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.