MongoDB Finishing Notes installation and configuration

Source: Internet
Author: User

1. Download the website

Address: Http://www.mongodb.org/downloads

MONGODB-LINUX-X86_64-2.4.9.TGZ (64 latest version so far)

2. Decompression

Switch to the download directory, command line input: Tar zxf mongodb-linux-x86_64-2.4.9.tgz

3. Create database folders and log files

Command Line Input:

Mkdir/usr/local/mongodb/data

Touch/usr/local/mongodb/logs

The above two lines of command represent, all MONGODB related operations of the database files, are saved in/usr/local/mongodb/data this directory, the resulting log is saved in/usr/local/mongodb/logs this

In the file. Attention! Logs is a file, not a directory.

4. Start MongoDB Service

Standard boot form, start with file, switch to mongodb installation directory, command line input:

Bin/mongod--dbpath=/usr/local/server/mongodb/data--logpath=/usr/local/server/mongodb/logs

Take a closer look at the command line, it's easy to see why you just created the database folder and log file!

5. Set Boot start

Command line input (/home/data/mongodb2.4.9/for my MongoDB installation path):

echo "/home/data/mongodb2.4.9/bin/mongod--dbpath=/usr/local/server/mongodb/data–logpath=/usr/local/server/ mongodb/logs–logappend–port=27017 ">>/etc/rc.local

In fact, we can also summarize ourselves, such as these our own installation of tools, such as mongodb,logstash,redis,es and so on boot settings, all the same, uniform format:

Command line input: echo "Start command" >>/etc/rc.local

So the configuration for boot start is in the Rc.local file!

6, if the database appears as not connected, it is a data directory under the Mongod.lock file problem, you can use the following repair command, Mongod--repair

7, give everyone a detailed command line, parameter interpretation

--dbpath database path (data file)--logpath log file path--master designated as the primary machine--slave specified as the IP address of the host machine--source       OLOGSIZE specifies that the log file size does not exceed 64M. Because Resync is very large and time-consuming, it is best to avoid resync by setting a sufficiently large oplogsize (the default oplog size is 5% of the size of the free disk). --logappend log file End add--port enable port number--fork run in background

--ONLY specifies which database to replicate only

--slavedelay refers to the time interval from replication detection--auth whether authentication rights are required to log on (user name and password)
8. Operation MongoDB
Switch to the MongoDB installation directory and enter the command line:
Bin/mongo
As appears
MongoDB Shell version:2.4.9 connecting to:test (default connected database test)
Congratulations, you can start working on MongoDB!

MongoDB Finishing Notes installation and configuration

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.