Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Astyanax-尝试连接到cassandra时出现TokenRangeOfflineException_Cassandra_Playorm_Astyanax - Fatal编程技术网

Astyanax-尝试连接到cassandra时出现TokenRangeOfflineException

Astyanax-尝试连接到cassandra时出现TokenRangeOfflineException,cassandra,playorm,astyanax,Cassandra,Playorm,Astyanax,这就是我如何连接Cassandra,作者Astyanax: Builder builder = new AstyanaxContext.Builder() .forCluster(clusterName) .forKeyspace(keyspace2) .withAstyanaxConfiguration(new AstyanaxConfigurationImpl() .setDiscoveryType(Node

这就是我如何连接Cassandra,作者Astyanax:

Builder builder = new AstyanaxContext.Builder()
        .forCluster(clusterName)
        .forKeyspace(keyspace2)
        .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()      
            .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
        )
        .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("MyConnectionPool")
            .setMaxConnsPerHost(2)
            .setInitConnsPerHost(2)
            .setSeeds("localhost,localhost")
        )
        .withConnectionPoolMonitor(new CountingConnectionPoolMonitor());
            AstyanaxConfigurationImpl config = new AstyanaxConfigurationImpl();
        config.setDefaultWriteConsistencyLevel(ConsistencyLevel.CL_QUORUM);
        config.setDefaultReadConsistencyLevel(ConsistencyLevel.CL_QUORUM);
        builder = builder.withAstyanaxConfiguration(config);
如果在种子中我只放了“localhost”,那么效果很好。 如果我放上“localhost,localhost”或“localhost”,它会给出下面的异常。 我会错过什么?问题不在于主机,地址是正确的。。。如果我使用CL_Quorum,是否有任何配置需要注意

java.lang.RuntimeException: com.netflix.astyanax.connectionpool.exceptions.TokenRangeOfflineException: TokenRangeOfflineException: [host=localhost(127.0.0.1):9160, latency=10(10), attempts=1] UnavailableException()
    at com.alvazan.orm.layer9z.spi.db.cassandra.CursorKeysToRows.execute(CursorKeysToRows.java:157)
    at com.alvazan.orm.layer9z.spi.db.cassandra.CursorKeysToRows.loadCache(CursorKeysToRows.java:100)
    at com.alvazan.orm.layer9z.spi.db.cassandra.CursorKeysToRows.nextImpl(CursorKeysToRows.java:65)
    at com.alvazan.orm.layer0.base.CursorRow.nextImpl(CursorRow.java:33)
    at com.alvazan.orm.api.z8spi.iter.AbstractCursor.next(AbstractCursor.java:10)
    at com.alvazan.orm.layer0.base.BaseEntityManagerImpl.find(BaseEntityManagerImpl.java:132)
    at com.alvazan.orm.layer0.base.BaseEntityManagerImpl.saveMetaData(BaseEntityManagerImpl.java:235)
    at com.alvazan.orm.layer0.base.BaseEntityManagerFactoryImpl.rescan(BaseEntityManagerFactoryImpl.java:102)
    at com.alvazan.orm.layer0.base.BaseEntityManagerFactoryImpl.setup(BaseEntityManagerFactoryImpl.java:131)
    at com.alvazan.orm.impl.bindings.BootstrapImpl.createInstanceImpl(BootstrapImpl.java:64)
    at com.alvazan.orm.impl.bindings.BootstrapImpl.createInstance(BootstrapImpl.java:35)
    at com.alvazan.orm.api.base.Bootstrap.create(Bootstrap.java:57)
    at com.alvazan.orm.api.base.Bootstrap.create(Bootstrap.java:52)
    at com.alvazan.orm.api.base.Bootstrap.create(Bootstrap.java:45)
    at com.alvazan.orm.api.base.Bootstrap.create(Bootstrap.java:24)
    at com.s1mbi0se.dmp.da.dao.PlayOrmConfiguration.init(PlayOrmConfiguration.java:39)
    at com.s1mbi0se.dmp.da.dao.TestUserDao.testFindAllUsers(TestUserDao.java:73)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: com.netflix.astyanax.connectionpool.exceptions.TokenRangeOfflineException: TokenRangeOfflineException: [host=localhost(127.0.0.1):9160, latency=10(10), attempts=1] UnavailableException()
    at com.netflix.astyanax.thrift.ThriftConverter.ToConnectionPoolException(ThriftConverter.java:165)
    at com.netflix.astyanax.thrift.AbstractOperationImpl.execute(AbstractOperationImpl.java:60)
    at com.netflix.astyanax.thrift.AbstractOperationImpl.execute(AbstractOperationImpl.java:27)
    at com.netflix.astyanax.thrift.ThriftSyncConnectionFactoryImpl$1.execute(ThriftSyncConnectionFactoryImpl.java:131)
    at com.netflix.astyanax.connectionpool.impl.AbstractExecuteWithFailoverImpl.tryOperation(AbstractExecuteWithFailoverImpl.java:52)
    at com.netflix.astyanax.connectionpool.impl.AbstractHostPartitionConnectionPool.executeWithFailover(AbstractHostPartitionConnectionPool.java:229)
    at com.netflix.astyanax.thrift.ThriftColumnFamilyQueryImpl$4.execute(ThriftColumnFamilyQueryImpl.java:457)
    at com.alvazan.orm.layer9z.spi.db.cassandra.CursorKeysToRows.execute(CursorKeysToRows.java:155)
    ... 39 more
Caused by: UnavailableException()
    at org.apache.cassandra.thrift.Cassandra$multiget_slice_result.read(Cassandra.java:9722)
    at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78)
    at org.apache.cassandra.thrift.Cassandra$Client.recv_multiget_slice(Cassandra.java:613)
    at org.apache.cassandra.thrift.Cassandra$Client.multiget_slice(Cassandra.java:597)
    at com.netflix.astyanax.thrift.ThriftColumnFamilyQueryImpl$4$1.internalExecute(ThriftColumnFamilyQueryImpl.java:463)
    at com.netflix.astyanax.thrift.ThriftColumnFamilyQueryImpl$4$1.internalExecute(ThriftColumnFamilyQueryImpl.java:460)
    at com.netflix.astyanax.thrift.AbstractOperationImpl.execute(AbstractOperationImpl.java:55)
    ... 45 more

我认为这与另一个问题有关。您只想使用localhost或种子列表。我们基本上会进行一些检测,如果您只使用一个节点,那么在使用localhost或写入和读取失败时,我们会使用clu one来保持一致性。我们为2个或更多的种子做CL_QUOROM。您是否需要我们对此进行修改以支持单个远程节点

谢谢, 院长