[NoSQL] install MongDb and nosqlmongdb in Linux

Source: Internet
Author: User
Tags mongodb add

[NoSQL] install MongDb and nosqlmongdb in Linux

1. Go to the official website.

2. decompress the MongoDb package and rename it to mongodb:

tar -zxvf mongodb-linux-x86_64-2.6.8.gzmv mongodb-linux-x86_64-2.6.8.gz mongodb
3. Create a folder for storing database content data and a folder for storing log content, and create a mongodb. log file in the log Folder:
mkdir data mkdir logcd logtouch mongodb.log
4. Create the mongod. conf configuration file to start MongoDb. Common configurations include:
fork = true port = 27017quiet = truedbpath = /home/mongodb/datalogpath = /home/mongodb/log/mongodb.loglogappend = trueauth = false
If fork is set to true, the command line will not be locked. If fork is set to true, the port is specified. If quiet is set to true, the command line will not be locked. If dbpath and logpath are set to true, the storage location of the data and logs will be set (absolute ), if logappend is true, logs are appended instead of overwritten. If auth is false, no user name or password is required for logon.

5. Use mongod in the bin directory to start mongodb and specify the configuration file with-f or-config:

/home/mongodb/bin/mongod --config /home/mongodb/mongod.conf
6. use mongo in the bin directory to enter mongodb. If you can successfully access MongoDb, you can register mongodb as a service: in/etc/init. create a mongodb file in the d folder and add the following code:
#!/bin/bash##chkconfig:2345 80 90#description:mongodbstart() { /home/mongodb/bin/mongod --config /home/mongodb/mongod.conf}stop() { /home/mongodb/bin/mongod --config /home/mongodb/mongod.conf --shutdown}case "$1" in start)start;; stop)stop;; restart)stopstart;; *) echo$"Usage:$0{start|stop|restart}" exit 1esac
8. Add executable permissions:
chmod +x /etc/init.d/mongodb
9. Register as a service:
Chkconfig -- add mongodb add service chkconfig mongodb on set startup service mongodb start service





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.