cqlsh 连接被拒绝

问题描述 投票:0回答:5

当您收到 Cassandra cqlsh 连接错误时,如下所示:

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

cassandra connection cqlsh
5个回答
2
投票

您也可以不使用 IP 地址进行连接 - 只需使用主机名: cqlsh ‘主机名 -I’


1
投票

另一种解决方案,如果未设置为

cqlsh <listen_address> [<port>]
127.0.0.1
,请键入 
localhost


1
投票

我在 Cassandra 3.11.0 上遇到了同样的问题,每当我更改 rpc 地址或监听地址时,cqlsh 都不起作用。我必须添加相同的本地IP到

seeds

经过反复试验,我的 cassandra.yml 看起来像:

class-name: org.apache.cassandra.locator.SimpleSeedProvider
parameters: 
    -seeds: "192.168.0.30"

listen_adress: 192.168.0.30
rpc_address: 192.168.0.30

然后跑步

cqlsh 192.168.0.30 9042

0
投票

当我安装Cassandra 3.11.1时,我遇到了这个问题。 我也发现如果我跑步

服务 cassandra 状态

,有一个

cassandra 已死,但 pid 文件存在

问题。表明Cassandra服务没有启动 我检查了

/var/log/cassandra/cassandra.log

发现这个错误:

启动时遇到异常...

.这是一个错误,已经报告。原帖链接https://issues.apache.org/jira/browse/CASSANDRA-14173.

解决方案是将Cassandra降级到3.0

  1. 下载 Cassandra rpm

卷曲-O https://www.apache.org/dist/cassandra/redhat/30x/cassandra-3.0.15-1.noarch.rpm

wget https://www.apache.org/dist/cassandra/redhat/30x/cassandra-3.0.15-1.noarch.rpm

  1. rpm -ivh cassandra-3.0.15-1.noarch.rpm
  2. 服务 cassandra 启动
  3. service cassandra status # 检查 cassandra 状态,应该显示

cassandra(pid 1234)正在运行...

  1. cqlsh #启动cassandra

希望这对您有帮助


0
投票

只需检查是否有 Cassandra 正在运行 ps 斧头 | grep 卡桑德拉

如果是,使用 pid 杀死该进程

杀死pid

这对我有用

© www.soinside.com 2019 - 2024. All rights reserved.