Mongo:尝试在主机上运行命令"whatsmyuri"时出现网络错误 [英] Mongo: network error while attempting to run command 'whatsmyuri' on host
问题描述
我一直试图从另一台机器访问我的mongo实例,但是出现此错误.我找不到许多对此whatsmyuri
错误的引用.这是我从外部计算机上得到的:
I have been trying to access my mongo instance from another machine, but I get this error. I could not find many references to this whatsmyuri
error. This is what I get from the external machine:
$ mongo <IP_ADDRESS>:27017/youtube_advertising -u user -p password
MongoDB shell version: 3.2.0
connecting to: <IP_ADDRESS>:27017/youtube_advertising
2016-02-19T17:10:02.923+0100 E QUERY [thread1] Error: network error while attempting to run command 'whatsmyuri' on host '<IP_ADDRESS>:27017' :
connect@src/mongo/shell/mongo.js:226:14
@(connect):1:6
exception: connect failed
我已经更改了/etc/mongod.conf
文件,通过端口27017
(使用iptables
)打开了连接,并重新启动了mongo.我可以通过ssh
连接到该计算机.
I have already changed the /etc/mongod.conf
file, opened connections through port 27017
(with iptables
) and restarted mongo. I am able to connect via ssh
to that machine.
搜索此whatsmyuri
,我在mongo上运行了此命令:
Searching about this whatsmyuri
, I ran this command on mongo:
> db.runCommand( { whatsmyuri: 1 } )
{ "you" : "127.0.0.1:36990", "ok" : 1 }
我不知道该36990
端口是对还是错.万一我也从那里打开了连接,但还是没有.
I do not know if that 36990
port is right or wrong. Just in case I opened connections from there too, but still nothing.
有什么想法吗?
检查/var/log/mongodb/mongod.log
,这是我尝试从远程连接时得到的:
Checking the /var/log/mongodb/mongod.log
, this is what I get when I try to connect from remote:
2016-02-19T10:41:07.292-0600 I NETWORK [initandlisten] connection accepted from <EXT_IP_ADDRESS>:51800 #2 (1 connection now open)
2016-02-19T10:41:07.310-0600 I QUERY [conn2] operation isn't supported: 2010
2016-02-19T10:41:07.310-0600 I - [conn2] Assertion: 16141:cannot translate opcode 2010
推荐答案
检查您的版本.这可能会有所帮助.
Check your versions. That may help.
我遇到了同样的问题.在我的情况下,服务器版本为3.2.0-rc2,而mongo shell版本为3.2.1.
I was having the same problem. In my case, the server was version 3.2.0-rc2, while mongo shell version was 3.2.1.
将服务器升级到3.2.1可以解决此问题.
Upgrading the server to 3.2.1 fixed the problem.
这篇关于Mongo:尝试在主机上运行命令"whatsmyuri"时出现网络错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!