zenbot icon indicating copy to clipboard operation
zenbot copied to clipboard

MongoError: failed to connect to server

Open keshaipad opened this issue 10 years ago • 5 comments

Can't understand why:

MacBook-Pro:zenbot macbookpro$ ./reducer.sh

/Users/macbookpro/btc-bot/zenbot/node_modules/motley-mongo/node_modules/mongodb/lib/mongo_client.js:225
          throw err
          ^
MongoError: failed to connect to server [localhost:27017] on first connect
    at null.<anonymous> (/Users/macbookpro/btc-bot/zenbot/node_modules/motley-mongo/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:312:35)
    at emitOne (events.js:77:13)
    at emit (events.js:169:7)
    at null.<anonymous> (/Users/macbookpro/btc-bot/zenbot/node_modules/motley-mongo/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js:256:12)
    at g (events.js:260:16)
    at emitTwo (events.js:87:13)
    at emit (events.js:172:7)
    at Socket.<anonymous> (/Users/macbookpro/btc-bot/zenbot/node_modules/motley-mongo/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js:160:49)
    at Socket.g (events.js:260:16)
    at emitOne (events.js:77:13)

I was try to reinstall all, but again same error.

keshaipad avatar Aug 23 '16 15:08 keshaipad

it seems you don't have mongodb running.. what do you get if you type mongo in the terminal?

grigio avatar Aug 23 '16 15:08 grigio

If mongo is on a different host (or in the case of docker, a different container) you may need to edit the config.js to specify the correct connection string.

BarnumD avatar Aug 23 '16 15:08 BarnumD

if you are using docker replace this line c.mongo_url = "mongodb://localhost:27017/zenbrain" with c.mongo_url = "mongodb://" + process.env.MONGODB_PORT_27017_TCP_ADDR + ":27017/zenbrain"

egorbenko avatar Aug 24 '16 20:08 egorbenko

getting the same error... running this fine in a docker container but want to run it without Docker.

what is the solution?

dwightmulcahy avatar May 08 '17 17:05 dwightmulcahy

@grigio @dwightmulcahy

Use mongod to start MongoDB.

Reference: https://docs.mongodb.com/manual/reference/program/mongod/

JoeyBurzynski avatar May 08 '17 17:05 JoeyBurzynski