无法从不同主机连接到 cassandra 节点 [英] Can't connect to cassandra node from different host

查看:25
本文介绍了无法从不同主机连接到 cassandra 节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一台机器上有一个 cassandra 节点.当我从同一台机器访问 cqlsh 时,它可以正常工作.

I have a cassandra node at a machine. When I access cqlsh from the same machne it works properly.

但是当我尝试使用192.x.x.x"从另一台机器连接到它的 cqlsh 时,我收到一条错误消息

But when I tried to connect to it's cqlsh using "192.x.x.x" from another machine, I'm getting an error saying

连接错误:('无法连接到任何服务器',{'192.xxx':错误(111,尝试连接到[('192.xxx',9042)].最后一个错误:连接被拒绝")})

Connection error: ('Unable to connect to any servers', {'192.x.x.x': error(111, "Tried connecting to [('192.x.x.x', 9042)]. Last error: Connection refused")})

这是什么原因?我该如何解决?

What is the reason for this? How can I fix it?

推荐答案

可能是远程 Cassandra 节点没有绑定到外部网络接口,而是绑定到环回接口(这是默认配置).您可以通过从远程机器使用telnet thecassandrahost 9042"来确保这一点,它应该不起作用.

Probably the remote Cassandra node is not bound to the external network interface but to the loopback one (this is the default configuration). You can ensure this by using "telnet thecassandrahost 9042" from the remote machine, it should not work.

为了将 Cassandra 绑定到外部网络接口,您需要编辑 cassandra.yaml 配置文件并将属性listen_address"和rpc_address"设置为您的远程 IP 或0.0.0.0"(并非所有版本的 Cassandra 都支持通配符地址).

In order to bind Cassandra to the external network interface you need to edit the cassandra.yaml configuration file and set the properties "listen_address" and "rpc_address" to your remote IP or "0.0.0.0" (not all versions of Cassandra support wildcard addresses).

还要检查防火墙是否正确配置或禁用(sudo service iptables stop).

Check also that the firewall is properly configured or disabled (sudo service iptables stop).

这篇关于无法从不同主机连接到 cassandra 节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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