MongoDB Environment Deployment

Source: Internet
Author: User

MongoDB Environment Deployment

1. Environmental statement

Installation software: mongodb-linux-x86_64-2.2. 2 . tgz Software Installation location:/usr/local/mongodb datastorelocation:/var/mongodb/datalog storage location:/var/ Mongodb/logs

2. Software Installation

[Email protected]/]# CD usr/local/[[Email protected]/]# groupadd mongodb[[email protected]/]# Useradd MongoDB-g Mongodb[[email protected]/]# cd/usr/local[[email protected] local]# tar-zxv-f mongodb-linux-x86_64-2.2.2. Tgz[[email protected] local]# mv MongoDB-linux-x86_64-2.2.2Mongodb[[email protected] local]# chown-R mongodb:mongodb mongodb[[email protected] local]# CD Mongodb[[email protected] mongodb]# mkdir/var/Mongodb[[email protected] mongodb]# mkdir/var/mongodb/Data[[email protected] mongodb]# mkdir/var/mongodb/Logs[[email protected] mongodb]# VI/etc/sysconfig/iptables//adding 27017 ports to the firewall[Email protected] mongodb]# service iptables restart//Restarting the firewall

3. Configuration

Add CentOS Boot entry
[Email protected] mongodb]# VI +/etc/rc.d//usr/local/mongodb/bin/mongod--dbpath=/var/mongodb/ Data--logpath/var/mongodb/logs/log.log-fork start MongoDB

[Email protected] mongodb]#/usr/local/mongodb/bin/mongod--dbpath=/var/mongodb/data--logpath/var /mongodb/logs/log.log-fork

See the following information stating that the installation has completed and started successfully:
18394/var/mongodb/logs/log.log

4. Data backup and Recovery

127.0. 0.1 -D test-o/data/backup_new/

Mongodump Backup command-H host-D specify the backed up Database-O Specify the location of the backup
127.0. 0.1 -D test--drop/data/backup_new/test/

Mongorestore Restore Command-H host-d specifies the restored database--drop/data/backup_new/test/--drop means to delete the collection (if any) before recovery. Otherwise, the data is merged with the existing collection data and may overwrite some documents.

MongoDB Environment Deployment

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.