如何配置 cassandra 进行远程连接 [英] How to configure cassandra for remote connection

查看:31
本文介绍了如何配置 cassandra 进行远程连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为 Windows 上的远程连接配置 Cassandra Datastax 社区版,

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

Cassandra Server 安装在 Windows 7 PC 上,通过本地 CQLSH,它可以完美地连接到本地服务器.

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

但是当我尝试从同一网络中的另一台 PC 连接 CQLSH 时,我收到此错误消息:

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

连接错误:('无法连接到任何服务器',{'MYHOST':错误(10061,尝试连接到 [('HOST_IP',9042)].最后一个错误:否由于目标机器主动拒绝,可以建立连接它")})

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")})

所以我想知道如何正确配置(我应该对 cassandra.yaml 配置文件进行哪些更改)Cassandra 服务器以允许远程连接.

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.

先谢谢你!

推荐答案

对 Cassandra 的远程访问是通过 Cassandra 2.0 的 thrift 端口进行的.在 Cassandra 2.0.x 中,默认的 cqlsh 监听端口是 9160,它是在 cassandra.yaml 中由 rpc_port 参数定义的.默认情况下,Cassandra 2.0.x 及更早版本通过在 cassandra.yaml 文件中将 start_rpc 配置为 true 来启用 Thrift.

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. By default, Cassandra 2.0.x and earlier enables Thrift by configuring start_rpc to true in the cassandra.yaml file.

在 Cassandra 2.1 中,cqlsh 实用程序使用本机协议.在使用 Datastax python 驱动程序的 Cassandra 2.1 中,默认的 cqlsh 监听端口是 9042.

In Cassandra 2.1, the cqlsh utility uses the native protocol. In Cassandra 2.1, which uses the Datastax python driver, the default cqlsh listen port is 9042.

cassandra 节点应该绑定到你的服务器网卡的 IP 地址——它不应该是 127.0.0.1 或 localhost 这是环回接口的 IP,绑定到这个将阻止直接远程访问.要配置绑定地址,请使用 cassandra.yaml 中的 rpc_address 参数.将此设置为 0.0.0.0 将侦听所有网络接口.

The 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. To configure the bound address, use the rpc_address parameter in cassandra.yaml. Setting this to 0.0.0.0 will listen on all network interfaces.

您是否检查过远程机器可以连接到 Cassandra 节点?机器之间有防火墙吗?您可以尝试以下步骤进行测试:

Have you checked that the remote machine can connect to the Cassandra node? Is there a firewall between the machines? You can try these steps to test this out:

1) 确保您可以从您所在的服务器连接到该 IP:

$ ssh 用户@xxx.xxx.xx.xx

$ ssh user@xxx.xxx.xx.xx

2) 检查节点的状态并确认它显示相同的 IP:

$nodetool 状态

$nodetool status

3) 运行命令连接IP(如果不使用默认端口,只指定端口):

$ cqlsh xxx.xxx.xx.xx

$ cqlsh xxx.xxx.xx.xx

这篇关于如何配置 cassandra 进行远程连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆