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