5n集群中的Cassandra TokenRangeOfflineException

时间:2018-06-23 12:59:28

标签: cassandra astyanax

我是Cassandra的新手,面临以下TokenRangeOffline异常, 我有一个5n群集,其复制因子设置为5,一致性级别为Quorum。

我在集群上做了一个描述键空间:

CREATE KEYSPACE "StorageOS" WITH replication = {
    'class': 'NetworkTopologyStrategy',
     'DC'  : '5'
};

例外:

2018-06-22 18:44:26,161 [DriverUpdateThead_139] ERROR  CountingConnectionPoolMonitor.java (line 94) com.netflix.astyanax.connectionpool.exceptions.TokenRangeOfflineException: TokenRangeOfflineException: [host=xx.xx.xx.xx(xx.xx.xx.xx):9160, latency=8(5009), attempts=2]UnavailableException()
com.netflix.astyanax.connectionpool.exceptions.TokenRangeOfflineException: TokenRangeOfflineException: [host=xx.xx.xx.xx(xx.xx.xx.xx):9160, latency=8(5009), attempts=2]UnavailableException()
    at com.netflix.astyanax.thrift.ThriftConverter.ToConnectionPoolException(ThriftConverter.java:165)
    at com.netflix.astyanax.thrift.AbstractOperationImpl.execute(AbstractOperationImpl.java:65)
    at com.netflix.astyanax.thrift.ThriftColumnFamilyQueryImpl$1$2.execute(ThriftColumnFamilyQueryImpl.java:190)
    at com.netflix.astyanax.thrift.ThriftColumnFamilyQueryImpl$1$2.execute(ThriftColumnFamilyQueryImpl.java:182)
    at com.netflix.astyanax.thrift.ThriftSyncConnectionFactoryImpl$ThriftConnection.execute(ThriftSyncConnectionFactoryImpl.java:151)
    at com.netflix.astyanax.connectionpool.impl.AbstractExecuteWithFailoverImpl.tryOperation(AbstractExecuteWithFailoverImpl.java:119)
    at com.netflix.astyanax.connectionpool.impl.AbstractHostPartitionConnectionPool.executeWithFailover(AbstractHostPartitionConnectionPool.java:338)
    at com.netflix.astyanax.thrift.ThriftColumnFamilyQueryImpl$1.execute(ThriftColumnFamilyQueryImpl.java:180)

Caused by: UnavailableException()
    at org.apache.cassandra.thrift.Cassandra$get_slice_result$get_slice_resultStandardScheme.read(Cassandra.java:11815)
    at org.apache.cassandra.thrift.Cassandra$get_slice_result$get_slice_resultStandardScheme.read(Cassandra.java:11773)
    at org.apache.cassandra.thrift.Cassandra$get_slice_result.read(Cassandra.java:11699)
    at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78)
    at org.apache.cassandra.thrift.Cassandra$Client.recv_get_slice(Cassandra.java:671)
    at org.apache.cassandra.thrift.Cassandra$Client.get_slice(Cassandra.java:655)
    at com.netflix.astyanax.thrift.ThriftColumnFamilyQueryImpl$1$2.internalExecute(ThriftColumnFamilyQueryImpl.java:195)
    at com.netflix.astyanax.thrift.ThriftColumnFamilyQueryImpl$1$2.internalExecute(ThriftColumnFamilyQueryImpl.java:182)
    at com.netflix.astyanax.thrift.AbstractOperationImpl.execute(AbstractOperationImpl.java:60)
    ... 20 more

更多信息:

已通过localhost:9160连接到StorageOS。

[cqlsh 4.1.1 |卡桑德拉2.1.11 | CQL规范3.1.1 |节俭协议19.39.0]

我知道也有人问过与此异常相关的类似问题,但是在我的具体情况下,我无法理解如何进行处理。有人可以帮忙吗?

1 个答案:

答案 0 :(得分:1)

要看的一件事是您正在运行的Cassandra版本。 Astyanax默认使用“目标” Cassandra版本1.1。这是因为原始代码库利用了Thrift API,该API使用端口9160(如您所见)。

但默认情况下,较新版本的Cassandra(2.2+)禁用 Thrift协议。因此,您有两种选择:

1。。向Astyanax告知您所使用的版本(如documentation中所述):

<input type="file" id="files" name="files[]" multiple />
<output id="list"></output>

请注意,使用此选项,您需要将9042设置为端口。

2。。通过更改cassandra.yaml(在所有节点上)的设置,使Cassandra能够收听Thrift。

AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
    .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()      
        .setCqlVersion("3.4.4")
        .setTargetCassandraVersion("3.11.2"))

看看是否有帮助。