Cassandra:添加新节点后数据丢失
Cassandra: Data loss after adding new node
我们有一个两个节点的 cassandra 集群,我们想将其扩展到四个。
我们按照那里描述的程序进行操作:http://www.datastax.com/documentation/cassandra/1.2/cassandra/operations/ops_add_node_to_cluster_t.html
但是在添加了两个节点之后(同时,按照文档中的建议间隔 2 分钟),我们遇到了一些数据丢失的情况。在某些列族中,缺少元素。
这是nodetool netstats
:
[centos@ip-10-11-11-187 ~]$ nodetool status
Datacenter: us-west-2
=====================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns Host ID Rack
UN 10.11.11.187 5.63 MB 256 ? 0e596912-d649-4eed-82a4-df800c422634 2c
UN 10.11.1.104 748.79 MB 256 ? d8b96739-0858-4926-9eb2-27c96ca0a1c4 2c
UN 10.11.11.24 7.11 MB 256 ? e3e76dcf-2c39-42e5-a34e-9e986d4a9f7c 2c
UN 10.11.1.231 878.91 MB 256 ? cc1b5cfd-c9d0-4ca9-bbb1-bce4b2deffc1 2c
Note: Non-system keyspaces don't have the same replication settings, effective ownership information is meaningless
不太明白"Note"好不好
当我们添加节点时,我们将前两台服务器(已在集群中可用)放入第一个添加节点的配置种子中。对于第二个添加的节点,我们把新添加的节点也放在seeds中。
我们正在使用EC2Snitch
,并且listen_address
已在每个服务器上设置为上述地址。
我们还没有 运行 清理,但我们尝试 运行 修复,并且写着我们的键帽没有任何东西需要修复。
我们的集群是这样创建的:
CREATE KEYSPACE keyspace_name WITH replication = {'class': 'NetworkTopologyStrategy', 'us-west-2': '1'} AND durable_writes = true;
以及我们所有表格的选项:
CREATE TABLE keyspace_name."CFName" (
// ...
) WITH bloom_filter_fp_chance = 0.01
AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}'
AND comment = ''
AND compaction = {'min_threshold': '4', 'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32'}
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';
如果我停用新节点,数据会重新出现。
编辑:实际上是阅读文档时出错...一位同事确实将 auto_bootstrap 设置为 false 而不是将其设置为 true...
在使用 auto_bootstrap 添加新节点后,您应该在新节点上执行 nodetool rebuild
: false
http://www.datastax.com/documentation/cassandra/2.0/cassandra/tools/toolsRebuild.html
HTH
那么您可以指定键空间名称以删除节点,在本例中为
nodetool status keyspace_name
我们有一个两个节点的 cassandra 集群,我们想将其扩展到四个。 我们按照那里描述的程序进行操作:http://www.datastax.com/documentation/cassandra/1.2/cassandra/operations/ops_add_node_to_cluster_t.html
但是在添加了两个节点之后(同时,按照文档中的建议间隔 2 分钟),我们遇到了一些数据丢失的情况。在某些列族中,缺少元素。
这是nodetool netstats
:
[centos@ip-10-11-11-187 ~]$ nodetool status
Datacenter: us-west-2
=====================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns Host ID Rack
UN 10.11.11.187 5.63 MB 256 ? 0e596912-d649-4eed-82a4-df800c422634 2c
UN 10.11.1.104 748.79 MB 256 ? d8b96739-0858-4926-9eb2-27c96ca0a1c4 2c
UN 10.11.11.24 7.11 MB 256 ? e3e76dcf-2c39-42e5-a34e-9e986d4a9f7c 2c
UN 10.11.1.231 878.91 MB 256 ? cc1b5cfd-c9d0-4ca9-bbb1-bce4b2deffc1 2c
Note: Non-system keyspaces don't have the same replication settings, effective ownership information is meaningless
不太明白"Note"好不好
当我们添加节点时,我们将前两台服务器(已在集群中可用)放入第一个添加节点的配置种子中。对于第二个添加的节点,我们把新添加的节点也放在seeds中。
我们正在使用EC2Snitch
,并且listen_address
已在每个服务器上设置为上述地址。
我们还没有 运行 清理,但我们尝试 运行 修复,并且写着我们的键帽没有任何东西需要修复。
我们的集群是这样创建的:
CREATE KEYSPACE keyspace_name WITH replication = {'class': 'NetworkTopologyStrategy', 'us-west-2': '1'} AND durable_writes = true;
以及我们所有表格的选项:
CREATE TABLE keyspace_name."CFName" (
// ...
) WITH bloom_filter_fp_chance = 0.01
AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}'
AND comment = ''
AND compaction = {'min_threshold': '4', 'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32'}
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';
如果我停用新节点,数据会重新出现。
编辑:实际上是阅读文档时出错...一位同事确实将 auto_bootstrap 设置为 false 而不是将其设置为 true...
在使用 auto_bootstrap 添加新节点后,您应该在新节点上执行 nodetool rebuild
: false
http://www.datastax.com/documentation/cassandra/2.0/cassandra/tools/toolsRebuild.html
HTH
那么您可以指定键空间名称以删除节点,在本例中为
nodetool status keyspace_name