Shell scripts for fully automated MongoDB database installation

Source: Internet
Author: User

Recently in the study of MongoDB database, wrote a fully automatic installation of MongoDB database shell script, for reference only, welcome to shoot bricks, the contents are as follows:

#!/bin/bash# Shell Execution Options: #-N reads only the shell script, but does not actually execute #-x Enter the tracking mode, showing each command executed #-C"string"read command from strings # download directory Downloadsdir=/root/downloads# installation directory Appdir=/usr/local/mongodb# determine if the backup directory exists, and create a new directory when not in storage [! -D $downloadsDir] &&mkdir-p $downloadsDircd $downloadsDir # download Mongodbcurl-O http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.6.7.tgz# Unzip MongoDBTar-ZXVF mongodb-linux-x86_64-2.6.7. tgzRM-RF $appDirmkdir-P $appDir # Copy the MongoDB database file into the $appdir directoryCP-r/root/downloads/mongodb-linux-x86_64-2.6.7/*$appDirmkdir-P $appDir/data/dbmkdir-p $appDir/logmkdir-p $appDir/confmkdir-p $appDir/binchmod-r 777 $APPDIRCD $a Ppdir/confecho "################################ zhaoxiace DEFINE ##############################" >> Mongod.confecho "port=27017 #指定服务端口号, default port 27017" >> mongod.confecho "Dbpath=data #指定数据库路径" >> Mongod.confecho "Logpath=log/mongod.log #指定MongoDB日志文件" >> mongod.confecho "Auth=false #启用验证" >> Mongod.confecho "Fork=true #以守护进程的方式运行MongoDB, creating a server process" >> MONGOD.CONFCD. /# start in Repair mode #./bin/mongod-f conf/mongod.conf--repair# start the Mongd service./bin/mongod-f conf/mongod.conf# connect to the database./bin/mongo

Shell scripts for fully automated MongoDB database installation

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.