sstableloader。错误:无法实现复制因子2(仅找到1个副本),请检查您的密钥空间复制设置

时间:2016-01-12 15:43:07

标签: cassandra bulk-load

我尝试将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.

Keyspace信息:

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的node1(种子)开始,但我也得到了结果:

./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...

3 个答案:

答案 0 :(得分:2)

sstableloader将启动C *(不在客户端模式下),这需要节点的cassandra.yaml等,并给予适当的种子节点。您是否偶然在其中一个dc2节点上运行此操作?如果节点没有在localhost接口上侦听,它可能无法加入环以知道要传输到哪里,非客户端模式可能会混淆副本计算。尝试提供-d 10.0.1.1,10.0.1.2,10.0.2.1,10.0.2.2作为种子

答案 1 :(得分:0)

我的错误:

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

答案 2 :(得分:0)

请注意:在CQLSH中定义复制因子并指定数据中心时……。

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

它的 case 敏感,并且必须与您在自己的定义中匹配 cassandra-rackdc.properties文件

dc=dc1
rack=rack1

将它们混合在一起,您将得到相同的错误消息