HiveBrain v1.2.0
Get Started
← Back to all entries
debugMinor

Unable to create replica set for MongoDB in Linux

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
createreplicamongodbunableforlinuxset

Problem

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

Code Snippets

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

Context

StackExchange Database Administrators Q#105035, answer score: 2

Revisions (0)

No revisions yet.