MongoDB Installation and Configuration

Source: Internet
Author: User
Tags mongo shell

1. MongoDB Installation
First download MongoDB, official website address; Http://www.mongodb.org/downloads
Curl-o http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.6.1.tgz
Unzip
TAR-ZXVF mongodb-linux-x86_64-2.6.1.tgz
New Catalog
Mkdir-p mongodbcp-r-N mongodb-linux-x86_64-2.6.1/mongodb

2. Starting from the command line
Start MongoDB by executing./bin/mongod to see all the options for Mongod startup
CD MongoDB./bin/mongod--help
Main options:--dbpath: Data Save directory, default is/data/db/, each mongod requires a separate data directory, startup will be generated in the data directory Mongod.lock, this file to prevent other Mongod process use the directory. --port: Boot port, default = 27017--fork: Boot as daemon. --logpath: Log directory--config specify the configuration file.
Start MongoDB
mkdir data./bin/mongod--port 9000--fork--logpath/home/mongodb/log/mongodb.log  --dbpath/home/mongodb/data/

3. Start in profile mode
Setting up a configuration file
mkdir Configvim config/mongodb.conf
Write the above configuration to a file
# mongodb Config fileport = 9000fork = Truelogpath =/home/mongodb/log/mongodb.logdbpath =/home/mongodb/data/
Start
./bin/mongod--config/home/mongdb/conf/mongodb.conf
It is recommended to use the configuration file mode to start.
4. MongoDB stop can be stopped by using the Kill process mode. If the process number is 10000, kill 10000 is used. The system saves the data, then closes the connection and stops the service. You cannot use kill-9 to shut down the database directly, resulting in corruption of the data file.
Another way to turn off the use of the MONGO shell, which is the surest way
./bin/mongo--port 9000use admindb.shutdownserver ();

Address: http://blog.csdn.net/yonggang7/article/details/25543283

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.