Skip to content

Instantly share code, notes, and snippets.

@katopz
Last active May 1, 2020 12:40
Show Gist options
  • Save katopz/4c3662be9054ad1e846fd7c9dc319966 to your computer and use it in GitHub Desktop.
Save katopz/4c3662be9054ad1e846fd7c9dc319966 to your computer and use it in GitHub Desktop.
Basic setup for 2 replica set. will need rs.sh at https://gist.github.com/katopz/da912b3fa2677b5f149fd01e5243e28a
# List existing mongo process
pgrep mongo
# Kill existing process if has.
pkill mongo
# Clear old folder if has.
rm -rf rs0 && rm -rf rs1
# Create log folder.
mkdir -p ./var/log/mongodb
# Create replica set 0
. rs.sh 0
# Create replica set 1
. rs.sh 1
# List existing mongo process
pgrep mongo
# Connect to available host
mongo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment