Skip to content
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 (serverselectiontryonce set) #2

Open
emotetechnology opened this issue Oct 21, 2016 · 4 comments
Open

No suitable servers found (serverselectiontryonce set) #2

emotetechnology opened this issue Oct 21, 2016 · 4 comments

Comments

@emotetechnology
Copy link

`An uncaught Exception was encountered

Type: MongoDB\Driver\Exception\ConnectionTimeoutException

Message: No suitable servers found (serverselectiontryonce set)

Filename: /var/www/html/application/vendor/mongodb/mongodb/src/Collection.php

Line Number: 438

Backtrace:

File: /var/www/html/application/vendor/mongodb/mongodb/src/Collection.php
Line: 438
Function: selectServer`

@ehoutsma
Copy link
Owner

Did you enter valid information in the config file?

@emotetechnology
Copy link
Author

The config file information seems valid. I have downgraded to php 5.6 and using this library with the same information in config file and it works.

@ehoutsma
Copy link
Owner

Was there any information behind: " (serverselectiontryonce set)"? There should be a list of the server hosts it tried.

Something like:

Message: No suitable servers found (serverselectiontryonce set): [Failed connecting to 'server1:27017': php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known] [Failed connecting to 'server2:27017': php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known] [Failed connecting to 'server3:27017': Operation timed out]

@ehoutsma
Copy link
Owner

ehoutsma commented Oct 21, 2016

Ah, I see what the problem is.

The problem is that if you have set the replicateset to a value that's not the name of a replicateset it can't connect:
$config['mongo_db']['default']['replicaSet'] = 'rs0';

Simply remove the line in the config file should do the trick!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants