sstableloader. The error: could not achieve replication factor 2 (found 1 replicas only), check your keyspace replication settings

sstableloader. The error: could not achieve replication factor 2 (found 1 replicas only), check your keyspace replication settings

我尝试将 sstableloader 实用程序用于 BulkLoad。 SStables 是通过使用像 https://github.com/yukim/cassandra-bulkload-example/blob/master/src/main/java/bulkload/BulkLoad.java.

这样的脚本创建的

当我在 node5 [10.0.2.2] 上启动 sstableload 时,出现以下错误:

./sstableloader data/keyspace1/ -d localhost
WARN  14:56:55 Error while computing token map for datacenter dc2: could not achieve replication factor 2 (found 1 replicas only), check your keyspace replication settings.
WARN  14:56:55 Error while computing token map for datacenter dc1: could not achieve replication factor 3 (found 0 replicas only), check your keyspace replication settings.

键空间信息:

cqlsh> DESCRIBE keyspace1;
CREATE KEYSPACE keyspace1 WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': '3', 'dc2': '2'}  AND durable_writes = true;

节点信息:

./nodetool status keyspace1
Datacenter: dc1
===============
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address        Load       Tokens       Owns (effective)  Host ID                               Rack
UN  10.0.1.1  286.11 KB  256          100.0%            504effa7-bf46-48c6-af80-3fe7d43cea4c  r1
UN  10.0.1.2  335.55 KB  256          100.0%            95551193-344b-4672-9803-f8d192210f63  r1
UN  10.0.1.3  476.38 KB  256          100.0%            66f431cc-7843-47ea-81ec-85bc6b7adb34  r2
Datacenter: dc2
===============
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address        Load       Tokens       Owns (effective)  Host ID                               Rack
UN  10.0.2.1   34.69 GB   256          100.0%            f9f0de46-4c75-4671-a7c4-8d6b5b8b658c  r2
UN  10.0.2.2   31.79 GB   256          49.5%             c3f30f98-bab3-43f0-97e8-d8187556f3a9  r1
UN  10.0.2.3   34.32 GB   256          50.5%             7ebdd58d-dfe5-4abe-a80e-0b63ee57d0d9  r1

./nodetool version
ReleaseVersion: 3.1.1

节点正在侦听本地主机。

netstat -na | grep 9042
tcp 0 0 ::ffff:127.0.0.1:9042 :::* LISTEN

cassandra.yaml

cluster_name: 'testCluster1'
num_tokens: 256
seed_provider:
   - class_name: org.apache.cassandra.locator.SimpleSeedProvider
       parameters:
           - seeds: "10.0.1.1,10.0.2.1"
listen_address:
endpoint_snitch: GossipingPropertyFileSnitch

cassandra-rackdc.properties (node1)

dc=dc1
rack=r1

我尝试从 dc1 的节点 1(种子)开始,但我也得到了结果:

./sstableloader -d localhost data/keyspace1/ -f /export/data/cassandra/dc1/r1/node1/conf/cassandra.yaml WARN 19:17:01 Error while computing token map for datacenter dc2: could not achieve replication factor 2 (found 0 replicas only), check your keyspace replication settings. WARN 19:17:01 Error while computing token map for datacenter dc1: could not achieve replication factor 3 (found 1 replicas only), check your keyspace replication settings. WARN 19:17:01 Error while computing token map for datacenter dc2: could not achieve replication factor 1 (found 0 replicas only), check your keyspace replication settings...

sstableloader 会有点启动 C*(不是在客户端模式),这需要节点的 cassandra.yaml 等并被赋予适当的种子节点。您是偶然 运行 在其中一个 dc2 节点上这样做的吗?如果节点没有在 localhost 接口上监听,它可能无法加入环以知道流向何处,并且 non-client 模式可能会扰乱副本计算。尝试提供 -d 10.0.1.1,10.0.1.2,10.0.2.1,10.0.2.2 作为您的种子

我的错误:

  1. 节点必须在 0.0.0.0 上监听 9042。更改 cassandra.yaml: rpc_address: localhostrpc_address:
  2. 需要使用:./sstableloader data/keyspace1/tablename -d IPADDRESS

另请注意:当您在 CQLSH 中定义复制因子并指定数据中心时......

CREATE KEYSPACE keyspace1 WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': '3', 'dc2': '2'}  AND durable_writes = true;

大小写 敏感并且必须与您在 卡桑德拉-rackdc.properties 文件

dc=dc1
rack=rack1

将这些混淆,您将收到相同的错误消息