Python 卡桑德拉:“这是我的梦想。”;无法针对任何主机完成操作";在session.execute()期间

Python 卡桑德拉:“这是我的梦想。”;无法针对任何主机完成操作";在session.execute()期间,python,cassandra,cql,Python,Cassandra,Cql,卡桑德拉版本:1.2.2 节俭API版本:19.35.0 CQL支持的版本:2.0.0,3.0.1(默认值:3.0.1) python 3.4的cassandra驱动程序 用sudo运行cassandra/bin/cassandra 代码示例: from cassandra.cluster import Cluster cluster = Cluster() session = cluster.connect() # 1 session.execute("use test") # 2

卡桑德拉版本:1.2.2
节俭API版本:19.35.0
CQL支持的版本:2.0.0,3.0.1(默认值:3.0.1)
python 3.4的cassandra驱动程序
用sudo运行cassandra/bin/cassandra

代码示例

from cassandra.cluster import Cluster
cluster = Cluster()
session = cluster.connect()    # 1
session.execute("use test")    # 2
cluster.shutdown()
#2的错误消息:
会话。执行(“使用测试”)
文件“cassandra/cluster.py”,第1581行,在cassandra.cluster.Session.execute中
文件“cassandra/cluster.py”,第3145行,位于cassandra.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()

更多关于哪个1.2版本的详细信息?1.2.2我编辑了我的帖子以包含信息。keyspace
test
是否包含任何数据?是的。它有一组列族(表),包含大量数据。键空间是使用cassandra cli创建的,我使用pycassa填充数据库。@yang5找到解决方案了吗?它是一个本地节点,默认情况下,联系人设置为127.0.0.1。