search

Home  >  Q&A  >  body text

mongodb: no reachable servers

OS X 环境下用 brew 安装 mongodb 之后
按照官方文档上的教程 import 一个 json 文件
输入:

mongoimport --db test --collection restaurants --drop --file primer-dataset.json

过程中 出现报错

Failed: error connnecting to db server: no reachable servers

求解决方案

已经尝试过的解决方案:
1.mongoimport --host=127.0.0.1 --port=27017 --db test --collection restaurants --drop --file primer-dataset.json
2.brew update && brew upgrade


补充:
1.启动mongodb之后导入文件,报错:

Failed: error processing document #9870: unexpected EOF

滿天的星座滿天的星座2809 days ago861

reply all(2)I'll reply

  • 某草草

    某草草2017-05-02 09:20:05

    It looks like the data file is damaged, open it with vi and take a look at the data file to be imported.

    Are you sure your mongodb is started?

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-02 09:20:05

    What version of MongoDB is it? This problem will not occur after 3.0.7. Also, is --replSet enabled but not in node? Finally, I checked it for you. Someone had a similar problem and solved it through mongorestore dump --host=127.0.0.1.

    reply
    0
  • Cancelreply