首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Astyanax不尊重配置的套接字超时

Astyanax不尊重配置的套接字超时
EN

Stack Overflow用户
提问于 2016-08-08 09:04:54
回答 2查看 277关注 0票数 4

这是我的设计:

  • 4个节点Cassandra 1.2.19
  • Astyanax 1.56.49

我正在设置配置,如

代码语言:javascript
复制
AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
    .forCluster(service.getClusterName())
    .forKeyspace(service.getKeySpaceName())
    .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()
         .setDiscoveryType(NodeDiscoveryType.NONE)
         .setCqlVersion("3.0.0")
         .setDefaultReadConsistencyLevel(consistencyLevel.getAstyanaxValue())
         .setDefaultWriteConsistencyLevel(consistencyLevel.getAstyanaxValue())
    )
    .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("b2bConnectionPool")
         .setPort(service.getPort())
         .setMaxConnsPerHost(5)
         .setSeeds(StringUtils.join(hosts, ","))
         // increase default timeout for heavy operations (milliseconds)
         .setSocketTimeout(15000)
         .setSSLConnectionContext(sslContext)
         .setAuthenticationCredentials(credentials)
    )
    .withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
    .buildKeyspace(ThriftFamilyFactory.getInstance());

现在有一个可重复的查询,需要很长的时间,并最终抛出一个OperationTimeoutException

代码语言:javascript
复制
com.netflix.astyanax.connectionpool.exceptions.OperationTimeoutException: OperationTimeoutException: [host=myhost(myip):13260, latency=10001(40007), attempts=4]TimedOutException()
    at com.netflix.astyanax.thrift.ThriftConverter.ToConnectionPoolException(ThriftConverter.java:171) ~[astyanax-thrift-1.56.49.jar:na]
    at com.netflix.astyanax.thrift.AbstractOperationImpl.execute(AbstractOperationImpl.java:65) ~[astyanax-thrift-1.56.49.jar:na]
    at com.netflix.astyanax.thrift.ThriftColumnFamilyQueryImpl$1$2.execute(ThriftColumnFamilyQueryImpl.java:190) ~[astyanax-thrift-1.56.49.jar:na]
    at com.netflix.astyanax.thrift.ThriftColumnFamilyQueryImpl$1$2.execute(ThriftColumnFamilyQueryImpl.java:182) ~[astyanax-thrift-1.56.49.jar:na]
    at com.netflix.astyanax.thrift.ThriftSyncConnectionFactoryImpl$ThriftConnection.execute(ThriftSyncConnectionFactoryImpl.java:151) ~[astyanax-thrift-1.56.49.jar:na]
    at com.netflix.astyanax.connectionpool.impl.AbstractExecuteWithFailoverImpl.tryOperation(AbstractExecuteWithFailoverImpl.java:119) ~[astyanax-core-1.56.49.jar:na]
    at com.netflix.astyanax.connectionpool.impl.AbstractHostPartitionConnectionPool.executeWithFailover(AbstractHostPartitionConnectionPool.java:338) ~[astyanax-core-1.56.49.jar:na]
    at com.netflix.astyanax.thrift.ThriftColumnFamilyQueryImpl$1.execute(ThriftColumnFamilyQueryImpl.java:180) ~[astyanax-thrift-1.56.49.jar:na]

异常消息写着"latency=10001“,我认为这应该是配置为15000 ms的套接字超时,但显然不是。如何在astyanax中增加查询操作的超时?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-08-15 17:48:45

当我试图使用更大的数据查询节点时,我得到了类似的超时异常。我在cassandra.yaml中修改了这4个值,它解决了所有超时错误。

协调程序应该等待多久才能完成read_request_timeout_in_ms: 15000的读操作

协调程序应等待seq或索引扫描多久才能完成range_request_timeout_in_ms: 30000

协调程序应该等待多久才能完成write_request_timeout_in_ms: 30000

协调程序应等待计数器写入多长时间才能完成counter_write_request_timeout_in_ms: 15000

注意:您需要在集群中的所有节点中执行此操作,还需要在所有节点中重新启动Cassandra。

票数 1
EN

Stack Overflow用户

发布于 2016-08-15 13:11:31

我相信您没有遇到套接字超时,而是我认为不能通过Astyanax控制的rpc超时。在堆栈跟踪中,封装在OperationTimeoutException中的异常是TimedOutException,当发生rpc超时时(默认为10秒)将抛出该异常。如果出现套接字超时,将抛出SocketTimeoutException

尝试使用cqlsh执行查询,您将得到一条Request did not complete within rpc_timeout消息。

在您的<cassandra_home>/conf/cassandra.yaml中尝试设置:

代码语言:javascript
复制
read_request_timeout_in_ms: 20000
rpc_timeout_in_ms: 20000

重新启动服务器并再次尝试执行查询。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38825146

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档