sudo mongod --dbpath /Users/apple/development/mongodb/data/db when i run this im getting and error that premission denied in mac - mongodb

connecting to: mongodb://ac-impfze5-shard-00-01.wygb8zb.mongodb.net:27017,ac-impfze5-shard-00-02.wygb8zb.mongodb.net:27017,ac-impfze5-shard-00-00.wygb8zb.mongodb.net:27017/myFirstDatabase?authSource=admin&compressors=disabled&gssapiServiceName=mongodb&replicaSet=atlas-x9mb3l-shard-0&ssl=true
{"t":{"$date":"2023-02-10T20:59:39.312Z"},"s":"I", "c":"NETWORK", "id":5490002, "ctx":"thread1","msg":"Started a new thread for the timer service"}
*** You have failed to connect to a MongoDB Atlas cluster. Please ensure that your IP whitelist allows connections from your network.
Error: can't connect to new replica set master [ac-impfze5-shard-00-01.wygb8zb.mongodb.net:27017], err: AuthenticationFailed: bad auth : authentication failed :
connect#src/mongo/shell/mongo.js:374:17
#(connect):2:6
exception: connect failed
exiting with code 1

Related

Error :couldn't connect to server 127.0.0.1:27017, connection attempt failed: NetworkTimeout Error connecting caused by Socket operation timed out

MongoDB shell version v4.4.6
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: NetworkTimeout: Error connecting to 127.0.0.1:27017 :: caused by :: Socket operation timed out :
connect#src/mongo/shell/mongo.js:374:17
#(connect):2:6
exception: connect failed
exiting with code 1
Everytime when I run mongo command , it says error connecting to 127.0.0.1:27017 caused by socket opeartion timed out.
Tried following many instructions given by peers , but it didn't work.
Hope I get rid of this by your instructions.
Thanks!
Reason: mongodb service is not running
Run mongodb service method:
Open the terminal and execute mongod -dbpath "D:\Program Files\MongoDB\data\db"
("D:\Program Files\MongoDB\data\db" is the directory you created to store data)
Open another terminal and execute mongo

Can't login to Wekan DB CentOS console

I have recently installed Wekan on a CentOS (CentOS Linux release 7.6.1810) server and it works well. However I need to login to the MongoDB. I have followed the installation guide of MongoDB and set a password for 'admin' user. But when When the "mongo -u admin -p" command is entered it prompts for password and I get the following error. However I have another issue not starting "mongod", but it is enabled.
connecting to: test
2020-06-12T01:20:23.618-0400 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused
2020-06-12T01:20:23.618-0400 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:229:14
#(connect):1:6
exception: connect failed
I created this user in mongo which does not seem to work when trying to login to the DB.
$ mongo
db.createUser(
{
user: "admin",
pwd: "abcd1234",
roles: [ { role: "root", db: "admin" } ]
}
)
Firstly I installed the latest version of mongodb and then I downgraded to to 3.2 which works with wekan. However Wekan still works fine without any issue.
This is the error I get when starting the mongod.
$ systemctl start mongod
Job for mongod.service failed because the control process exited with error code.
See "systemctl status mongod.service" and "journalctl -xe" for details.
$ systemctl enable mongod
mongod.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig mongod on
The port mongod uses is 27019 which I found from the following command.
$ ss -nutlp
tcp LISTEN 0 128 127.0.0.1:27019 *:* users:(("mongod",pid=11578,fd=6))
What am I doing wrong here?
In the output of the mongo shell connection failure:
Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused
This tells you that it is attempting to connect to port 27017 on localhost, and that the operating system actively refused the connection because nothing is listening on that port.
The ss output shows that mongod is listening on port 27019.
Try adding --port 27019 to your mongo command line.

MacOS Catalina Wont connect to MONGODB Server on Google Compute Engine

I have a problems on my Macbook 15" Catalina to access Mongodb run in docker compute engine. If i use other laptop connection work well without error or with other os like ubuntu or windows that no problems. Cant connect just in my macbook 15" with os Catalina.
Error on mongo command :
▶mongo [PublicIP-VMInstance]:[PortMongo]/admin -u username -p password
MongoDB shell version v3.6.14
connecting to: mongodb://[PublicIP-VMInstance]:[PortMongo]/admin?gssapiServiceName=mongodb
2019-11-23T18:22:30.975+0700 I NETWORK [thread1] Socket recv() Connection reset by peer [PublicIP-VMInstance]:[PortMongo]
2019-11-23T18:22:30.975+0700 I NETWORK [thread1] SocketException: remote: (NONE):0 error: SocketException socket exception [RECV_ERROR] server [[PublicIP-VMInstance]:[PortMongo]]
2019-11-23T18:22:30.975+0700 E QUERY [thread1] Error: network error while attempting to run command 'isMaster' on host '[PublicIP-VMInstance]:[PortMongo]' :
connect#src/mongo/shell/mongo.js:263:13
#(connect):1:6
exception: connect failed
show error if i use --ssl flag :
▶mongo [PublicIP-VMInstance]:[PortMongo]/admin -u username -p password --ssl --verbose
MongoDB shell version v3.6.14
connecting to: mongodb://[PublicIP-VMInstance]:[PortMongo]/admin?gssapiServiceName=mongodb
2019-11-23T11:47:19.836+0700 D NETWORK [thread1] creating new connection to:[PublicIP-VMInstance]:[PortMongo]
2019-11-23T11:47:19.839+0700 I NETWORK [thread1] Socket recv() Connection reset by peer [PublicIP-VMInstance]:[PortMongo]
2019-11-23T11:47:19.839+0700 E QUERY [thread1] Error: socket exception [RECV_ERROR] for [PublicIP-VMInstance]:[PortMongo] :
connect#src/mongo/shell/mongo.js:263:13
#(connect):1:6
2019-11-23T11:47:19.839+0700 D - [thread1] User Assertion: 12513:connect failed src/mongo/shell/shell_utils.cpp 279
2019-11-23T11:47:19.839+0700 I QUERY [thread1] MozJS GC prologue heap stats - total: 3447601 limit: 0
2019-11-23T11:47:19.840+0700 I QUERY [thread1] MozJS GC epilogue heap stats - total: 1641 limit: 0
2019-11-23T11:47:19.840+0700 I QUERY [thread1] MozJS GC prologue heap stats - total: 3937 limit: 0
2019-11-23T11:47:19.841+0700 I QUERY [thread1] MozJS GC epilogue heap stats - total: 9 limit: 0
2019-11-23T11:47:19.841+0700 D - [main] User Assertion: 12513:connect failed src/mongo/scripting/mozjs/proxyscope.cpp 302
exception: connect failed
If use GUI Client like NoSQLBooster show error :
12:53:53.307 *** Starting MongoClient.connect ***
{"options":{"appname":"NoSQLBoosterV5.2.7_125336.468","autoReconnect":true,"keepAlive":60000,"poolSize":0,"promoteLongs":false,"promoteValues":false,"reconnectTries":172800,"socketTimeoutMS":0,"sslValidate":false,"useNewUrlParser":true},"uri":"mongodb://username:******#IPPublic-VMInstance:PORTMONGO?authSource=admin"}
12:53:53.311 *** Connect Error ***
{"errorLabels":["TransientTransactionError"],"message":"failed to connect to server [IPPublic-VMInstance:PORTMONGO] on first connect [MongoNetworkError: read ECONNRESET]","name":"MongoNetworkError","stack":"MongoNetworkError: failed to connect to server [IPPublic-VMInstance:PORTMONGO] on first connect [MongoNetworkError: read ECONNRESET]\n at Pool.<anonymous> (/Applications/NoSQLBooster for MongoDB.app/Contents/Resources/app.asar/node_modules/mongodb-core/lib/topologies/server.js:431:11)\n at Pool.emit (events.js:182:13)\n at connect (/Applications/NoSQLBooster for MongoDB.app/Contents/Resources/app.asar/node_modules/mongodb-core/lib/connection/pool.js:557:14)\n at callback (/Applications/NoSQLBooster for MongoDB.app/Contents/Resources/app.asar/node_modules/mongodb-core/lib/connection/connect.js:109:5)\n at runCommand (/Applications/NoSQLBooster for MongoDB.app/Contents/Resources/app.asar/node_modules/mongodb-core/lib/connection/connect.js:129:7)\n at Connection.errorHandler (/Applications/NoSQLBooster for MongoDB.app/Contents/Resources/app.asar/node_modules/mongodb-core/lib/connection/connect.js:321:5)\n at Object.onceWrapper (events.js:273:13)\n at Connection.emit (events.js:182:13)\n at Socket.<anonymous> (/Applications/NoSQLBooster for MongoDB.app/Contents/Resources/app.asar/node_modules/mongodb-core/lib/connection/connection.js:321:10)\n at Object.onceWrapper (events.js:273:13)\n at Socket.emit (events.js:182:13)\n at emitErrorNT (internal/streams/destroy.js:82:8)\n at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)\n at process._tickCallback (internal/process/next_tick.js:63:19)"}
I have try with this tutorial :
openssl problems
https://community.exploratory.io/t/mongodb-ssl-connection-error-on-mac-os-x/832 [ still not working ]
use --ssl but in other laptop work well without this options
Apple has made TLS requirements stricter in Catalina. I have a similar case where the connection from Catalina fails using the mongo cli client. I couldn't find statements about changes in behavior of SSL specifically (which I am using). They may have changed something they didn't communicate.
About Catalina TLS changes: https://support.apple.com/en-us/HT210176
If I run a VM Ubuntu on Catalina, I'm able to connect from there. Also macs with Mojave can connect just fine using the same certificates, keys, and network.
Below is the error I'm seeing. It's slightly different to yours but also something that only happens on Catalina.
mongo --host myhost.com --ssl --sslCAFile ca.pem --sslPEMKeyFile client.pem -u myuser -p
W CONTROL [main] Option: ssl is deprecated. Please use tls instead.
W CONTROL [main] Option: sslPEMKeyFile is deprecated. Please use tlsCertificateKeyFile instead.
W CONTROL [main] Option: sslCAFile is deprecated. Please use tlsCAFile instead.
MongoDB shell version v4.2.1
Enter password:
connecting to: mongodb://myhost.com:27017/?compressors=disabled&gssapiServiceName=mongodb
E NETWORK [js] SSL peer certificate validation failed: Certificate trust failure: Host name mismatch; connection rejected
E QUERY [js] Error: couldn't connect to server myhost.com:27017, connection attempt failed: SSLHandshakeFailed:
SSL peer certificate validation failed: Certificate trust failure: Host name mismatch; connection rejected :
connect#src/mongo/shell/mongo.js:341:17
#(connect):2:6
F - [main] exception: connect failed
E - [main] exiting with code 1
I suggest you try generating new certificates that match Apple's new requirements if that's at all possible. Another thing you could try would be to run a Linux VM on your Mac and see if the connection works from there. If it does, I reckon it would narrow the issue down to the certificates themselves.
Update: Docker seems to be an alternative for the VM. Using a Docker container on a Mac with Catalina I can connect to mongo just fine.
Are you certain that PublicIP-VMInstance and PortMongo are resolving to IP addresses and a port by your mongo client? I'm running MacOS X 10.15.1 (Catalina) and Mongo client 4.2.1 and connections work perfectly for me using a connection string like this:
/opt/local/bin/mongo --ssl --sslAllowInvalidCertificates --host=mongo.mydomain.com:27017 -u mongoMatt -p dont*You*Wish

Connection error while installing mongodb on Fedora 28

I have been trying to install Mongodb but it keeps failing midway. When the download is complete, installation fails with a connection error:
MongoDB shell version v3.6.3
connecting to: mongodb://127.0.0.1:27017
2018-08-17T12:26:33.340+0200 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2018-08-17T12:26:33.340+0200 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:251:13
#(connect):1:6
exception: connect failed
What I've tried:
1. Changing the port:
mongo --port 4332
but it doesn't connect still:
MongoDB shell version v3.6.3
connecting to: mongodb://127.0.0.1:4332/
2018-08-17T12:32:55.743+0200 W NETWORK [thread1] Failed to connect to 127.0.0.1:4332, in(checking socket for error after poll), reason: Connection refused
2018-08-17T12:32:55.743+0200 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:4332, connection attempt failed :
connect#src/mongo/shell/mongo.js:251:13
#(connect):1:6
exception: connect failed
Reinstalling the DB shows up as complete but I still can't start it. Check out the screenshot
Checking for any config files in /etc/mongo* or /var/lib/: there is none.
Note: There's no mongod service available too.
the installation seem to have worked, but the mongod was not started.
MongoDB need two element :
the "mongo" shell utility, who is used to connect to the database direcly
the "mongod" service, who is the true database programs.
to start the mongod, simply use a cmd and use the "mongod" command. this command may fail if :
the port is already used (default is 27017)
the dbpath directory was not created (default is /data/db)
Fedora repository do not install both at the same time.
the shell is in the repository under the "mongodb" name
the server is under the name "mongodb-server"
so to install both, you need to do
dnf install mongodb mongodb-server
and you can then start the mongod service with
sudo service mongod start
more information

mongodb installation error connection failed on windows

I have tried all solutions mentioned in below 2 links
Mongodb: Failed to connect to 127.0.0.1:27017, reason: errno:10061
How to start mongo db on windows
But still getting below error
`C:\Program Files (x86)\MongoDB\Server\3.2\bin>mongo MongoDB shell
version: 3.2.18-15-g678cb63 connecting to: test
2018-01-26T16:39:23.926+0530 W NETWORK [thread1] Failed to connect to
127.0.0.1 :27017 after 5000ms milliseconds, giving up. 2018-01-26T16:39:23.927+0530 E QUERY [thread1] Error: couldn't
connect to ser ver 127.0.0.1:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:229:14 #(connect):1:6
exception: connect failed`
Open onemore terminal as admin and run mongod. After this you can start your app in main terminal.