My goal is to connect NodeBB to MongoDB only with unix socket.
Found here that is possible to use unix socket with mongodb, also this link was helpfull but can't figure out how to solve this error.
Why "error: failed to connect to server [%2Ftmp%2Fmongodb-1033.sock:27017]" there is default 27017 port, whats missing in this config?
{
"url": "http://www.example.net/forum",
"secret": "secret",
"database": "mongo",
"port": [
"/home/forum/webapps/nodebb.sock"
],
"mongo": {
"uri": "mongodb://user:pass@%2Ftmp%2Fmongodb-1033.sock/db_name",
}
}
2019-05-24T20:31:32.180Z [/home/forum/webapps//nodebb.sock/10753] - error: uncaughtException: failed to connect to server [%2Ftmp%2Fmongodb-1033.sock:27017] on first connect [Error: getaddrinfo ENOTFOUND %2Ftmp%2Fmongodb-1033.sock
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26) {
name: 'MongoError',
message: 'getaddrinfo ENOTFOUND %2Ftmp%2Fmongodb-1033.sock'
}]
MongoError: failed to connect to server [%2Ftmp%2Fmongodb-1033.sock:27017] on first connect [Error: getaddrinfo ENOTFOUND %2Ftmp%2Fmongodb-1033.sock
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26) {
name: 'MongoError',
message: 'getaddrinfo ENOTFOUND %2Ftmp%2Fmongodb-1033.sock'
}]
at Pool.<anonymous> (/home/forum/webapps/nodebb/node_modules/mongodb-core/lib/topologies/server.js:336:35)
at Pool.emit (events.js:196:13)
at Connection.<anonymous> (/home/forum/webapps/nodebb/node_modules/mongodb-core/lib/connection/pool.js:280:12)
at Object.onceWrapper (events.js:284:20)
at Connection.emit (events.js:196:13)
at Socket.<anonymous> (/home/forum/webapps/nodebb/node_modules/mongodb-core/lib/connection/connection.js:189:49)
at Object.onceWrapper (events.js:284:20)
at Socket.emit (events.js:196:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3) {"error":{"name":"MongoError","message":"failed to connect to server [%2Ftmp%2Fmongodb-1033.sock:27017] on first connect [Error: getaddrinfo ENOTFOUND %2Ftmp%2Fmongodb-1033.sock\n at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26) {\n name: 'MongoError',\n message: 'getaddrinfo ENOTFOUND %2Ftmp%2Fmongodb-1033.sock'\n}]"},"stack":"MongoError: failed to connect to server [%2Ftmp%2Fmongodb-1033.sock:27017] on first connect [Error: getaddrinfo ENOTFOUND %2Ftmp%2Fmongodb-1033.sock\n at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26) {\n name: 'MongoError',\n message: 'getaddrinfo ENOTFOUND %2Ftmp%2Fmongodb-1033.sock'\n}]\n at Pool.<anonymous> (/home/forum/webapps/nodebb/node_modules/mongodb-core/lib/topologies/server.js:336:35)\n at Pool.emit (events.js:196:13)\n at Connection.<anonymous> (/home/forum/webapps/nodebb/node_modules/mongodb-core/lib/connection/pool.js:280:12)\n at Object.onceWrapper (events.js:284:20)\n at Connection.emit (events.js:196:13)\n at Socket.<anonymous> (/home/forum/webapps/nodebb/node_modules/mongodb-core/lib/connection/connection.js:189:49)\n at Object.onceWrapper (events.js:284:20)\n at Socket.emit (events.js:196:13)\n at emitErrorNT (internal/streams/destroy.js:91:8)\n at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)","exception":true,"date":"Fri May 24 2019 22:31:32 GMT+0200 (Central European Summer Time)","process":{"pid":10753,"uid":1003,"gid":100,"cwd":"/home/forum/webapps/nodebb","execPath":"/usr/local/bin/node","version":"v12.1.0","argv":["/usr/local/bin/node","/home/forum/webapps/nodebb/app.js"],"memoryUsage":{"rss":145326080,"heapTotal":101863424,"heapUsed":67882440,"external":37486265}},"os":{"loadavg":[0.060546875,0.142578125,0.166015625],"uptime":33249},"trace":[{"column":26,"file":"dns.js","function":"GetAddrInfoReqWrap.onlookup [as oncomplete]","line":60,"method":"onlookup [as oncomplete]","native":false},{"column":35,"file":"/home/forum/webapps/nodebb/node_modules/mongodb-core/lib/topologies/server.js","function":null,"line":336,"method":null,"native":false},{"column":13,"file":"events.js","function":"Pool.emit","line":196,"method":"emit","native":false},{"column":12,"file":"/home/forum/webapps/nodebb/node_modules/mongodb-core/lib/connection/pool.js","function":null,"line":280,"method":null,"native":false},{"column":20,"file":"events.js","function":"Object.onceWrapper","line":284,"method":"onceWrapper","native":false},{"column":13,"file":"events.js","function":"Connection.emit","line":196,"method":"emit","native":false},{"column":49,"file":"/home/forum/webapps/nodebb/node_modules/mongodb-core/lib/connection/connection.js","function":null,"line":189,"method":null,"native":false},{"column":20,"file":"events.js","function":"Object.onceWrapper","line":284,"method":"onceWrapper","native":false},{"column":13,"file":"events.js","function":"Socket.emit","line":196,"method":"emit","native":false},{"column":8,"file":"internal/streams/destroy.js","function":"emitErrorNT","line":91,"method":null,"native":false},{"column":3,"file":"internal/streams/destroy.js","function":"emitErrorAndCloseNT","line":59,"method":null,"native":false}]}
2019-05-24T20:31:32.180Z [/home/forum/webapps//nodebb.sock/10753] - error: failed to connect to server [%2Ftmp%2Fmongodb-1033.sock:27017] on first connect [Error: getaddrinfo ENOTFOUND %2Ftmp%2Fmongodb-1033.sock
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26) {
name: 'MongoError',
message: 'getaddrinfo ENOTFOUND %2Ftmp%2Fmongodb-1033.sock'
}] {"name":"MongoError"}
2019-05-24T20:31:32.181Z [/home/forum/webapps//nodebb.sock/10753] - info: [app] Shutdown (SIGTERM/SIGINT) Initialised.
2019-05-24T20:31:32.182Z [/home/forum/webapps//nodebb.sock/10753] - error: Server is not running.