错误:执行查询时出错:失败:尝试运行命令“ buildinfo”时出现网络错误

时间:2019-04-10 02:00:49

标签: windows mongodb mongoid

我在Windows和两个ubuntu服务器上都安装了最新版本的mongodb 4.0.8。如果尝试从Windows连接到ubuntu,则会出现以下错误。

C:\Users\Liu.D.H>mongo 113.55.14.114
MongoDB shell version v4.0.8
connecting to: mongodb://113.55.14.114:27017/test?gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("b84061bf-e308-47f7-b59f-6c2940ba450d") }
2019-04-10T08:55:12.522+0800 E QUERY    [js] Error: error doing query: failed: network error while attempting to run command 'buildinfo' on host '113.55.14.114:27017'  :
DB.prototype.runCommand@src/mongo/shell/db.js:168:1
DB.prototype.adminCommand@src/mongo/shell/db.js:186:16
DB.prototype.serverBuildInfo@src/mongo/shell/db.js:1275:16
DB.prototype.version@src/mongo/shell/db.js:1327:16
connect@src/mongo/shell/mongo.js:363:29
@(connect):2:6
2019-04-10T08:55:12.526+0800 I NETWORK  [js] trying reconnect to 113.55.14.114:27017 failed
2019-04-10T08:55:12.529+0800 I NETWORK  [js] reconnect 113.55.14.114:27017 ok
exception: connect failed

C:\Users\Liu.D.H>

我试图检查服务器上的日志。 journalctl -u mongod没有显示任何错误。 sudo tail -f /var/log/mongodb/mongod.log显示了以下相关错误。

2019-04-09T20:55:09.170-0400 I NETWORK  [listener] connection accepted from 113.55.127.140:3455 #3014 (1 connection now open)
2019-04-09T20:55:09.171-0400 I NETWORK  [conn3014] received client metadata from 113.55.127.140:3455 conn3014: { application: { name: "MongoDB Shell" }, driver: { name: "MongoDB Internal Client", version: "4.0.8" }, os: { type: "Windows", name: "Microsoft Windows 10", architecture: "x86_64", version: "10.0 (build 17763)" } }
2019-04-09T20:55:09.176-0400 I NETWORK  [conn3014] end connection 113.55.127.140:3455 (0 connections now open)
2019-04-09T20:55:09.182-0400 I NETWORK  [listener] connection accepted from 113.55.127.140:3456 #3015 (1 connection now open)
2019-04-09T20:55:09.182-0400 I NETWORK  [conn3015] received client metadata from 113.55.127.140:3456 conn3015: { application: { name: "MongoDB Shell" }, driver: { name: "MongoDB Internal Client", version: "4.0.8" }, os: { type: "Windows", name: "Microsoft Windows 10", architecture: "x86_64", version: "10.0 (build 17763)" } }
2019-04-09T20:55:09.184-0400 I NETWORK  [conn3015] end connection 113.55.127.140:3456 (0 connections now open)

服务器的配置文件如下。

# mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# Where and how to store data.
storage:
  dbPath: /var/lib/mongodb
  journal:
    enabled: true
#  engine:
#  mmapv1:
#  wiredTiger:

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

# network interfaces
net:
  port: 27017
  bindIp: 0.0.0.0


# how the process runs
processManagement:
  timeZoneInfo: /usr/share/zoneinfo

security:
  authorization: enabled

#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options:

#auditLog:

#snmp:

我可以确认是否尝试

  • 从Windows连接到Windows服务器本身
  • 连接两个Ubuntu
  • 从ubuntu连接到Windows

它按预期工作。

0 个答案:

没有答案