Unable to create replica set for MongoDB in Linux
-
26-09-2020 - |
Question
When I run the following command: rs.initiate()
,
I get the following error:
"info2" : "no configuration explicitly specified -- making one",
"me" : "ip-10-0-2-113:27017",
"ok" : 0,
"errmsg" : "No host described in new configuration 1 for replica set s-1-rs maps to this node",
"code" : 93
I'm just running on the local host. I'm following this guide: http://docs.mongodb.org/manual/tutorial/convert-standalone-to-replica-set/
I just skipped the part where they named the replica set.
In any case, how can I create a replica set and what am I doing wrong?
Thanks
Solution
Your hostname must be an alias for 127.0.0.1 in your /etc/hosts file to make it work.
aldwin@myhostname~$ cat /etc/hostname
myhostname
aldwin@myhostname:~$ hostname
myhostname
aldwin@myhostname:~$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 myhostname
Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange