Basic MongoDB tutorial

Source: Internet
Author: User
Tags mongodb tutorial

I. installation and configuration

1. Installation

Download: wget-c http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.0.6.tgz

Unzip: tar zxvf mongodb-linux-x86_64-2.0.6.tgz

Establish a soft connection: ln-s mongodb-linux-x86_64-2.0.6 mongodb

Create a data storage directory in mongodb. The log storage directory is mkdir-p data/db mkdir data/log.

2. Run

2.1. Start in command line mode:

./Mongod -- dbpath = ../data/db -- logpath = ../data/log/mongod. log -- fork

Explanation: mongod is the log storage directory specified by the server program dbpath -- logpath specifies the log storage directory -- fork specifies to start as a daemon (note, you must specify the log storage path when starting a daemon)

2.2 configure file startup:

Edit vim/etc/mongod. conf to add the following content:

Start:./mongod-f/etc/mongod. conf

2.3 random startup as a system service

Edit vim/etc/init. d/mongod to add the following content:

Run chkconfig -- add mongod and chkconfig -- level 35 mongod on

Restart to view

  • 1
  • 2
  • Next Page

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.