-
Notifications
You must be signed in to change notification settings - Fork 1.5k
No suitable servers found (serverSelectionTryOnce set): [connection refused calling ismaster on 'localhost:27017'] #2174
-
I get this error No suitable servers found (serverSelectionTryOnce set): [connection refused calling ismaster on 'localhost:27017']
I am using laravel 7
and this is config / database.php
'mongodb' => [
'driver' => 'mongodb',
'host' => env('MONGO_DB_HOST', 'localhost'),
'port' => 27017,
'database' => env('MONGO_DB_DATABASE'),
'username' => env('MONGO_DB_USERNAME'),
'password' => env('MONGO_DB_PASSWORD'),
'options' => [
'database' => env('MONGO_DB_DATABASE') // sets the authentication database required by mongo 3
]
],
and this is .env
DB_CONNECTION=mongodb
MONGO_DB_HOST=localhost
MONGO_DB_PORT=27017
MONGO_DB_DATABASE=halosis
MONGO_DB_USERNAME=
MONGO_DB_PASSWORD=
What should i do for resolve that problem.
Thanks in advice:)
Beta Was this translation helpful? Give feedback.
All reactions
This has nothing to do with this library. You've error that connection is refused.
Double-check that your MongoDB is accessible at that address.
Thanks!
Replies: 1 comment 2 replies
-
This has nothing to do with this library. You've error that connection is refused.
Double-check that your MongoDB is accessible at that address.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions
-
I try use mongo shell with type this : mongo --host localhost --port 27017
and connected. this is the result
MongoDB shell version v4.4.2
connecting to: mongodb://localhost:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("0e2810f2-d096-4c44-9473-dab053f1e13d") }
MongoDB server version: 4.4.2
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
https://docs.mongodb.com/
Questions? Try the MongoDB Developer Community Forums
https://community.mongodb.com
The server generated these startup warnings when booting:
2021年01月02日T04:17:56.191+00:00: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem
2021年01月02日T04:17:57.256+00:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
Enable MongoDB's free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).
The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.
To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
What's wrong with my connection. i need help.
thanks
Beta Was this translation helpful? Give feedback.
All reactions
-
Try to use database halosis in mongo shell and insert in test collection and write about result
Beta Was this translation helpful? Give feedback.