Mongo: network error while attempting to run command 'whatsmyuri' on host

匿名 (未验证) 提交于 2019-12-03 08:48:34

问题:

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 

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.

Searching about this whatsmyuri, I ran this command on mongo:

> db.runCommand( { whatsmyuri: 1 } ) { "you" : "127.0.0.1:36990", "ok" : 1 } 

I do not know if that 36990 port is right or wrong. Just in case I opened connections from there too, but still nothing.

Any ideas?

UPDATE

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 

回答1:

Check your versions. That may help.

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.

Upgrading the server to 3.2.1 fixed the problem.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!