Installing Snowflake

I forked the code that Ryan King wrote for Twitter called snowflake.

Snowflake works by guaranteeing a unique user id based on a few simple guarantees: time, machine id and sequence number.

My fork has a fix for the ruby client allowing you to query multiple servers.

Here are the prerequisites:

The install process is fairly straightforward:

  1. Clone the repo: git clone http://github.com/twitter/snowflake.git
  2. Edit project/build.properties to use sbt.version=0.7.4
  3. sbt update
  4. sbt compile
  5. sbt test
  6. Copy one of the configs into /etc: cp config/development2.conf /etc/unknown.conf Or you can also just use ‘sbt run -f config/development2.conf’.
  7. Edit the conf and add a unique worker ID: worker_id = 1
  8. In the conf: skip_sanity_checks = false
  9. sbt run

When you run the client like so:

RUBYLIB=./target/gen-rb ./src/scripts/client_test.rb 1 “192.168.0.103:7610,192.168.0.109:7610” test-on

You should get something like this:

557299556602089472 test-on 1

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *