Skip to content

Instantly share code, notes, and snippets.

@ondrej-kvasnovsky
Created April 7, 2018 18:29
Show Gist options
  • Save ondrej-kvasnovsky/346d294b3cec9423e416358da100662e to your computer and use it in GitHub Desktop.
Save ondrej-kvasnovsky/346d294b3cec9423e416358da100662e to your computer and use it in GitHub Desktop.
#!/bin/bash
RS_INDEX=$1
RS_NAME="rs"$1
mkdir $RS_NAME
PORT=$((27017+$RS_INDEX))
cat <<EOF > $RS_NAME.conf
systemLog:
destination: file
path: "var/log/mongodb/mongod.log"
logAppend: true
storage:
dbPath: "$RS_NAME"
journal:
enabled: true
processManagement:
fork: true
net:
bindIp: 127.0.0.1
port: $PORT
setParameter:
enableLocalhostAuthBypass: true
replication:
oplogSizeMB: 10
replSetName: "rs0"
EOF
mongod --config $RS_NAME.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment