Apache Cassandra 远程访问 [英] Apache Cassandra remote access
问题描述
我已经在远程 Ubuntu 服务器上安装了 Apache Cassandra.如何允许远程访问 Apache Cassandra 数据库?以及如何建立联系?
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?
推荐答案
对 Cassandra 的远程访问是通过其 thrift 端口(尽管请注意 JMX 端口可用于执行一些有限的操作).
Remote access to Cassandra is via its thrift port (although note that the JMX port can be used to perform some limited operations).
thrift 端口在 cassandra.yaml
中由 rpc_port
参数定义,默认为 9160.你的 cassandra 节点应该绑定到你服务器网络的 IP 地址卡 - 它不应该是 127.0.0.1
或 localhost
这是环回接口的 IP,绑定到它会阻止直接远程访问.您可以使用 cassandra.yaml 中的 rpc_address
参数配置绑定地址.将此设置为 0.0.0.0
表示侦听所有网络接口",这可能适合也可能不适合您.
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:
- cassandra 发行版的 bin 目录下的 cassandra-cli 提供了简单的 get/set/list 操作,依赖于 Java
- cqlsh shell 提供对 cassandra 的 CQL 访问,这取决于 Python
- 更高级别的界面,例如 Apollo
这篇关于Apache Cassandra 远程访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!