Skip to content

ZooKeeper integration

Flavian Alexandru edited this page Aug 22, 2016 · 4 revisions

Build Status Coverage Status Maven Central Bintray

If you have never heard of Apache ZooKeeper before, a much better place to start is here. Phantom offers a complete set of features for ZooKeeper integration using the finagle-zookeeper project.

Using a set of conventions phantom can automate the entire process of using ZooKeeper in a distributed environment. Phantom will deal with a large series of concerns for you, specifically:

  • Creating a ZooKeeper client and initialising it in due time.
  • Fetching and parsing a sequence of Cassandra ports from ZooKeeper.
  • Creating a Cluster configuration based on the sequence of Cassandra ports available in ZooKeeper.
  • Creating an implicit session for queries to execute.

The entire process described above is entirely automated with a series of sensible defaults available. More details on default implementations are available below. Bottom line, if you want to go custom, you may override at will, if you just want to get something working as fast as possible, then phantom-zookeeper can do everything for you.

When to use Zookeeper

Many of our users have wondered why we include Zookeeper compatibility to start with, as they assumed it's to do with the discovery of Cassandra nodes in the ring. When you use Cassandra, you have to setup clusters by providing them with a seed node, and that node will get informed about the rest of the ring. Ultimately, every node will learn about each other and the client driver is capable of handling such scenarios directly, which means you don't really need Zookeeper per say, at the very least for building the ring.

This module exists only to handle situations for instance where you might want to run Cassandra inside Mesos for instance, and then even those seed IPs may vary, simply because the end IP that will be given to an application when it runs inside Mesos isn't fixed. In that scenario, you need a central point where you can publish updates and available IPs for clients to read them, and that's where zookeeper comes into play, especially if you are using Mesos where Zookeeper is designed to be the service discovery piece.