简体   繁体   中英

Cassandra Database is not connecting with R via Rcassandra

When I'm connecting to Cassandra database using RCassandra package, connection is establishing. But When trying to use any keyspace, R is not responding.I used the following statements.

library(RCassandra)

rc <- RC.connect(host ="localhost", port = 9042)

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. 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 .

I've looked into source code of the RCassandra, and see that it wasn't updated for more than 5 years. And as it uses Thrift instead of native protocol, then you have many limitations comparing to use of native protocol. And support for Thrift will be removed in the next major version of Cassandra - 4.0. The better alternative will be to write a wrapper around DataStax C/C++ driver, and expose underlying functionality to R.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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