连接到Centos 7.x服务器托管的DataStax Cassandra 6.8时遇到一些困难
我能够成功地在Centos外壳内部本地连接,nodetool状态显示集群已启动且正常
我在cassandra.yaml文件中尝试过的东西-
如上所述- OS-CentOS 7 DSE版本-6.8 安装方法RPM
Python程序-
#cluster = Cluster()
cluster = Cluster(['192.168.1.223'])
# To establish connection and begin executing queries, need a session
session = cluster.connect()
row = session.execute("select release_version from system.local;").one()
if row:
print(row[0])
else:
print("An error occurred.")
从python引发异常->
NoHostAvailable: ('Unable to connect to any servers', {'192.168.1.223:9042': ConnectionRefusedError(10061, "Tried connecting to [('192.168.1.223', 9042)]. Last error: No connection could be made because the target machine actively refused it")})
我的电脑和服务器都在同一个网络上,我可以相互ping
非常感谢您的帮助
谢谢
在https://community.datastax.com/questions/12174/上也有人问过同样的问题,所以我把我的答案贴在这里
此错误表示您正在连接的节点未侦听IP
192.168.1.223
和CQL端口9042
上的CQL连接:最可能的两个原因是:
您已经指出无法启动DSE。默认情况下,您需要查看位于
/var/log/cassandra
中的日志,以了解它为什么没有运行另一个可能的问题是您没有在开源Cassandra中配置
native_transport_address
(rpc_address
)。您需要将其设置为客户端(您的应用程序)可以访问的IP地址,否则,它将默认为localhost
(127.0.0.1
)在
cassandra.yaml
中,使用以下配置节点:如果只是在本地网络上测试,请将这两个属性都设置为服务器的IP地址。干杯
[编辑]我刚看到你与@Alex Ott的对话。我在这里发布我的回复,因为它不适合评论
此启动错误意味着节点无法与任何种子节点通信,因此无法加入群集:
如果集群中只有1个节点,请使用服务器自己的IP地址配置
cassandra.yaml
中的seeds
列表:相关问题 更多 >
编程相关推荐