下面我遇到了这个问题,我使用的是google cloud VM
:~$ cqlsh
Connection error: ('Unable to connect to any servers', {'127.0.0.1': error(111, "Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused")})
~$ cd /etc/cassandra/我这样设置我的主机
127.0.0.1 localhost
10.14*.0.* vm-1
10.15*.0.* vm-2我从ifconfig上得到了ip
vm-1 inet addr:10.14*.0.* Bcast:10.14*.0.* Mask:255.255.255.255
vm-2 inet addr:10.15*.0.* Bcast:10.15*.0.* Mask:255.255.255.255在cassandra.yaml中
我在VM-2中设置
listen_address: 10.15*.0.*
rpc_address: 10.15*.0.*在cassandra-env.sh中
JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=10.15*.0.*"
vm2@vm-2:/etc/cassandra$ netstat -nl | grep 7199
tcp 0 0 127.0.0.1:7199 0.0.0.0:* LISTEN它只有在我这样做的时候才能起作用:
vm2@vm-2:/etc/cassandra$ cqlsh vm-2
Connected to dc1 at vm-2:9042.
[cqlsh 5.0.1 | Cassandra 3.11.6 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
cqlsh>是否可以将默认ip更改为我在Listen_address中使用的ip?
发布于 2020-02-24 17:25:27
看起来类似的问题。你能参考下面的帖子吗,如果有帮助的话。
发布于 2020-02-22 12:44:33
尝试使用"cqlsh IP地址“。应该能行得通。如果在cassandra.yaml中进行了配置,您还可以输入用户名和密码。
https://stackoverflow.com/questions/60342461
复制相似问题