Astyanax Cassandra主机在密钥空间已存在时被删除

Astyanax Cassandra主机在密钥空间已存在时被删除,cassandra,cassandra-2.0,astyanax,Cassandra,Cassandra 2.0,Astyanax,我正在使用Astyanax 2.0.1连接到Cassandra 我正在构建我的AstyanaxContext,例如: this.context = new AstyanaxContext.Builder() .forCluster(config.getClusterName()) .forKeyspace(config.getKeyspace()) .withConnectionPoolConfigu

我正在使用Astyanax 2.0.1连接到Cassandra

我正在构建我的AstyanaxContext,例如:

this.context = new AstyanaxContext.Builder()
                .forCluster(config.getClusterName())
                .forKeyspace(config.getKeyspace())
                .withConnectionPoolConfiguration(connectionPoolConfiguration)
                .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()
                        .setDiscoveryType(NodeDiscoveryType.TOKEN_AWARE)
                )
                .withConnectionPoolMonitor(new Slf4jConnectionPoolMonitorImpl())
                .buildKeyspace(ThriftFamilyFactory.getInstance());
        this.context.start();
在此之后,我尝试创建键空间,如果它不存在,我会得到以下结果:

AddHost: test-cassandra
  HostAdded: test-cassandra(192.168.2.111):9160
  BadRequestException: [host=test-cassandra(192.168.2.111):9160, latency=8(24), attempts=1]InvalidRequestException(why:Keyspace 'test' does not exist)
这是正确的(然后我将继续创建键空间)。但如果键空间确实存在,我会得到:

AddHost: test-cassandra
HostAdded: test-cassandra(192.168.2.111):9160
AddHost: 127.0.0.1
HostAdded: 127.0.0.1(127.0.0.1):9160
RemoveHost: test-cassandra
HostRemoved: test-cassandra(192.168.2.111):9160
这将创建一个错误的上下文,因为它现在开始指向localhost,并最终以失败告终

PoolTimeoutException: [host=127.0.0.1(127.0.0.1):9160, latency=2001(2001), attempts=1]Timed out waiting for connection
如果配置错误,有什么想法吗?

这个答案有用吗:?