How to check if Mongodb is properly installed

后端 未结 2 1216
暖寄归人
暖寄归人 2021-02-20 12:48

I installed MongoDb yesterday on a Mac Snow Leopard and got the following error message

Mongo::ConnectionFailure: Failed to connect to a master node at localhost         


        
2条回答
  •  不要未来只要你来
    2021-02-20 13:13

    It's not running mongod. You need to start it, probably with a script so you can control how it starts. The script I use on my mac looks like: mongod -f /etc/mongodb.conf &.

    At this point I can't remember if the install came with /etc/mongodb.conf, or if I put it there myself. It's fairly simple. I store my data/log in my user folder (this is obviously a development environment):

    dbpath = /Users/me/data/
    logpath = /Users/me/mongo.log
    
    # Only accept local connections
    bind_ip = 127.0.0.1
    

    You'll also need to create your data folder, if it doesn't exist.

提交回复
热议问题