Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache Cassandra remote access

I have installed Apache Cassandra on the remote Ubuntu server. How to allow remote access for an Apache Cassandra database? And how to make a connection?

like image 723
user1588782 Avatar asked Sep 02 '12 14:09

user1588782


People also ask

How do I access my Cassandra database remotely?

Remote access to Cassandra is via its thrift port for Cassandra 2.0. In Cassandra 2.0. x, the default cqlsh listen port is 9160 which is defined in cassandra. yaml by the rpc_port parameter.

Is Apache Cassandra still used?

It's currently a key part of the Apache Software Foundation and can be used by anyone wanting to benefit from it. Cassandra stands out among database systems and offers some advantages over other systems.


2 Answers

Remote access to Cassandra is via its thrift port (although note that the JMX port can be used to perform some limited operations).

The thrift port is defined in cassandra.yaml by the rpc_port parameter, which defaults to 9160. Your cassandra node should be bound to the IP address of your server's network card - it shouldn't be 127.0.0.1 or localhost which is the loopback interface's IP, binding to this will prevent direct remote access. You configure the bound address with the rpc_address parameter in cassandra.yaml. Setting this to 0.0.0.0 says "listen on all network interfaces" which may or may not be suitable for you.

To make a connection you can use:

  • The cassandra-cli in the cassandra distribution's bin directory provides simple get / set / list operations and depends on Java
  • The cqlsh shell which provides CQL access to cassandra, this depends on Python
  • A higher level interface such as Apollo
like image 101
CraigJPerry Avatar answered Sep 29 '22 11:09

CraigJPerry


For anyone finding this question now, the top answer is out of date.

Apache Cassandra's thrift interface is deprecated and will be removed in Cassandra 4.0. The default client port is now 9042.

As noted by Tyler Hobbs, you will need to ensure that the rpc_address parameter is not set to 127.0.0.1 or localhost (it is localhost by default). If you set it to 0.0.0.0 to listen on all interfaces, you will also need to set broadcast_rpc_address to either the node's public or private IP address (depending on how you plan to connect to Cassandra)

Cassandra-cli is also deprecated and Apollo is no longer active. Use cqlsh in lieu of cassandra-cli and the Java driver in lieu of Apollo.

I do not recommend making the JMX port accessible remotely unless you secure it properly by enabling SSL and strong authentication.

Hope this is helpful.

like image 37
Justin Cameron Avatar answered Sep 29 '22 12:09

Justin Cameron