本文介绍了Astyanax Cassandra驱动程序在批量插入过程中意外删除了主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

Astyanax 1.56.37连接到在Debian上运行的Cassandra 1.2.6:

当快速连续执行多个插入操作时,Cassandra群集仅包含一个位于10.10.1.141的节点,在看似随机的点上,我将在控制台中看到以下内容:

When performing a number of inserts in quick succession to a Cassandra cluster containing only one node located at 10.10.1.141, at seemingly random points, I will see the following in the console:

- AddHost: 127.0.0.1
- RemoveHost: 10.10.1.141

每次我尝试连接到此键空间后,每次尝试都会失败,并显示相同的消息.

Every attempt to connect to this keyspace after I get this fails with the same message.

这是我的配置:

AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
        .forCluster("Titan Cluster")
        .forKeyspace(keyspaceName)
        .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()
            .setConnectionPoolType(ConnectionPoolType.TOKEN_AWARE)
            .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
            .setTargetCassandraVersion("1.2")
        )
        .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("MyConnectionPool")
            .setPort(9160)
            .setMaxConnsPerHost(50)
            .setSeeds("10.10.1.141:9160")
            .setConnectTimeout(2000)
            .setSocketTimeout(30000)
            .setMaxTimeoutWhenExhausted(10000)
            .setMaxTimeoutCount(3)
            .setTimeoutWindow(10000)
            .setLatencyAwareBadnessThreshold(10)
            .setLatencyAwareUpdateInterval(1000)
            .setLatencyAwareResetInterval(10000)
            .setLatencyAwareWindowSize(100)
        )
        .withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
        .buildKeyspace(ThriftFamilyFactory.getInstance());

    context.start();

在随后的context.start()

推荐答案

我也遇到了同样的问题,即我的Cassandra和应用程序(Cassandra客户端)在不同的机器上运行.

I too faced the same issue where I had my Cassandra and application (Cassandra client) running on different machines.

AddHost: 10.10.1.141
AddHost: 127.0.0.1
RemoveHost: 10.10.1.141

当我检查Cassandra环状态时,我发现Cassandra的运行地址为127.0.0.1,而不是10.10.1.141

When I checked my Cassandra ring status, I noticed that the Cassandra was running with the address 127.0.0.1, instead of 10.10.1.141

[email protected]:/opt/dsc-cassandra$ **bin/nodetool ring**

Address    Rack        Status State   Load               Owns                        Token
127.0.0.1  rack1       Up     Normal  169.87 KB       100.00%             -9217929600007243236
127.0.0.1  rack1       Up     Normal  169.87 KB       100.00%             -9140762708880451456
127.0.0.1  rack1       Up     Normal  169.87 KB       100.00%             -8952943573583903866
127.0.0.1  rack1       Up     Normal  169.87 KB       100.00%             -8891950316930533160*

conf/cassandra.yaml中,我为listen_address指定了主机名而不是IP地址. cassandra将主机名更改为localhost(127.0.0.1),而不是实际IP(10.10.1.141).将listen_address更改为实际IP后,客户端成功建立连接.

In conf/cassandra.yaml, I had specified the hostname instead of IP address for listen_address. The cassandra resoved the hostname to localhost (127.0.0.1) instead of the actual IP (10.10.1.141).After changing the listen_address to the actual IP, the client established connection successfully.

监听地址:10.10.1.141

这篇关于Astyanax Cassandra驱动程序在批量插入过程中意外删除了主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 15:34