How to connect remotely to Cassandra cluster?

panic: gocql: unable to create session: unable to discover protocol version: dial tcp xxx.xxx.xx.xxx:9042: i/o timeout

Photo by Kevin Ku on Unsplash

This is a quick article on how to set up Cassandra for remote access.

After creating your cluster, keyspace, and table, it’s time now to connect to Cassandra DB.
Locally We can connect to Cassandra using the CQLSH interface. what if any third party application wants to access to our database? that’s when RPC comes in.
RPC stands for Remote Procedure Call.

So let’s configure it.

To configure the Cassandra RPC, navigate and open the cassandra.yaml file with any editor:

find this line

Replace localhost by the current host IP where Cassandra is installed, for example 192.168.xx.xx

As mentioned this port should not be exposed to the internet or shared with anyone for security reasons.

Now save the file and restart Cassandra

Try to connect from any remote computer

Or use any programming language :
With Go

Boom, well done!!!!!😁

Tech nerd. South Korea

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store