Skip to content

mongodb connection-bug #275

@badxpgy

Description

@badxpgy
$manager = new MongoDB\Driver\Manager("mongodb://192.168.1.11:5000,192.168.1.22:5000", array(
        'connect' => true,
        'connectTimeoutMS' => 1000,
        'socketTimeoutMS' => 5000,
        'replicaSet'=>"pktest"
    ));
    $options['projection'] = array();
    $options['limit'] = 1;
    $query = new MongoDB\Driver\Query(array('_id' => 21), $options);
    $rp = new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_PRIMARY);
    $result = $manager->executeQuery("test.test", $query, $rp);
    var_dump($result);

When the first IP port(192.168.1.11:5000) is the PRIMARY and existing, But the last IP port(192.168.1.22:5000) does not exist, Run time prompt (No suitable servers found (serverselectiontryonce set): [connection error calling ismaster on).

If the two IP for a location, and normal, ("mongodb://192.168.1.22:5000,192.168.1.11:5000")

PHP5.4-7.0.4/mongodb1.1.3-1.1.5 Have this problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions