简体   繁体   English

Cassandra数据库未通过Rcassandra与R连接

[英]Cassandra Database is not connecting with R via Rcassandra

When I'm connecting to Cassandra database using RCassandra package, connection is establishing. 当我使用RCassandra包连接到Cassandra数据库时,正在建立连接。 But When trying to use any keyspace, R is not responding.I used the following statements. 但是当尝试使用任何键空间时,R没有响应。我使用了以下语句。

library(RCassandra) 库(RCassandra)

rc <- RC.connect(host ="localhost", port = 9042) rc <-RC.connect(主机=“ localhost”,端口= 9042)

RC.use(rc, "db1", cache.def = TRUE) RC.use(rc,“ db1”,cache.def = TRUE)

Any sugestions Please 任何建议

Your problem is that you're specifying the port directly, and you're using the port of the native protocol, while RCassandra uses thrift protocol (that uses port 9160), so when it's talking to port 9042, it simply don't understand what it says. 您的问题是,您直接指定端口,并且使用的是本机协议的端口,而RCassandra使用的是Thrift协议(使用端口9160),因此当它与9042端口通信时,根本就无法理解它说什么。 So you need to either remove port argument completely, or specify it as 9160 , and make sure that you have start_rpc parameter set to true in the cassandra.yaml . 因此,您需要完全删除port参数,或将其指定为9160 ,并确保在cassandra.yaml start_rpc参数设置为true

I've looked into source code of the RCassandra, and see that it wasn't updated for more than 5 years. 我研究了RCassandra的源代码,发现它没有更新超过5年。 And as it uses Thrift instead of native protocol, then you have many limitations comparing to use of native protocol. 而且由于它使用Thrift而不是本机协议,因此与使用本机协议相比,您有很多限制。 And support for Thrift will be removed in the next major version of Cassandra - 4.0. 在下一个主要版本的Cassandra-4.0中将删除对Thrift的支持。 The better alternative will be to write a wrapper around DataStax C/C++ driver, and expose underlying functionality to R. 更好的选择是围绕DataStax C / C ++驱动程序编写包装,并将底层功能公开给R。

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

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