public
Created

basic cassandra setup

  • Download Gist
Gemfile
Ruby
1 2 3 4 5 6
# A sample Gemfile
source "http://rubygems.org"
 
# gem "rails"
gem 'cassandra'
gem 'thrift_client', '0.7.1'
README
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
> 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
test.rb
Ruby
1 2
require 'cassandra'
client = Cassandra.new('Twitter', '127.0.0.1:9160')

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.