Created
February 27, 2021 00:11
-
-
Save chfritz/6fc8dc807cf12816f6cf5c6be2f5f837 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script to enable oplog tailing in a production meteor deployment using mongodb 4.0 or later | |
echo "# Enabling replication, required for oplog tailing" >> /etc/mongod.conf | |
echo "replication:" >> /etc/mongod.conf | |
echo " oplogSizeMB: 100" >> /etc/mongod.conf | |
echo " replSetName: rs0" >> /etc/mongod.conf | |
systemctl restart mongod | |
sleep 2 | |
echo 'rs.initiate({ "_id" : "rs0", "version" : 1, "members" : [{ "_id" : 0, "host" : "127.0.0.1:27017" }]})' | mongo | |
sleep 1 | |
mongo admin -eval 'db.createUser({user: "oplogger", pwd: "PasswordForOplogger", roles: ["read"]})' | |
echo | |
echo "All set! Now use" | |
echo " MONGO_OPLOG_URL=mongodb://oplogger:PasswordForOplogger@localhost:27017/local?replicaSet=rs0\&authSource=admin" | |
echo "in your meteor app" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Download and run in one line: