如何在Cassandra中创建会话?

如何在Cassandra中创建会话?,cassandra,cassandra-2.0,Cassandra,Cassandra 2.0,这里是使用Python客户端的Cassandra新手总数 from cassandra.cluster import Cluster cluster = Cluster(['127.0.0.1']) session = cluster.connect() 我得到一个错误: 线程事件_循环中出现异常(很可能在解释器关闭期间引发): 回溯(最近一次呼叫最后一次): 文件“/usr/lib/python2.7/threading.py”,第551行,在\uu bootstrap\u inner 文件

这里是使用Python客户端的Cassandra新手总数

from cassandra.cluster import Cluster
cluster = Cluster(['127.0.0.1'])
session = cluster.connect()
我得到一个错误:

线程事件_循环中出现异常(很可能在解释器关闭期间引发):
回溯(最近一次呼叫最后一次):
文件“/usr/lib/python2.7/threading.py”,第551行,在
\uu bootstrap\u inner

文件“/usr/lib/python2.7/threading.py”,第504行,正在运行
文件“/usr/local/lib/python2.7/dist packages/cassandra_driver-1.0.2-py2.7-linux-x86_64.egg/cassandra/io/asyncorerereactor.py”,第52行,在运行循环中
退出

我想创建第一个表,但无法通过会话

query = "create table timeseries (
  event_type text,
  insertion_time timestamp,
  event blob,
  PRIMARY KEY (event_type, insertion_time)
)
WITH CLUSTERING ORDER BY (insertion_time DESC);"

session.execute(query)

您使用的驱动程序版本是什么?Ubuntu12.04pip上的2.0.6安装cassandra driver=1.0.2如果您从python交互式解释器运行相同的代码,您是否有相同的问题?您是否在与cassandra相同的服务器上运行代码?另外,在您的
cassandra.yaml
中,您的
listen\u地址设置为什么?