Created
August 13, 2010 00:00
-
-
Save careo/521994 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'cassandra/0.7' | |
cassandra = Cassandra.new "system" | |
keyspaces = cassandra.send(:client).describe_keyspaces | |
keyspace_name = "SomeTest" | |
cf_name = "Tests" | |
if keyspaces.include? keyspace_name | |
p cassandra.drop_keyspace keyspace_name | |
end | |
cf_def = Cassandra::ColumnFamily.new :keyspace => keyspace_name, | |
:name => cf_name | |
ks_def = Cassandra::Keyspace.new :name => "SomeTest", | |
:strategy_class => "org.apache.cassandra.locator.RackUnawareStrategy", | |
:replication_factor => 1, | |
:cf_defs => [cf_def] | |
p cassandra.add_keyspace ks_def | |
p cassandra.send(:client).describe_keyspaces | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment