Skip to content

Instantly share code, notes, and snippets.

@zfz
Created September 25, 2018 16:02
Show Gist options
  • Save zfz/3b7e754784286bf60b4bcc245fc5416c to your computer and use it in GitHub Desktop.
Save zfz/3b7e754784286bf60b4bcc245fc5416c to your computer and use it in GitHub Desktop.
MongoDB service scripts and configurations
#!/bin/bash
MONGO_CONFIG=/vagrant/Applications/mongodb-linux/scripts/mongod.conf.yaml
MONGO_DB_PATH=/home/vagrant/Data/mongo
# Mongo start and stop
function start_mongo() {
mongod --config ${MONGO_CONFIG}
}
function stop_mongo() {
mongod --dbpath ${MONGO_DB_PATH} --shutdown
}
opt=$1
case $opt
in
start) start_mongo ;;
stop) stop_mongo ;;
*) echo "Nothing to do"
exit ;;
esac
# http://dba.stackexchange.com/questions/82591/sample-yaml-configuration-files-for-mongodb
storage:
engine: wiredTiger
dbPath: "/home/vagrant/Data/mongo"
journal:
enabled: true
systemLog:
destination: file
path: "/home/vagrant/Data/mongo/mongod.log"
logAppend: true
timeStampFormat: iso8601-utc
processManagement:
fork: true
net:
bindIp: 0.0.0.0
port: 27017
wireObjectCheck : false
unixDomainSocket:
enabled : true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment