【发布时间】:2021-10-25 10:50:45
【问题描述】:
我在连接到托管 DataStax Cassandra 6.8 的 Centos 7.x 服务器时遇到了一些困难。
我能够在 Centos Shell 内成功连接本地,并且 nodetool 状态显示集群 Up 和 Normal。
我在 cassandra.yaml 文件中尝试过的东西 -
- 将listen_address 参数从localhost 更改为服务器的IP 地址。结果 -> DSE 未启动。
- 注释了listen_address 行。结果 -> DSE 未启动
- 将listen_address 的参数留空。结果 -> DSE 未启动。
如上所述—— 操作系统 - 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通。
非常感谢任何帮助。
谢谢
【问题讨论】: