python - Cannot achieve consistency level LOCAL_ONE info={required_replicas 1 alive_replicas: 0, consistency: LOCAL_ONE} -
my cluster size 6 machines. data amount small 30.000. have read,write,delete , update operations might costly although data amount low. don't why error message occurs since data amount low. answers appreciated.
when cassandra cluster busy error message:
warning code=1000 [unavailable exception] message="cannot achieve consistency level local_one" info={'required_replicas': 1, 'alive_replicas': 0, 'consistency': 'local_one'}
this read cassandra python code:
cluster = cluster(['localhost']); session = cluster.connect('keyspaace') kafka = kafkaclient('localhost'); producer = simpleproducer(kafka) channels = session.execute("select id channels;") channel_ids = [channel.id channel in channels] sleep_time = 10*60 / (len(channel_ids)+0.0) channel in channel_ids: url = 'http://toutiao.com/m%s/?%s' % (channel, urllib.urlencode({'_': datetime.utcnow().replace(tzinfo=pytz.utc).isoformat()})) producer.send_messages('toutiao.incoming_urls', json.dumps({'appid': 'articles', 'crawlid': 'channel-%s' % (channel), 'spiderid': 'toutiao', 'url': url, 'useragent': 'mozilla/5.0 (windows nt 10.0; wow64) applewebkit/537.36 (khtml, gecko) chrome/50.0.2661.94 safari/537.36', 'attrs': {'id': channel, '_': datetime.utcnow().replace(tzinfo=pytz.utc).isoformat()}})) print url # log.info(url) time.sleep(sleep_time)
i attached additional information such keyspace, nodetool status etc. great if me solve this.
(1) edit cassandra cluster nodetool status:
datacenter: analytics ===================== status=up/down |/ state=normal/leaving/joining/moving -- address load tokens owns (effective) host id rack un 192.168.183.30 34.22 gb 1 76.7% 29ab1909-087c-447b-afaa-0e7db664f06d rack1 un 192.168.183.109 22.57 gb 1 54.1% c4bde944-6b94-44dd-9d09-c3934c3568c6 rack1 un 192.168.183.106 27.81 gb 1 65.9% 7c95ca0c-9727-4e5b-9736-368493bc87ab rack1 un 192.168.183.121 24.61 gb 1 60.0% 85537680-70fc-494d-8e1f-48da35e9c33b rack1 un 192.168.183.20 20.76 gb 1 43.3% 4572c3f5-a946-453d-89bc-5815361fced9 rack1 datacenter: solr ================ status=up/down |/ state=normal/leaving/joining/moving -- address load tokens owns (effective) host id rack un 192.168.182.142 25.77 gb 1 100.0% 34d5797f-7b84-4e16-8f4d-80aa574408d2 rack1
(2)channels schema
create table toutiao.channels ( id text primary key, avatar text, category text, created_at timestamp, last_crawled timestamp, last_modified timestamp, name text, scheduled_for timestamp, source text, status text, url text ) bloom_filter_fp_chance = 0.01 , caching = '{"keys":"all", "rows_per_partition":"none"}' , comment = '' , compaction = {'class': 'org.apache.cassandra.db.compaction.sizetieredcompactionstrategy'} , compression = {'sstable_compression': 'org.apache.cassandra.io.compress.lz4compressor'} , dclocal_read_repair_chance = 0.1 , default_time_to_live = 0 , gc_grace_seconds = 864000 , max_index_interval = 2048 , memtable_flush_period_in_ms = 0 , min_index_interval = 128 , read_repair_chance = 0.0 , speculative_retry = '99.0percentile';
(3) edit keyspace
create keyspace mykeyspace replication = {'class': 'networktopologystrategy', 'analytics': '3', 'solr': '1'} , durable_writes = true;
you have wrong replication configuration. have replication factor of 6 on datacenter analytics datacenter doesn't exist. change ana , add solr cluster. or can change in snitch configuration. , don't use replication factor of 6. use 3 or maybe 4 instead. have 5 nodes in ana cluster. high replication factor can slow down cluster extremely. error come if inconsistent snitch or replication configuration.
Comments
Post a Comment