mongo update timeout

WBOY
Lepaskan: 2016-06-06 20:49:52
asal
1392 orang telah melayarinya

大量数据插入mongo的时候发生了timeout异常,提示UPDATE失败:
PHP Fatal error: Uncaught exception 'MongoCursorTimeoutException' with message 'cursor timed out (timeout: 10000, time left: 10:0, status: 0)

MongoDB Support => enabled Version => 1.3.4 phpinfo() PHP Version => 5.4.11 尝试了以下参数,均无效,
array('connectTimeoutMS'=>30000, 'socketTimeoutMS'=>30000, 'wTimeout'=>30000, 'w'=>0)
求解.

<code class="lang-php">PHP Fatal error:  Uncaught exception 'MongoCursorException' with message 'Couldn't get connection: Failed to connect to: localhost:26011: send_packag
e: error reading from socket: cursor timed out (timeout: 10000, time left: 10:0, status: 0)' in /data1/www/ifilmp.com/console/SocialGraphTransform/fu
nc/ToFollowing.php:76
Stack trace:
#0 /data1/www/ifilmp.com/console/SocialGraphTransform/func/ToFollowing.php(76): MongoCollection->update(Array, Array, Array)
#1 /data1/www/ifilmp.com/console/SocialGraphTransform/process/run.php(10): ToFollowing->run()
#2 {main}
thrown in /data1/www/ifilmp.com/console/SocialGraphTransform/func/ToFollowing.php on line 76
</code>
Salin selepas log masuk
Salin selepas log masuk

回复内容:

大量数据插入mongo的时候发生了timeout异常,提示UPDATE失败:
PHP Fatal error: Uncaught exception 'MongoCursorTimeoutException' with message 'cursor timed out (timeout: 10000, time left: 10:0, status: 0)

MongoDB Support => enabled Version => 1.3.4 phpinfo() PHP Version => 5.4.11 尝试了以下参数,均无效,
array('connectTimeoutMS'=>30000, 'socketTimeoutMS'=>30000, 'wTimeout'=>30000, 'w'=>0)
求解.

<code class="lang-php">PHP Fatal error:  Uncaught exception 'MongoCursorException' with message 'Couldn't get connection: Failed to connect to: localhost:26011: send_packag
e: error reading from socket: cursor timed out (timeout: 10000, time left: 10:0, status: 0)' in /data1/www/ifilmp.com/console/SocialGraphTransform/fu
nc/ToFollowing.php:76
Stack trace:
#0 /data1/www/ifilmp.com/console/SocialGraphTransform/func/ToFollowing.php(76): MongoCollection->update(Array, Array, Array)
#1 /data1/www/ifilmp.com/console/SocialGraphTransform/process/run.php(10): ToFollowing->run()
#2 {main}
thrown in /data1/www/ifilmp.com/console/SocialGraphTransform/func/ToFollowing.php on line 76
</code>
Salin selepas log masuk
Salin selepas log masuk

$cursor = $collection->find();
$cursor->timeout(-1); # (-1 is no timeout)

Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan