简体   繁体   English

是否可以从Ruby使用Cassandra NoSQL数据库?

[英]Is it possible to use Cassandra NoSQL database from Ruby?

I have tried to use a Ruby bindings for Cassandra database by installing binding: 我试图通过安装绑定对Cassandra数据库使用Ruby绑定:

sudo gem install cassandra

and attempting to load it: 并尝试加载它:

require 'cassandra'

Unfortunately, this fails with error: 不幸的是,这失败并显示错误:

Gem::LoadError: RubyGem version error: thrift_client(0.8.1 not ~> 0.7.0)

I have fixed it by installing outdated dependency: 我已经通过安装过时的依赖关系来解决它:

sudo gem install thrift_client -v "~> 0.7.0"

But after that another error is raised that i don't know how to fix: 但是之后又出现了一个我不知道如何解决的错误:

LoadError: no such file to load -- thrift_client/connection

Tested on Ubuntu 11.10 and OSX 10.7, with both Ruby 1.8.7 and 1.9.3-p0. 在Ruby 1.8.7和1.9.3-p0的Ubuntu 11.10和OSX 10.7上进行了测试。 Is i something i'm doing wrong or Cassandra and Ruby are not intended to work together? 我是在做错什么吗,还是Cassandra和Ruby不想一起工作?

the latest commits on github indicate that they are going to push a new version soon. github上的最新提交表明他们将很快推出新版本。 this one might not have the dependency problems mentioned. 这可能没有提到的依赖性问题。

i created a gist that should help you setup your project correctly: https://gist.github.com/1878226 我创建了一个要旨,可以帮助您正确设置项目的要点: https : //gist.github.com/1878226

Me and my team had plenty of problems with using the original cassandra gem. 我和我的团队在使用原始的Cassandra宝石时遇到很多问题。 The gem seems to have been abandoned by the developers (last, 0.12.1, release happened on August 22, 2011) and is not compatible with thrift v0.8. 该gem似乎已被开发人员放弃(最新版本为0.12.1,于2011年8月22日发布),并且与thrift v0.8不兼容。 Using thrift v0.7 was not an option for us as you can't compile it on Ubuntu without hacking some .c files, so we've decided to use mcmire-cassandra gem instead - http://rubygems.org/gems/mcmire-cassandra . 使用Thrift v0.7并不是我们的选择,因为您无法在Ubuntu上编译它而不会破解某些.c文件,因此我们决定改用mcmire-cassandra gem- http: //rubygems.org/gems/ 麦克梅尔-卡桑德拉

Even though mcmire did an excellent job with fixing the original gem, ruby client for cassandra is still behind the competition in terms of functionality provided. 尽管mcmire在修复原始宝石方面做得很出色,但是就提供的功能而言,cassandra的ruby客户仍然落后于竞争对手。 If you expect high load and need features like connection pooling for example you might consider using either Python or Java clients, which support it. 如果您期望高负载并需要诸如连接池之类的功能,则可以考虑使用支持该功能的Python或Java客户端。

Hope this helps. 希望这可以帮助。

I was wondering if using JRuby is an option for you? 我想知道是否可以使用JRuby? In that case you'd be able to use the Java client for Cassandra and I expect to have both better support and better results with it. 在这种情况下,您可以将Java客户端用于Cassandra,并且我希望它能同时提供更好的支持和更好的结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM