我想对单个节点上的Cassandra实例(v1.1.10)执行简单的写入操作。我只是想看看它如何处理常量写入,以及它是否能跟上写入速度。如何处理AllServersUnavailable异常
pool = ConnectionPool('testdb')
test_cf = ColumnFamily(pool,'test')
test2_cf = ColumnFamily(pool,'test2')
test3_cf = ColumnFamily(pool,'test3')
test_batch = test_cf.batch(queue_size=1000)
test2_batch = test2_cf.batch(queue_size=1000)
test3_batch = test3_cf.batch(queue_size=1000)
chars=string.ascii_uppercase
counter = 0
while True:
counter += 1
uid = uuid.uuid1()
junk = ''.join(random.choice(chars) for x in range(50))
test_batch.insert(uid, {'junk':junk})
test2_batch.insert(uid, {'junk':junk})
test3_batch.insert(uid, {'junk':junk})
sys.stdout.write(str(counter)+'\n')
pool.dispose()
代码保持长写(当计数器为10M左右+)粉碎后,出现以下消息
pycassa.pool.AllServersUnavailable: An attempt was made to connect to each of the servers twice, but none of the attempts succeeded. The last failure was timeout: timed out
我设置queue_size=100
这并没有帮助。我也发射了cqlsh -3
控制台截断表脚本后坠毁,并得到了以下错误:
Unable to complete request: one or more nodes were unavailable.
尾矿/var/log/cassandra/system.log
没有给出错误的迹象,但信息上压实,FlushWriter等。我究竟做错了什么?
你看见那个节点上过多的CPU或磁盘使用情况?可能JVM垃圾回收处理不好,尽管我希望日志能够显示相关内容。 – 2013-04-15 23:09:14