Reputation: 159
I have written web services in Sails JS. The sails js app was running correctly, but suddenly it stoped working. I am not getting what is the issue. When I am trying to restart the server using node app.js
command.
It's giving me following error:
Error: failed to connect to [127.0.0.1:27017] at [object Object]. (/root/tresscove-server/node_modules/connect-mongo/node_modules/mongodb/lib/mongodb/connection/server.js:549:74) at [object Object].emit (events.js:106:17) at [object Object]. (/root/tresscove-server/node_modules/connect-mongo/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:150:15) at [object Object].emit (events.js:98:17) at Socket. (/root/tresscove-server/node_modules/connect-mongo/node_modules/mongodb/lib/mongodb/connection/connection.js:534:10) at Socket.emit (events.js:95:17) at net.js:440:14 at process._tickDomainCallback (node.js:463:13)
It is giving me the connection issue. But my database is on the different server and my config/connections.js
contains following code:
mongoDbServer: {
adapter: 'sails-mongo',
host: process.env.MONGO_HOST,
//host: 'localhost',
port: 27017,
// user: 'username',
// password: 'password',
database: 'tresscove'
}
The developer before me have set the environment variable MONGO_HOST
. I don't know what was the value of that variable. How to set its value? How to solve this issue? The whole app has stoped working. Please help.
Upvotes: 0
Views: 824
Reputation:
Give the IP address of the remote database
Eg: host:"192.168.2.5"
Tnx
Upvotes: 0