In your config files at startup, you pass to mongod the replSet (e.g. “rs0”) and the keyfile (read mongo docs)
On master, in mongo shell, you add all the replica nodes, it takes care of communicating with the slaves
Make sure slaves are blank otherwise replication fails
That seems consistent. However, what it seems that you do differently is use local. I would run the replSetInitiate command against admin, not local, which I think is your issue.
Thank you for the comments guys. I think I have figured it out, a combination of something not specified in the docs and a mistake on my part. Here are my full steps to get it working for a Meteor app deployed with Phusion Passenger on a Digital Ocean droplet.
Set up replica set
SSH to the server and in the terminal, type:
sudo nano /etc/mongod.conf
In this doc, add:
replication:
replSetName: rs0
oplogSizeMB: 100
Now add your hostname as an alias. First identify your hostname by typing:
hostname
This returns, say, ‘myhostname’. Now type:
nano /etc/hosts
And to this file add:
127.0.0.1 myhostname
Restart mongodb:
sudo service mongod stop
sudo service mongod start