PHP failed connecting to mongodb after upgrade pecl-mongo from 1.3.7 to 1.4.5
| From: | Chaoshu SHA | Date: | Tue, 18 Feb 2014 04:31:15 +0000 |
| Subject: | PHP failed connecting to mongodb after upgrade pecl-mongo from 1.3.7 to 1.4.5 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-322919@lists.php.net to get a copy of this message | ||
here is the log messages, and pecl-mongo version info,
----
php > $m = new MongoClient("192.168.1.112");
PHP Notice: PARSE INFO: Parsing 192.168.1.112 in php shell code on line 1
PHP Stack trace:
PHP 1. {main}() php shell code:0
PHP 2. MongoClient->__construct() php shell code:1
PHP Notice: PARSE INFO: - Found node: 192.168.1.112:27017 in php shell code on line 1
PHP Stack trace:
PHP 1. {main}() php shell code:0
PHP 2. MongoClient->__construct() php shell code:1
PHP Notice: PARSE INFO: - Connection type: STANDALONE in php shell code on line 1
PHP Stack trace:
PHP 1. {main}() php shell code:0
PHP 2. MongoClient->__construct() php shell code:1
PHP Notice: CON INFO: mongo_get_read_write_connection: finding a STANDALONE connection in php shell code on line 1PHP Stack trace: PHP 1. {main}() php shell code:0 PHP 2. MongoClient->__construct() php shell code:1
PHP Notice: CON INFO: connection_create: creating new connection for 192.168.1.112:27017 in php shell code on line 1PHP Stack trace: PHP 1. {main}() php shell code:0 PHP 2. MongoClient->__construct() php shell code:1
PHP Notice: CON INFO: stream_connect: Not establishing SSL for 192.168.1.112:27017 in php shell code on line 1PHP Stack trace: PHP 1. {main}() php shell code:0 PHP 2. MongoClient->__construct() php shell code:1
PHP Notice: CON INFO: get_server_flags: start in php shell code on line 1PHP Stack trace: PHP 1. {main}() php shell code:0 PHP 2. MongoClient->__construct() php shell code:1
PHP Notice: CON FINE: send_packet: read from header: 36 in php shell code on line 1PHP Stack trace: PHP 1. {main}() php shell code:0 PHP 2. MongoClient->__construct() php shell code:1
PHP Notice: CON FINE: send_packet: data_size: 95 in php shell code on line 1PHP Stack trace: PHP 1. {main}() php shell code:0 PHP 2. MongoClient->__construct() php shell code:1
PHP Notice: CON FINE: get_server_flags: setting maxBsonObjectSize to 16777216 in php shell code on line 1PHP Stack trace: PHP 1. {main}() php shell code:0 PHP 2. MongoClient->__construct() php shell code:1
PHP Notice: CON FINE: get_server_flags: setting maxMessageSizeBytes to 48000000 in php shell code on line 1PHP Stack trace: PHP 1. {main}() php shell code:0 PHP 2. MongoClient->__construct() php shell code:1
PHP Notice: CON INFO: get_server_flags: found server type: UNKNOWN? in php shell code on line 1PHP Stack trace: PHP 1. {main}() php shell code:0 PHP 2. MongoClient->__construct() php shell code:1
PHP Notice: CON WARN: server_flags: error while getting the server configuration 192.168.1.112:27017: get_server_flags: got unknown node type in php shell code on line 1PHP Stack trace: PHP 1. {main}() php shell code:0 PHP 2. MongoClient->__construct() php shell code:1
PHP Notice: CON WARN: Couldn't connect to '192.168.1.112:27017': get_server_flags: got unknown node type in php shell code on line 1PHP Stack trace: PHP 1. {main}() php shell code:0 PHP 2. MongoClient->__construct() php shell code:1 PHP Notice: REPLSET FINE: finding candidate servers in php shell code on line 1 PHP Stack trace: PHP 1. {main}() php shell code:0 PHP 2. MongoClient->__construct() php shell code:1 PHP Notice: REPLSET FINE: - all servers in php shell code on line 1 PHP Stack trace: PHP 1. {main}() php shell code:0 PHP 2. MongoClient->__construct() php shell code:1 PHP Notice: REPLSET FINE: filter_connections: adding connections: in php shell code on line 1 PHP Stack trace: PHP 1. {main}() php shell code:0 PHP 2. MongoClient->__construct() php shell code:1 PHP Notice: REPLSET FINE: filter_connections: done in php shell code on line 1 PHP Stack trace: PHP 1. {main}() php shell code:0 PHP 2. MongoClient->__construct() php shell code:1 PHP Notice: REPLSET FINE: limiting by seeded/discovered servers in php shell code on line 1 PHP Stack trace: PHP 1. {main}() php shell code:0 PHP 2. MongoClient->__construct() php shell code:1 PHP Notice: REPLSET FINE: limiting by seeded/discovered servers: done in php shell code on line 1 PHP Stack trace: PHP 1. {main}() php shell code:0 PHP 2. MongoClient->__construct() php shell code:1 PHP Notice: REPLSET FINE: limiting by credentials in php shell code on line 1 PHP Stack trace: PHP 1. {main}() php shell code:0 PHP 2. MongoClient->__construct() php shell code:1 PHP Notice: REPLSET FINE: limiting by credentials: done in php shell code on line 1 PHP Stack trace: PHP 1. {main}() php shell code:0 PHP 2. MongoClient->__construct() php shell code:1 PHP Warning: Uncaught exception 'MongoConnectionException' with message 'Failed to connect to: 192.168.1.112:27017: get_server_flags: got unknown node type' in php shell code:1 Stack trace: #0 php shell code(1): MongoClient->__construct('192.168.1.112') #1 {main} thrown in php shell code on line 1 php > ---- mongo MongoDB Support => enabled Version => 1.4.5 SSL Support => enabled Streams Support => enabled ---- in my case, the "192.168.1.112" mongo server is a *slave* instance in a master/slave configuration. after checking the pecl-mongo source code, I believe this exception is caused due to change in function mongo_connection_get_server_flags() of mongo-php-driver/mcon/connections.c does there anyone have encountered the same problem?