Apache Cassandra remote access

☆樱花仙子☆ 提交于 2019-11-29 05:28:52
CraigJPerry

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

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.

KingOfHypocrites

For anyone using Azure, the issue may be that you need to create a public ip address since the virtual ip points to the cloud service itself and not the virtual machine. You can find more info in this post

cassandra 3.11.3

I did the following to get mine working. Changes in cassandra.yaml :

start_rpc: true

rpc_address: 0.0.0.0

broadcast_rpc_address: ***.***.***.***

broadcast_rpc_address is the address of machine where cassandra is installed

 seed_provider:
  - class_name: ...
    - seeds: "127.0.0.1, ***.***.***.***"

In seeds i added/appended the ip address of machine where cassandra was running.

I accessed it from windows using tableplus. In tableplus, I wrote the ip address of the cassandra machine, in the port section I wrote 9042 and used the username and password, which i used for ssh connection.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!