Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure cassandra for remote connection

I am trying to configure Cassandra Datastax Community Edition for remote connection on windows,

Cassandra Server is installed on a Windows 7 PC, With the local CQLSH it connects perfectly to the local server.

But when i try to connect with CQLSH from another PC in the same Network, i get this error message:

Connection error: ('Unable to connect to any servers', {'MYHOST': error(10061, "Tried connecting to [('HOST_IP', 9042)]. Last error: No connection could be made because the target machine actively refused it")})

So i am wondering how to configure correctly (what changes should i make on cassandra.yaml config file) the Cassandra server to allow remote connections.

Thank you in advance!

like image 998
Obama Avatar asked Mar 21 '16 14:03

Obama


People also ask

How do I connect to Cassandra database remotely?

For security reasons, the Cassandra ports in this solution cannot be accessed over a public IP address. To connect to Cassandra from a different machine, you must open ports 9042, 9160, 7000, 7001 and 7199 for remote access.

How do I connect to Cassandra database from Linux?

a) For Mac/LinuxOpen your terminal and using the following command, create a “. cassandra/cqlshrc” file in your user home directory. Open the empty cqlshrc file using the following command. Copy the following content and paste it into the empty cqlshrc file.


1 Answers

How about this:

Make these changes in the cassandra.yaml config file:

start_rpc: true

rpc_address: 0.0.0.0

broadcast_rpc_address: [node-ip]

listen_address: [node-ip]

seed_provider:
  - class_name: ...
    - seeds: "[node-ip]"

reference: https://gist.github.com/andykuszyk/7644f334586e8ce29eaf8b93ec6418c4

like image 148
ahll Avatar answered Sep 17 '22 09:09

ahll