无法从不同的主机连接到cassandra节点

Cha*_*hna 15 cassandra network-interface cqlsh datastax

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

但当我尝试使用另一台机器上的"192.xxx"连接到它的cqlsh时,我收到一个错误说

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

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

Nic*_*aro 19

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

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

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

  • 这取决于您使用的cassandra的版本.正如您在[此处](http://www.datastax.com/documentation/cassandra/2.0/cassandra/configuration/configCassandra_yaml_r.html)所示,在v 2.0中允许使用通配符.如果您使用的是其他版本,请使用您的远程地址. (4认同)

Bra*_*ley 5

设置此文件所在的config参数.可能/etc/cassandra/cassandra.yaml.

cassandra.yaml

listen_address: 192.x.x.x
rpc_address: 192.x.x.x
Run Code Online (Sandbox Code Playgroud)

然后,重新启动该服务.


小智 5

1.更新\xef\xbc\x9a./conf/cassandra.yaml

\n\n
rpc_address: 0.0.0.0 ("0.0.0.0" allow anywhere IP,but you can appoint an IP)\n\n\\# broadcast_rpc_address: 1.2.3.4 (Delete comment if rpc_address=0.0.0.0)\n
Run Code Online (Sandbox Code Playgroud)\n\n

2.重启

\n\n
./bin/cassandra\n
Run Code Online (Sandbox Code Playgroud)\n\n

案例:我使用java访问cassandra时遇到无法远程访问cassandra的问题

\n