-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No suitable servers found #133
Comments
eventually related to: #112 |
Are you sure mongod is actually running?
|
I am pretty sure mongod is running, as it always was with the legacy driver. Let's see. |
ups, command not found?? https://travis-ci.org/prooph/event-store-mongodb-adapter/jobs/89329883 |
Edit:
So try, right after that:
|
is running:
however: MongoDB\Driver\Exception\RuntimeException: No suitable servers found ( see: https://travis-ci.org/prooph/event-store-mongodb-adapter/jobs/89335661 |
I'm getting this error too, any solution? =( |
same mistake, I have to wait for a speedy problem-solving? |
Is this issue only happening on Travis, or is the error easily reproducible on a development environment, too? |
Reading prooph/event-store-mongodb-adapter's .travis.yml:
Comparing this with the .travis.yml file from mongo-php-library:
Since standardizing on this Travis configuration, I haven't experienced this exception (it does sound familiar from earlier builds we were doing over the summer, though). |
Thanks for the input, will try this evening and let you know.
|
I just compared my composer.json with yours and made some updates. See: https://github.com/prolic/event-store-mongodb-adapter/blob/new_driver/.travis.yml Still got the error:
MongoDB\Driver\Exception\RuntimeException: No suitable servers found ( I don't have this problem on my local machine, currently it only comes up on travis. Best. |
Current Travis Build here: https://travis-ci.org/prooph/event-store-mongodb-adapter/builds/90772042 |
I am having the same problem. No idea what to do. I think it is a driver problem. I hope a new DLL can solve this. Maybe another combination of library or server version resolve this too, but this is the official driver for MongoDB 3.0.7/3.2. Well it is experimental yet, but I think it will unleash the full potential of MongoDB. Or maybe another userland library becomes the best off all soon... Who knows? MongoDB\Driver\Exception\RuntimeException [ 13053 ]: No suitable servers found ( |
I am having the same issue, running php 5.6, apache 2.4 on windows 8.1 - Caught exception No suitable servers found ( this comes from trying to run the included example write.php. I am sure mongodb is running as I'm using it with an unrelated nodejs project. Did anyone manage to find a solution to this? |
I installed the MongoDB library using: composer require mongodb/mongodb But when I try to do any operation, my Apache server crashes and I got this error: [mpm_winnt:notice] [pid 7660:tid 580] AH00354: Child: Starting 150 worker threads. |
I installed the library using: But I realised that it installed the version 0.2.0... So, I did try again with the beta version: But the same error occurs... It throws at: mongodb\mongodb\src\Operation\Find.php [ 165 ]:
So, I opened the MongoDB\Collection::find() method and print_r() some vars there:
I have no idea what is wrong... Should this $server return anything? Maybe I am using an outdated DLL? My system config is a Windows 7 with XAMPP (PHP 5.6.12, 32-bits TS VC11). |
I am seeing this problem on a freshly installed and updated CentOS 6.7 box with PHP 5.5.29, Pecl mongodb 1.0.1. I used the mongodb/mongodb composer package, trying both 1.0.0-beta1 and dev-master versions. I'm certain mongodb is running:
As suggested in other comments the problem appears to be with getting the server. The code below outputs a zero element array:
|
Same problem on OSX. Seems to be happening in this file in the library when it's calling the driver: vendor/mongodb/mongodb/src/Collection.php:517
This seems critical to me. I don't see a work around for the moment and there are people there with production code depending on this. |
Same on the Laravel Homestead VM. To replicate, the after.sh script is as follows:
composer.json
routes.php $app->get('/', function () {
$manager = new MongoDB\Driver\Manager("mongodb://localhost:27017");
$servers = $manager->getServers();
var_dump($servers);
}); The MongoDB shell works fine and
|
I've had the same issue on my local setup and resolved it by changing |
Using |
I managed to repro this using the Homested vm as @syntheticminds suggested. <?php
$manager = new MongoDB\Driver\Manager("mongodb://localhost:27017/");
$command = new MongoDB\Driver\Command(array("buildinfo" => 1));
try {
$cursor = $manager->executeCommand("admin", $command);
$response = $cursor->toArray()[0];
} catch(MongoDB\Driver\Exception $e) {
echo $e->getMessage(), "\n";
exit;
}
var_dump($response);
?> It appears to be related to IPv6.. If there is an entry like the following in
I get
But removing that entry, or changing the hostname to 127.0.0.1 like so:
and the script works as expected. I then tried to reproduce this locally by adding the IPv6 entry to I'm not sure how to fix this at the moment though, but the workaround is to not use Can you try the workaround again @syntheticminds ? |
I changed "localhost" to 127.0.0.1 and it is working fine now! Thank you @kornrunner! :) But I'm still getting this error: ErrorException [ Fatal Error ]: Class 'MongoId' not found By the way, is the MongoDB\BSON\ObjectID class the same as MongoId? |
@pulstar yes, |
the reason is mongod server not support ipv6 by defualt, but the systemOS used ipv6. or, enable the mongod ipv6 support ! 此问题的原因在于: 解决办法,有2个. 或者是: |
I feel like I should have known this. Unsure what I should say other then to apologize. @yanshiba is absolute right. mongod does not support IPv6 connections by default. His work workaround is spot on. Either remove the The old driver did not have this problem as it didn't actually support IPv6 and therefore never tried to connect over IPv6. We should fix this somehow, defaulting to IPv4 or whatever. For now -- @yanshiba thank you so much for the help! |
I've opened PHPLIB-151 and mongodb/mongo-php-library#60, which should at least change the default Client constructor argument. |
Thank you @bjori! |
@bjori Yes it works now. Thanks everyone. Great work! |
When doing async connections we can't properly determine if we should connect over IPv6 or IPv4. PHP will unfortunately default to connecting over IPv6 (when compiled in support, with minor runtime check), while mongod does not support IPv6 by default. When then creating the IPv6 connection asyncronously, PHP hits EINPROGRESS and will happily return the socket as valid. There currently is no way to configure these functions to prefer IPv4. The best we can do for now is to not connect asyncronously as then we'll properly discover that the IPv6 socket failed, and then continue through the list of addrinfo and next pickup the IPv4 address which works.
For me, this fixed: |
I had this issue: I searched a lot but did not get any solution.. after I opened terminal and run command
--dbpath is your /data/db path and my code is working properly.. |
check connect options, remove 'replicaSet' |
on travis, see: https://travis-ci.org/prooph/event-store-mongodb-adapter/jobs/89299198
The text was updated successfully, but these errors were encountered: