Server Errors While Writing With Python Cassandra Driver -
code=1000 [unavailable exception] message="cannot achieve consistency level one" info={'required_replicas': 1, 'alive_replicas': 0, 'consistency': 'one'} code=1100 [coordinator node timed out waiting replica nodes' responses] message="operation timed out - received 0 responses." info={'received_responses': 0, 'required_responses': 1, 'consistency': 'one'} code=1200 [coordinator node timed out waiting replica nodes' responses] message="operation timed out - received 0 responses." info={'received_responses': 0, 'required_responses': 1, 'consistency': 'one'}
i inserting cassandra cassandra 2.0.13(single node testing) python cassandra-driver version 2.6
the following keyspace , table definitions:
create keyspace test_keyspace replication = { 'class': 'simplestrategy', 'replication_factor': '1' }; create table test_table ( key text primary key, column1 text, ..., column17 text ) compact storage , bloom_filter_fp_chance=0.010000 , caching='keys_only' , comment='' , dclocal_read_repair_chance=0.000000 , gc_grace_seconds=864000 , read_repair_chance=0.100000 , replicate_on_write='true' , populate_io_cache_on_flush='false' , compaction={'class': 'sizetieredcompactionstrategy'} , compression={'sstable_compression': 'snappycompressor'};
what tried:
1) multiprocessing(protocol version set 1) each process has own cluster
, session
(default_timeout set 30.0)
def get_cassandra_session(): """creates cluster , gets session base on key space""" # aware session cannot shared between threads/processes # or raise operationtimedout exception if cluster_host2: cluster = cassandra.cluster.cluster([cluster_host1, cluster_host2]) else: # if 1 address available, have use older protocol version cluster = cassandra.cluster.cluster([cluster_host1], protocol_version=1) session = cluster.connect(key_space) session.default_timeout = 30.0 return session
2) batch insert (protocol version set 2 because batchstatement enabled on cassandra 2.x)
def batch_insert(session, batch_queue, batch): try: insert_user = session.prepare("insert " + db.table + " (" + db.column1 + "," + db.column2 + "," + db.column3 + "," + db.column4 + ") values (?,?,?,?)") while batch_queue.qsize() > 0: '''batch queue size 1000''' row_tuple = batch_queue.get() batch.add(insert_user, row_tuple) session.execute(batch) except exception e: logger.error("batch insert fail.... %s", e)
the above function invoked by:
batch = batchstatement(consistency_level=consistencylevel.one) batch_insert(session, batch_queue, batch)
tuples stored in batch_queue.
3) synchronizing execution several days ago post question cassandra update fails , cassandra complaining timeout issue. using synchronize execution updating.
can help, code issue or python cassandra-driver issue or cassandra ?
thanks million!
if question errors @ top, server-side error responses.
the first says coordinator contacted cannot satisfy request @ cl.one, nodes believes alive. can happen if replicas down (more low replication factor).
the other 2 errors timeouts, coordinator didn't responses 'live' nodes in time configured in cassandra.yaml.
all of these indicate cluster you're connected not healthy. because overwhelmed (high gc pauses), or experiencing network issues. check server logs clues.
Comments
Post a Comment