Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RCassandra is not connecting to Cassandra Database

Tags:

r

cassandra

I'm new to Cassandra and R. 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.

c <- RC.connect('192.168.1.20', 9042)
RC.use(c, 'effesensors')

Please give me a brief idea about how to use RCassandra to avoid this problem.

like image 585
D. Venkata Naresh Avatar asked Nov 29 '25 14:11

D. Venkata Naresh


1 Answers

Are you aware that you may be using a non default port for Cassandra? If you can provide the Cassandra version and RStudio version I may be able to update my answer. I found this tutorial by tarkalabs useful as a checklist of steps to take before any connection is attempted.

From the tutorial,

Now connect to your database with connect.handle <- RC.connect(host="127.0.0.1", port=9160)

Cassandra by default listens to port 9160 but you can change it according to your configuration. To show the cluster type into your prompt RC.cluster.name(connect.handle)

Just to verify that you are connected and your Cassandra instance is running try the following command: RC.describe.keyspaces(connect.handle)

That should bring back a list of the settings in your keyspaces. If nothing returns, you are either not connected or your Cassandra instance is not properly installed.

EXAMPLE OUTPUT

$system_traces$strategy_options
replication_factor 
               "2" 

$system_traces$cf_defs
named list()

$system_traces$durable_writes
[1] TRUE

Let me know what your results are if my answer does not work and I will update my answer. Good Luck!

like image 191
Nathan Avatar answered Dec 01 '25 03:12

Nathan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!