【问题标题】:Can't connect to Cassandra remote host using cqlsh无法使用 cqlsh 连接到 Cassandra 远程主机
【发布时间】:2017-04-19 02:41:27
【问题描述】:

我在 Ubuntu Server 14.04 的单个节点上运行 cassandra(IP 为 10.3.2.92,我通过 VPN 连接到服务器的同一网络)。 cassandra.yaml 文件中的以下参数已更改:

listen_address: 10.3.2.92
rpc_address: 10.3.2.92
- seeds: "10.3.2.92"

rpc_port: 9160 and native_transport_port: 9042, so they are set to default. 

当我在我的机器上使用 OSX 时:

./cqlsh 10.3.2.92 9160

我收到以下错误:

Connection error: ('Unable to connect to any servers', {'10.3.2.92': error(None, "Tried connecting to [('10.3.2.92', 9042)]. Last error: timed out")})

在启动 cassandra 执行 sudo service dse start 之后,我已经在服务器上尝试了 nodetool enablethrift,但没有成功。我也在端口 9042 上试过。

我做错了什么?

提前致谢

编辑:

将 native_transport_port 更改为 8080 并且可以正常工作。我的专用网络管理员阻止了 9xxx 端口。

【问题讨论】:

    标签: cassandra cql ubuntu-server


    【解决方案1】:

    基本上cqlsh 知道如何仅使用 9042 与节点通信。如果您对 9160 感兴趣,您应该使用 cassandra-cli,但此工具已被弃用。

    无论如何,既然您尝试了 9042,我认为您还有其他网络问题。只是为了确保您是否可以尝试关闭telnet 10.3.2.92 9042,如果这不起作用,请检查节点上的防火墙设置。

    【讨论】:

    • 不,即使我禁用节点上的防火墙(执行 sudo ufw disable),telnet 也无法工作。
    • 在为某些通信打开端口之前,您有网络问题(有时路由器上有防火墙,请与您的管理员联系)或 cassandra 甚至没有启动。你能检查一下 cassandra 的 system.log 是否启动了?
    • 是的,cassandra 启动并给出一条消息说正在侦听 10.3.2.92:9042 的 cql 客户端
    • 它说状态被过滤未知......你应该能够做这样的事情:telnet 127.0.0.2 9042 Trying 127.0.0.2... Connected to 127.0.0.2. Escape character is '^]'.
    【解决方案2】:

    https://stackoverflow.com/a/43485961/839733

    cqlsh 知道如何仅使用 9042 与节点对话。

    错了!

    cqlsh host port -u username -p password
    

    工作正常。

    [cqlsh 5.0.1 | Cassandra 3.11.7 | CQL spec 3.4.4 | Native protocol v4]
    

    【讨论】:

      猜你喜欢
      • 2015-11-28
      • 2016-11-27
      • 2016-02-14
      • 2016-04-11
      • 2015-02-05
      • 2017-06-02
      • 1970-01-01
      • 2015-01-03
      • 2018-08-12
      相关资源
      最近更新 更多