yan*_*ng5 5 python cql cassandra
Cassandra版本:1.2.2
Thrift API版本:19.35.0
CQL支持的版本:2.0.0,3.0.1(默认值:3.0.1)
cassandra-driver for python 3.4
运行cassandra/bin/cassandra with sudo
代码示例:
from cassandra.cluster import Cluster
cluster = Cluster()
session = cluster.connect() # 1
session.execute("use test") # 2
cluster.shutdown()
Run Code Online (Sandbox Code Playgroud)
#2的错误消息:
session.execute("use test")
文件"cassandra/cluster.py",第1581行,位于cassandra中的cassandra.cluster.Session.execute
文件"cassandra/cluster.py",第3145行. cluster.ResponseFuture.result cassandra.cluster.NoHostAvailable :('无法完成针对任何主机的操作',{})
困惑:
由于代码示例中的#1没有错误,因此连接似乎没问题.但我不太明白为什么查询执行失败.
尝试为您的集群指定接触点,例如:
from cassandra.cluster import Cluster
cluster = Cluster(['192.168.1.1', '192.168.1.2'])
session = cluster.connect()
Run Code Online (Sandbox Code Playgroud)
有关datastax 文档的更多详细信息
| 归档时间: |
|
| 查看次数: |
2566 次 |
| 最近记录: |