这是我的设置:
- 4个节点的Cassandra 1.2.19
- Astyanax 1.56.49
我正在进行配置,如下所示:
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
异常:
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毫秒的套接字超时,但显然不是。在astyanax中如何增加查询操作的超时时间?