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

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

问题描述

我试图将Cassandra Datastax Community Edition配置为在Windows上进行远程连接,

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

Cassandra服务器安装在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服务器(我应该在cassandra.yaml配置文件上进行哪些更改)以允许远程连接。

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的端口。在Cassandra 2.0.x中,默认的cqlsh侦听端口为9160,该端口在rps_port参数的cassandra.yaml中定义。默认情况下,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或本地主机(即回送接口的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 user@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天全站免登陆