Skip to content

Instantly share code, notes, and snippets.

@phoet
Created February 21, 2012 19:11
Show Gist options
  • Save phoet/1878226 to your computer and use it in GitHub Desktop.
Save phoet/1878226 to your computer and use it in GitHub Desktop.
basic cassandra setup
> brew install cassandra
==> Downloading http://www.apache.org/dyn/closer.cgi?path=/cassandra/1.0.7/apache-cassandr
==> Best Mirror http://apache.openmirror.de//cassandra/1.0.7/apache-cassandra-1.0.7-bin.ta
######################################################################## 100,0%
==> Caveats
If this is your first install, automatically load on login with:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/cassandra/1.0.7/homebrew.mxcl.cassandra.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.cassandra.plist
==> Summary
/usr/local/Cellar/cassandra/1.0.7: 1798 files, 46M, built in 13 seconds
> cp /usr/local/Cellar/cassandra/1.0.7/homebrew.mxcl.cassandra.plist ~/Library/LaunchAgents/
> launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.cassandra.plist
> rvm use 1.9.3@cassandra --create
Using /Users/paule/.rvm/gems/ruby-1.9.3-p0 with gemset cassandra
> bundle init
Writing new Gemfile to /Users/paule/Documents/ruby/cassandra/Gemfile
> echo "gem 'cassandra'" >> Gemfile
> echo "gem 'thrift_client', '0.7.1'" >> Gemfile
> bundle
Fetching source index for http://rubygems.org/
Installing rake (0.9.2.2)
Installing json (1.6.5) with native extensions
Installing simple_uuid (0.2.0)
Installing thrift (0.7.0) with native extensions
Installing thrift_client (0.7.1)
Installing cassandra (0.12.1)
Using bundler (1.0.21)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
> cassandra-cli -host localhost -port 9160
Connected to: "Test Cluster" on localhost/9160
Welcome to Cassandra CLI version 1.0.7
Type 'help;' or '?' for help.
Type 'quit;' or 'exit;' to quit.
[default@unknown] CREATE KEYSPACE Twitter;
8aea9b20-5cc1-11e1-0000-242d50cf1ffd
Waiting for schema agreement...
... schemas agree across the cluster
[default@unknown] quit;
> echo "require 'cassandra'" > test.rb
> echo "client = Cassandra.new('Twitter', '127.0.0.1:9160')" >> test.rb
> ruby test.rb
# A sample Gemfile
source "http://rubygems.org"
# gem "rails"
gem 'cassandra'
gem 'thrift_client', '0.7.1'
GEM
remote: http://rubygems.org/
specs:
cassandra (0.12.1)
json
rake
simple_uuid (>= 0.2.0)
thrift_client (>= 0.7.0)
json (1.6.5)
rake (0.9.2.2)
simple_uuid (0.2.0)
thrift (0.7.0)
thrift_client (0.7.1)
thrift (~> 0.7.0)
PLATFORMS
ruby
DEPENDENCIES
cassandra
thrift_client (= 0.7.1)
require 'cassandra'
client = Cassandra.new('Twitter', '127.0.0.1:9160')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment