mongorestore失败:没有可访问的服务器 [英] mongorestore Failed: no reachable servers

查看:203
本文介绍了mongorestore失败:没有可访问的服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从转储中还原mongo,但失败了:

I tried to restore mongo from dump but failed:

mongorestore --port 27133 dump
2015-05-07T09:39:11.760+0300    Failed: no reachable servers

尽管我可以毫无问题地连接到它:

Although I can connect to it without any problem:

$ mongo --port 27133
MongoDB shell version: 3.0.1
connecting to: 127.0.0.1:27133/test

在日志文件中没有什么特别的:

In a log file there is nothing special:

2015-05-07T09:37:00.350+0300 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:44901 #1 (1 connection now open)
2015-05-07T09:37:13.935+0300 I NETWORK  [conn1] end connection 127.0.0.1:44901 (0 connections now open)
2015-05-07T09:39:08.752+0300 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:44906 #2 (1 connection now open)
2015-05-07T09:39:11.763+0300 I NETWORK  [conn2] end connection 127.0.0.1:44906 (0 connections now open)
2015-05-07T09:39:52.365+0300 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:44907 #3 (1 connection now open)
2015-05-07T09:39:55.064+0300 I NETWORK  [conn3] end connection 127.0.0.1:44907 (0 connections now open)
2015-05-07T09:40:11.272+0300 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:44909 #4 (1 connection now open)
2015-05-07T09:40:14.281+0300 I NETWORK  [conn4] end connection 127.0.0.1:44909 (0 connections now open)

更新

主机127.0.0.1没有帮助

$ mongorestore --host=127.0.0.1 --port=27132 dump
2015-12-16T18:52:33.270+0300    Failed: no reachable servers

尽管我仍然可以使用mongo命令进行连接:

Although I can still connect using mongo command:

$ mongo --host=127.0.0.1 --port=27133
MongoDB shell version: 3.2.0
connecting to: 127.0.0.1:27133/test
> ^C
bye

主机0.0.0.0也没有帮助:

$ mongorestore --host=0.0.0.0 --port=27133 dump

我有3.2版本的MongoDb:

I have 3.2 version of MongoDb:

$ mongorestore --version
mongorestore version: 3.2.0-rc5
git version: 6186100ad0500c122a56f0a0e28ce1227ca4fc88

推荐答案

发生此问题是因为在配置中启用了--replSet.但是该节点尚未在任何副本集中.

The problem occured because --replSet was enabled in configuration. But the node wasn't yet in any replica set.

从配置中删除--replSet,重新启动mongodb服务器后,mongorestore开始工作,没有任何--host参数.

After I removed --replSet from configuration, relaunched mongodb server, mongorestore started to work without any --host parameter.

这篇关于mongorestore失败:没有可访问的服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆