我在设置新的 Cassandra 集群时遇到问题。我在 EC2(区域:eu-west-1b)中建立了一个 3 节点集群。当我尝试将记录插入新表时,我收到以下错误消息:
cqlsh:test> insert into mytest (id, value) values(1,100);
Unable to complete request: one or more nodes were unavailable.
我已确认 3 个节点已启动并正在运行:
nodetool status
UN ***.***.***.*** 68.1 KB 256 33.2% bbf1c5e9-ac68-41a1-81a8-00c7877c4eac rack1
UN ***.***.***.*** 81.95 KB 256 34.1% e118e3a7-2486-4c08-8ba1-d337888ff59c rack1
UN ***.***.***.*** 68.12 KB 256 32.7% 041cb88e-df21-4640-b7ac-7a87fd38dae6 rack1
我用来创建键空间和表的命令是:
create keyspace test with replication ={'class':'NetworkTopologyStrategy', 'eu-west-1b': 2};
use test;
create table mytest (id int primary key, value int);
insert into mytest (id, value) values(1,100);
每个节点都可以看到密钥空间——我使用了 CQLSH 并运行了 descibe 密钥空间并从每个节点获得了以下输出:
CREATE KEYSPACE test WITH replication = {
'class': 'NetworkTopologyStrategy',
'eu-west-1b': '2'
};
USE test;
CREATE TABLE mytest (
id int PRIMARY KEY,
value int
) WITH
bloom_filter_fp_chance=0.010000 AND
caching='KEYS_ONLY' AND
comment='' AND
dclocal_read_repair_chance=0.000000 AND
gc_grace_seconds=864000 AND
read_repair_chance=0.100000 AND
replicate_on_write='true' AND
populate_io_cache_on_flush='false' AND
compaction={'class': 'SizeTieredCompactionStrategy'} AND
compression={'sstable_compression': 'SnappyCompressor'};