当种子节点(总共2个)使用虚拟节点死亡时,重新平衡Cassandra 1.2群集

时间:2013-03-04 17:34:34

标签: cassandra cluster-computing

我的本​​地计算机上有一个带有修改主机的Cassandra 1.2群集:

#cassandra nodes
m.y.i.p               m.y.i.p   (Node 1)<---- seed 1
m.y.i.p               127.0.0.3 (Node 2)
m.y.i.p               127.0.0.4 (Node 3)<---- seed 2
m.y.i.p               127.0.0.5 (Node 4)
m.y.i.p               127.0.0.6 (Node 5)

...所以群集总共有5个节点。我正在使用虚拟节点,所以我不想在任何地方设置initial_token。

我遵循的步骤:

  1. 启动种子节点(1和3)
  2. 启动节点2和4.
  3. 关闭节点3.
  4. 尝试加入节点5。
  5. 问题出在第4步,当我尝试加入Node 5时,Cassandra抛出了这个异常:

       java.lang.IllegalStateException: unable to find sufficient sources for streaming range (-7204018021044318047,-6965052533844316617]
            at org.apache.cassandra.dht.RangeStreamer.getRangeFetchMap(RangeStreamer.java:205)
            at org.apache.cassandra.dht.RangeStreamer.addRanges(RangeStreamer.java:129)
            at org.apache.cassandra.dht.BootStrapper.bootstrap(BootStrapper.java:81)
            at org.apache.cassandra.service.StorageService.bootstrap(StorageService.java:890)
            at org.apache.cassandra.service.StorageService.joinTokenRing(StorageService.java:659)
            at org.apache.cassandra.service.StorageService.initServer(StorageService.java:514)
            at org.apache.cassandra.service.StorageService.initServer(StorageService.java:411)
            at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:278)
            at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:366)
            at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:409)
    java.lang.IllegalStateException: unable to find sufficient sources for streaming range (-7204018021044318047,-6965052533844316617]
            at org.apache.cassandra.dht.RangeStreamer.getRangeFetchMap(RangeStreamer.java:205)
            at org.apache.cassandra.dht.RangeStreamer.addRanges(RangeStreamer.java:129)
            at org.apache.cassandra.dht.BootStrapper.bootstrap(BootStrapper.java:81)
            at org.apache.cassandra.service.StorageService.bootstrap(StorageService.java:890)
            at org.apache.cassandra.service.StorageService.joinTokenRing(StorageService.java:659)
            at org.apache.cassandra.service.StorageService.initServer(StorageService.java:514)
            at org.apache.cassandra.service.StorageService.initServer(StorageService.java:411)
            at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:278)
            at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:366)
            at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:409)
    Exception encountered during startup: unable to find sufficient sources for streaming range (-7204018021044318047,-6965052533844316617]
    ERROR 16:55:47,634 Exception in thread Thread[StorageServiceShutdownHook,5,main]
    java.lang.NullPointerException
            at org.apache.cassandra.service.StorageService.stopRPCServer(StorageService.java:321)
            at org.apache.cassandra.service.StorageService$1.runMayThrow(StorageService.java:479)
            at org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:28)
            at java.lang.Thread.run(Thread.java:722)
    

    范围(-7204018021044318047,-6965052533844316617)只属于死亡节点(节点3)。由于我使用虚拟节点,我认为环必须重新平衡:

      

    添加或删除节点时不再需要重新平衡群集。当节点加入时   在群集中,它承担来自群集中其他节点的偶数部分数据的责任。如果是一个节点   失败,负载均匀地分布在集群中的其他节点上。

    但我错了,显然:)。

    当前一个节点关闭时,如何在现有群集中加入新节点?请注意,我每个节点有256个令牌,nodetool move不是一个选项(我认为)。

    提前感谢您,欢迎提供任何信息!

1 个答案:

答案 0 :(得分:0)

解决方案是手动从令牌中删除节点3(已关闭)。