Mongodb and Zookeeper

1,150 views
Skip to first unread message

Marius Seritan

unread,
Aug 30, 2011, 10:18:57 AM8/30/11
to mongodb-user
I really like the Mongodb automatic failover/master selection. I would
like to bring this to other parts of our infrastructure and Zookeeper
seems to be a good distributed mechanism for master selection and
configuration sharing.
http://zookeeper.apache.org/

We've had issues in the past with communicating with the mongodb
servers IPs to the app server. When the Mongodb master changes and the
application is up everything is fine. However the application hangs if
it needs to restart and not all the mongodb servers are present. Would
it make sense to register Mongodb servers in Zookeeper and have the
application layer query Zookeeper for the list of servers?

Marius

Scott Hernandez

unread,
Aug 30, 2011, 10:33:03 AM8/30/11
to mongod...@googlegroups.com
No, this makes very little sense. A replicaset already keeps
configuration, state information (who is primary, if there is one) and
so on. These are the things zookeeper triest to provide to distributed
applications and services which don't already have them.

Drivers implement a discovery process for replicaset members and a way
to keep track of their state (up/down, primar/secondary, etc.). When
failover occurs it adjusts its view of the replicaset accordingly.

> --
> 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.
>
>

Marius Seritan

unread,
Aug 30, 2011, 11:47:23 AM8/30/11
to mongodb-user


On Aug 30, 7:33 am, Scott Hernandez <scotthernan...@gmail.com> wrote:
> No, this makes very little sense. A replicaset already keeps
> configuration, state information (who is primary, if there is one) and
> so on. These are the things zookeeper triest to provide to distributed
> applications and services which don't already have them.
>
> Drivers implement a discovery process for replicaset members and a way
> to keep track of their state (up/down, primar/secondary, etc.). When
> failover occurs it adjusts its view of the replicaset accordingly.

Scott, this is not my experience. I had a degraded replica set in
production and the application was down while it repeatedly tried to
connect to the missing server. What I understand from your comment is
that instead of adding an extra layer you recommend to try to
duplicate and possibly fix the driver?

Marius

Scott Hernandez

unread,
Aug 30, 2011, 11:55:32 AM8/30/11
to mongod...@googlegroups.com

I'm not sure what you are talking about in particular. It is up to the
driver to deal with connecting to the correct nodes. Perhaps you could
post a new issue with the specific issues you are having, including
the driver and server configuration. Then we can address the actual
problem you are having, and not on this thread.

What extra layer are you talking about? Zookeeper is meant to replace
the (current) server management of the distributed system which
replicasets already provide.

Are asking that mongodb use zookeeper for managing the replicaset
configuration and state? If so, then it would require replacing much
of the code and re-writing all drivers to use zookeeper instad of the
current system.

Reply all
Reply to author
Forward
0 new messages