【问题标题】:Cassandra connection timed out causing by PasswordAuthenticator由 PasswordAuthenticator 引起的 Cassandra 连接超时
【发布时间】:2016-02-27 05:38:36
【问题描述】:

我是 Cassandra 的新手,无法连接到它。详情如下:

  1. 工作环境: Cubie-board A80,运行Ubuntu Linaro 14.04(从http://dl.cubieboard.org/model/cc-a80/Image/ubuntu-linaro下载)

  2. Cassandra 版本: 2.1.7 版(来自http://downloads.datastax.com/community/dsc-cassandra-2.1.7-bin.tar.gz

  3. 问题描述: 运行cassandra后,使用cqlsh连接时(输入./cqlsh 192.168.10.26 -u cassandra -p cassandra),会超时:Connection error: ('Unable to connect to any servers', {'192.168.10.26': OperationTimedOut('errors=Timed out creating connection, last_host=None',)})

  4. 自检: 在 cassandra 配置文件中,listen_address、rpc_address 和 broadcast_rpc_address 都设置为 192.168.10.26,native_transport_port 为 9042,默认为 true,start_native_transport 为 true。 我还尝试在没有用户名和密码的情况下运行 cqlsh,它显示: Connection error: ('Unable to connect to any servers', {'192.168.10.26': AuthenticationFailed('Remote end requires authentication.',)}),表示cassandra已启动。

知道发生了什么吗?谢谢。

更新:

尝试在cqlsh命令中指定9042端口;
尝试将端口号更改为 9043;
尝试检查端口号 9042:处于“LISTEN”状态并被 java 使用;
尝试检查防火墙状态:未安装 ufw

更新新: 问题缩小:是验证器导致问题,即如果我使用AllowAllAuthenticator,数据库将正常连接;如果我启用 PasswordAuthenticator,则连接超时(使用 cassandra/cassandra 作为用户名和密码)。我知道这很奇怪,我的虚拟机上完全相同的设置没有显示出这样的连接问题。 还在最新的稳定版本 2.2.3 中进行了测试。

到目前为止,问题解决了:本来我在这个Cubieboard上使用OpenJDK,然后我卸载了OpenJDK并切换到Oracle Java,这个问题自己解决了。不幸的是,目前我仍然不知道为什么使用 OpenJDK 会失败,但使用 Oracle 不会。但这种解决方法可能对那些在 Cubieboard A80 上使用 cassandra 的人有所帮助。

【问题讨论】:

  • 您是否检查过您的 cassandra 服务器的防火墙没有阻止端口 9042 和 9160?
  • @Brandon,谢谢你的建议,但是我在这个新的 Cubieboard 上运行的操作系统版本甚至没有安装 ufw。
  • 只是为了验证没有 env 变量或 cqlshrc 文件干扰,尝试在命令行中指定端口cqlsh 192.168.10.26 9042 -u cassandra -p cassandra
  • 你在哪里运行cqlsh?您是从 cassandra 服务器本身运行它吗?还是从另一台机器远程?你用的是什么版本的cqlshcqlsh --version
  • @Brandon,我在同一台机器和另一台机器上都试过,没有什么区别。对于 cqlsh,我使用的是 5.0.1。

标签: ubuntu cassandra cqlsh


【解决方案1】:

将broadcast_rpc_address设置为本地IP并尝试将rpc_address设置为0.0.0.0

【讨论】:

  • 在配置文件中,它说“如果rpc_address设置为0.0.0.0,broadcast_rpc_address必须设置”。
  • 我知道 - 无论如何尝试注释掉 broadcast_rpc_address。默认情况下,该值未设置。
  • 我试过了,但是这种情况下cassandra无法启动:致命配置错误;无法启动。
  • 对不起,我的错误。将 broadcast_rpc_address 设置为本地 IP 地址,将 rpc_address 设置为 0.0.0.0。注释掉 broadcast_rpc_address 在 c* 2.0.8 中有效,但在 2.1.7 中无效。 system.log 是否有任何有用的错误?
  • 完全按照你说的做,连接时仍然超时。日志文件正常,以监听 thrift 客户端结束....另外,我更改了 cofig 中的超时设置,但没有帮助。
猜你喜欢
  • 2021-10-24
  • 2013-08-10
  • 2023-04-10
  • 1970-01-01
  • 2019-03-14
  • 2017-07-19
  • 2014-12-16
  • 1970-01-01
  • 2020-11-30
相关资源
最近更新 更多