mongo update timeout

WBOY
發布: 2016-06-06 20:49:52
原創
1392 人瀏覽過

大量数据插入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>
登入後複製
登入後複製

回复内容:

大量数据插入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>
登入後複製
登入後複製

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

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板