大量資料插入mongo的時候發生了timeout異常,提示UPDATE失敗:
PHP Fatal error: Uncaught exception 'MongoCursorTimeoutException' with message 'cursor timed out (timeout: 10000, time left: 10:0, status: 0)
MongoDB Support => enabledVersion => 1.3.4phpinfo()PHP Version => 5.4.11嘗試了以下參數,均無效,
array('connectTimeoutMS'=>30000, 'socketTimeoutMS'=>30000, 'wTimeout'=>30000, 'w'=>0)
求解.
PHP Fatal error: Uncaught exception 'MongoCursorException' with message 'Couldn't get connection: Failed to connect to: localhost:26011: send_package: error reading from socket: cursor timed out (timeout: 10000, time left: 10:0, status: 0)' in /data1/www/ifilmp.com/console/SocialGraphTransform/func/ToFollowing.php:76Stack 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
回複內容:
大量資料插入mongo的時候發生了timeout異常,提示UPDATE失敗:
PHP Fatal error: Uncaught exception 'MongoCursorTimeoutException' with message 'cursor timed out (timeout: 10000, time left: 10:0, status: 0)
MongoDB Support => enabledVersion => 1.3.4phpinfo()PHP Version => 5.4.11嘗試了以下參數,均無效,
array('connectTimeoutMS'=>30000, 'socketTimeoutMS'=>30000, 'wTimeout'=>30000, 'w'=>0)
求解.
PHP Fatal error: Uncaught exception 'MongoCursorException' with message 'Couldn't get connection: Failed to connect to: localhost:26011: send_package: error reading from socket: cursor timed out (timeout: 10000, time left: 10:0, status: 0)' in /data1/www/ifilmp.com/console/SocialGraphTransform/func/ToFollowing.php:76Stack 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
$cursor = $collection->find();
$cursor->timeout(-1); # (-1 is no timeout)