无法达到一致性级别 LOCAL_ONE info={required_replicas 1 alive_replicas: 0, 一致性: LOCAL_ONE}

Cannot achieve consistency level LOCAL_ONE info={required_replicas 1 alive_replicas: 0, consistency: LOCAL_ONE}

我的集群大小是 6 台机器。我的数据量很小,只有 30.000。但是我经常有读、写、删除和更新操作,虽然数据量很小,但成本可能很高。我不明白为什么会出现此错误消息,因为数据量非常低。非常感谢任何答案。

当我的 Cassandra 集群繁忙时,我经常收到此错误消息:

WARNING code=1000 [Unavailable exception] message="Cannot achieve consistency level LOCAL_ONE" info={'required_replicas': 1, 'alive_replicas': 0, 'consistency': 'LOCAL_ONE'}

这是我从 cassandra 读取的 python 代码:

cluster = Cluster(['localhost']); session = cluster.connect('keyspaace')
kafka = KafkaClient('localhost'); producer = SimpleProducer(kafka)
channels = session.execute("select id from channels;")
channel_ids = [channel.id for channel in channels]
sleep_time = 10*60 / (len(channel_ids)+0.0)
for 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, like 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)

我附上了一些额外的信息,例如键空间、节点工具状态等。如果你能帮我解决这个问题就太好了。

(1) 编辑 cassandra 集群节点工具状态:

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) 个频道架构

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
) WITH bloom_filter_fp_chance = 0.01
    AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}'
    AND comment = ''
    AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'}
    AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND dclocal_read_repair_chance = 0.1
    AND default_time_to_live = 0
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair_chance = 0.0
    AND speculative_retry = '99.0PERCENTILE';

(3) 编辑 键空间

CREATE KEYSPACE mykeyspace WITH replication = {'class': 'NetworkTopologyStrategy', 'Analytics': '3', 'Solr': '1'}  AND durable_writes = true;

您的复制配置有误。您的数据中心 Analytics 的复制因子为 6,但该数据中心不存在。将其更改为 Ana 并添加您的 solr 集群。或者您可以在告密者配置中更改它。并且不要使用 6 的复制因子。改用 3 或 4。您的 Ana 集群中只有 5 个节点。复制因子太高会极大地降低集群的速度。通常,如果某些内容与您的告密者或复制配置不一致,就会出现此错误。