我在使用DataStax php驱动程序连接Cassandra时遇到了超时问题。每当我执行某个命令时,它总是在10秒后抛出异常:
PHP Fatal error: Uncaught exception 'Cassandra\Exception\TimeoutException' with message 'Request timed out'
我的php代码如下:
$cluster = Cassandra::cluster()->build();
$session = $cluster->connect("my_base");
$statement = new Cassandra\SimpleStatement("SELECT COUNT(*) as c FROM my_table WHERE my_colunm = 1 AND my_colunm2 >= '2015-01-01' ALLOW FILTERING")
$result = $session->execute($statement);
$row = $result->first();
我的cassandra.yaml文件中的设置如下:
# How long the coordinator should wait for read operations to complete
read_request_timeout_in_ms: 500000
# How long the coordinator should wait for seq or index scans to complete
range_request_timeout_in_ms: 1000000
# How long the coordinator should wait for writes to complete
write_request_timeout_in_ms: 2000
# How long the coordinator should wait for counter writes to complete
counter_write_request_timeout_in_ms: 50000
# How long a coordinator should continue to retry a CAS operation
# that contends with other proposals for the same row
cas_contention_timeout_in_ms: 50000
# How long the coordinator should wait for truncates to complete
# (This can be much longer, because unless auto_snapshot is disabled
# we need to flush first so we can snapshot before removing the data.)
truncate_request_timeout_in_ms: 60000
# The default timeout for other, miscellaneous operations
request_timeout_in_ms: 1000000
我已经尝试过这个方法:
$result = $session->execute($statement,new Cassandra\ExecutionOptions([
'timeout' => 120
])
);
并且还有这个:
$cluster = Cassandra::cluster()->withDefaultTimeout(120)->build();
还有这个:
set_time_limit(0)
无论如何,它总是在10秒后抛出TimeoutException。
我使用的是Cassandra 3.6,有任何想法吗?