我想對單個節點上的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