How can mongodb use ip instaed of hostname in Replica Set?

2,623 views
Skip to first unread message

realzyy

unread,
Oct 13, 2010, 11:27:44 PM10/13/10
to mongodb-user
I can see the hostname in the built-in replica set admin UI like this:

Member id Up cctime Last heartbeat Votes State Status optime skew
my031049.sqa.cm4:27017 (me) 0 1 18 hrs 1 PRIMARY 4cb66f79:1


But I would like see my host in ip mode. Does anyone know how to deal
with it?

Alvin Richards

unread,
Oct 13, 2010, 11:50:50 PM10/13/10
to mongodb-user
Currently, the UI and other admin utilities show the "name" used when
you created the set. So it you use hostnames then you see hostname, if
you use IP's then you will see IP's.

Feel free to add an enhancement request in Jira to change the display
options

http://jira.mongodb.org

-Alvin

realzyy

unread,
Oct 15, 2010, 3:36:21 AM10/15/10
to mongodb-user
I tried. If there is only one node in the ReplicaSet, it will use
hostname.
It appears that the first node (master) will always use hostname.
This causes some problem in my case. What should I do?

Reazlyy

gilles

unread,
Oct 15, 2010, 11:29:41 AM10/15/10
to mongodb-user
See http://jira.mongodb.org/browse/SERVER-1813

if you start the replicaSet with an empty conf, mongo 1.6.X uses the
system gethostbyname()

Try with a conf using IPs

realzyy

unread,
Oct 20, 2010, 2:53:58 AM10/20/10
to mongodb-user
Sorry for my late reply.

As your suggestion, I use bind-ip to start ReplicaSet. But it
encounters another problem when rs.initiate() is executed. Error
infomation is like this:
rs.initiate()
{
"startupStatus" : 4,
"info" : "ttttt",
"errmsg" : "all members and seeds must be reachable to
initiate set",
"ok" : 0
}

Maybe bind-ip can't be used in ReplicaSet?

On Oct 15, 11:29 pm, gilles <gilles.dev...@gmail.com> wrote:
> Seehttp://jira.mongodb.org/browse/SERVER-1813

Kristina Chodorow

unread,
Oct 20, 2010, 9:46:20 AM10/20/10
to mongod...@googlegroups.com
No, don't use bind_ip, specify the ips you're using in rs.initiate.  See http://www.mongodb.org/display/DOCS/Replica+Set+Configuration#ReplicaSetConfiguration-TheReplicaSetConfigObject and run rs.initiate(<config>).  Each member's host field should be an IP.


--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.


Reply all
Reply to author
Forward
0 new messages