- From: Benton Roberts <
>
- To:
- Subject: [chef] Re: Replica set setup with chef
- Date: Mon, 24 Jan 2011 10:10:37 -0500
- Domainkey-signature: a=rsa-sha1; c=nofws; d=bentonroberts.com; h=content-type :mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; q=dns; s= bentonroberts.com; b=ruDuUEqmtKvFjndfE+wM/BB2BIU5LNg5WWsvSSU0WXF WBDKlPi/X7J7JfEgldsd/3qZzrLS7n+dkE/3J5zMPeBtj0vrH5TbvYH9hsu1Ktyq JI/rPvn6ke3tMj51Ja5gJ8Z9aNTjVOwT8SRvQ5rRDlDMKkxjS+2oDUfEvwQQ/1es =
Hello, Micah.
On Jan 21, 2011, at 6:49 PM, Micah Wedemeyer wrote:
>
Is anyone doing Mongo sharding or replica sets with chef?
You may be interested in some code from a mongoDB recipe we have used at
Aranetic. Within our mongoDB cookbook, the regular default.rb recipe file
takes care of the usual business of installing the software and writing the
replica set name into the config file. That's the easy part.
>
Otherwise, I need to wait for the server to come up, send it the command,
>
and then hope that everything works.
Exactly. As you say, the tricky part is waiting for the server to come up
(which can take a LONG time, depending on the size of the data you're
replicating, and your disk speed), and then sending the proper commands
needed to establish replication. One wrinkle is that establishing the server
as a slave involves contacting the master, and altering its configuration
directly. To determine which nodes might be the master, this recipe searches
the Chef server for all existing nodes with the same attribute vale
[:mongodb][:repl_set].
The following code attempts to do all of that, in the context of a Chef
recipe:
https://gist.github.com/793295
One thing this recipe does NOT do is to remove no-longer-reachable nodes from
the master's replication config. Another is sharding. Further collaboration
on both aspects is welcome.
Good luck,
- benton
-------------
Benton Roberts
PGP Key ID 0x133E098F
Archive powered by MHonArc 2.6.16.