ruby操作cassandra数据库

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

# encoding:utf-8
require 'rubygems' 
require 'cassandra/1.0'
 # 建立数据库连接 
 cdb = Cassandra.new('demo','192.168.1.2:9160') 
 # 写入数据

cdb.insert(:Users, 'studentB', {'age' => '1'}) 
 # 读取数据
puts cdb.get(:Users, 'studentB')