Skip to content
This repository

Zookeeper bindings for Ruby (1.8, 1.9 compatible with watches and callbacks)

Octocat-spinner-32 .dotfiles change some stuff related to zk-ruby move July 05, 2013
Octocat-spinner-32 ext move the unhealthy? and healthy? methods into privateville December 01, 2013
Octocat-spinner-32 java Trying to get java to work September 08, 2013
Octocat-spinner-32 lib Get ready for 1.4.8 release January 15, 2014
Octocat-spinner-32 releaseops @ 2b45380 bump releasops version September 09, 2013
Octocat-spinner-32 scripts handle the relative reference to ZookeeperException May 06, 2012
Octocat-spinner-32 spec Explicitly testing zookeeper behavior for deleting keys with children… September 06, 2013
Octocat-spinner-32 zoomonkey Updating logging for zoomonkey September 08, 2013
Octocat-spinner-32 .ctags_paths sanity test for zookeeper base, odds and ends for various other stuff May 11, 2012
Octocat-spinner-32 .gitignore change some stuff related to zk-ruby move July 05, 2013
Octocat-spinner-32 .gitmodules go back to building from tarball, remove apache-zookeeper submodule May 11, 2012
Octocat-spinner-32 .travis.yml change some stuff related to zk-ruby move July 05, 2013
Octocat-spinner-32 CHANGELOG Get ready for 1.4.8 release January 15, 2014
Octocat-spinner-32 Gemfile Trying to get java to work September 08, 2013
Octocat-spinner-32 Guardfile pause/resume now works at this level! (yay!) May 17, 2012
Octocat-spinner-32 LICENSE Initial commit. June 14, 2010
Octocat-spinner-32 Manifest Remove non-existent Gemfile from Manifest February 19, 2012
Octocat-spinner-32 README.markdown change some stuff related to zk-ruby move July 05, 2013
Octocat-spinner-32 Rakefile remove dependency on rvm for releasing gems September 09, 2013
Octocat-spinner-32 cause-abort.rb push socket-close down into GC/close hook in zkrb.c May 13, 2012
Octocat-spinner-32 notes.txt added notes file for discussion w/ twitter devs February 09, 2011
Octocat-spinner-32 zookeeper.gemspec Rolling back the zookeeper jar version September 08, 2013
README.markdown

zookeeper

Build Status

An interface to the Zookeeper cluster coordination server.

For a higher-level interface with a more convenient API and features such as locks, have a look at ZK.

Fork Safety!

As of 1.1.0, this library is fork-safe (which was not easy to accomplish). This means you can use it without worry in unicorn, resque, and whatever other fork-philic frameworks you sick little monkeys are using this week. The only rule is that after a fork(), you need to call #reopen on the client ASAP, because if you try to peform any other action, an exception will be raised. Other than that, there is no special action that is needed in the parent.

Big Plans for 1.0

The 1.0 release will feature a reorganization of the heirarchy. There will be a single top-level Zookeeper namespace (as opposed to the current layout, with 5-6 different top-level constants), and for the next several releases, there will be a backwards compatible require for users that still need to use the old names.

License

Copyright 2008 Phillip Pearson, and 2010 Twitter, Inc. Licensed under the MIT License. See the included LICENSE file.

Portions copyright 2008-2010 the Apache Software Foundation, licensed under the Apache 2 license, and used with permission.

Portions contributed to the open source community by HPDC, L.P.

Install

sudo gem install zookeeper

rbenv is awesome

UPDATE: this appears to have been fixed by @eric in this patch. If you use rbenv, please report any issues, but I believe it should work now.

Let me start out by saying I prefer rvm, and that I really don't know a whole lot about linking on OS X. Or Linux. Any suggestions or constructive insults would be greatly appreciated if you have insight into what i'm doing wrong here.

So, it seems that ruby-build doesn't use --enable-shared by default. I'm told this is for speed.

If you run into problems with installing this gem (specifically with linking ex. Undefined symbols for architecture x86_64) and you're using rbenv, for now you need to ensure that your ruby was built with --enable-shared. I'm sorry for the inconvenience. (no, really)

~ $ CONFIGURE_OPTS='--enable-shared --disable-install-doc' rbenv install 1.9.3-p194

A note for REE users

The zookeeper client is required to send a heartbeat packet every N seconds to the server. If it misses its deadline 3 times in a row, the session will be lost. The way the client is implemented in versions >= 1.2, a ruby thread acts as the event thread (this was necessary to provide a fork-safe client with a parent process that is able to preserve state). Some users have reported issues where under load in "massive codebases," they have problems where calls will time out. Given the nature of the thread scheduler in 1.8, one should be careful if upgrading from 0.4.4 to >= 1.2.

Usage

Connect to a server:

require 'rubygems'
require 'zookeeper'
z = Zookeeper.new("localhost:2181")
z.get_children(:path => "/")

Idioms

The following methods are initially supported:

  • get
  • set
  • get_children
  • stat
  • create
  • delete
  • get_acl
  • set_acl

All support async callbacks. get, get_children and stat support both watchers and callbacks.

Calls take a dictionary of parameters. With the exception of set_acl, the only required parameter is :path. Each call returns a dictionary with at minimum two keys :req_id and :rc.

A Bit about this repository

Twitter's open source office was kind enough to transfer this repository to facilitate development and administration of this repository. The zookeeper gem's last three releases were recorded in branches v0.4.2, v0.4.3 and v0.4.4. Releases of the slyphon-zookeeper gem were cut off of the fork, and unfortunately (due to an oversight on my part) were tagged with unrelated versions. Those were tagged with names release/0.9.2.

The plan is to keep the slyphon-zookeeper tags, and to tag the zookeeper releases twitter/release/0.4.x.

Further work will be carried out on this repository. The 0.9.3 release of the zookeeper gem will be released under the 'zookeeper' name, and will bring the two divergent (conceptual) branches of development together.

Something went wrong with that request. Please try again.