这是我做的:
在Windows 2016服务器上启动mongod "C:\Program Files\MongoDB\Server\3.4\bin\mongod.exe" --dbpath data --auth --port 37017 --bind_ip 0.0.0.0 。
在客户端: mongo mongodb://user:[email protected]:37017/ar --verbose
我得到这个错误:
MongoDB shell version v3.4.9 connecting to: mongodb://user:[email protected]:37017/ar 2017-10-23T11:22:05.420+0200 D NETWORK [thread1] creating new connection to:xyz.com:37017 2017-10-23T11:22:05.460+0200 D NETWORK [thread1] connected to server xyz.com:37017 (152.151.129.37) 2017-10-23T11:22:05.474+0200 I NETWORK [thread1] Socket recv() Connection reset by peer 152.151.129.37:37017 2017-10-23T11:22:05.474+0200 I NETWORK [thread1] SocketException: remote: (NONE):0 error: 9001 socket exception [RECV_ERROR] server [152.151.129.37:37017] 2017-10-23T11:22:05.474+0200 D - [thread1] User Assertion: 6:network error while attempting to run command 'isMaster' on host 'xyz.com:37017' src/mongo/client/dbclient.cpp 213 2017-10-23T11:22:05.475+0200 D - [thread1] User Assertion: 1:network error while attempting to run command 'isMaster' on host 'xyz.com:37017' src/mongo/scripting/mozjs/mongo.cpp 716 2017-10-23T11:22:05.475+0200 E QUERY [thread1] Error: network error while attempting to run command 'isMaster' on host 'xyz.com:37017' : connect@src/mongo/shell/mongo.js:237:13 @(connect):1:6 2017-10-23T11:22:05.475+0200 D - [thread1] User Assertion: 12513:connect failed src/mongo/shell/shell_utils.cpp 256 2017-10-23T11:22:05.475+0200 I QUERY [thread1] MozJS GC prologue heap stats - total: 3502915 limit: 0 2017-10-23T11:22:05.477+0200 I QUERY [thread1] MozJS GC epilogue heap stats - total: 349115 limit: 0 2017-10-23T11:22:05.477+0200 I QUERY [thread1] MozJS GC prologue heap stats - total: 240819 limit: 0 2017-10-23T11:22:05.478+0200 I QUERY [thread1] MozJS GC epilogue heap stats - total: 49451 limit: 0 2017-10-23T11:22:05.478+0200 D - [main] User Assertion: 12513:connect failed src/mongo/scripting/mozjs/proxyscope.cpp 299 exception: connect failed
请注意,mongo表示connected to server ,然后connection reset by peer... 。 任何想法为什么发生这种情况
我很确定端口37017是在这个服务器上打开的,因为我可以在这个端口上启动一个https web服务器,并在浏览器(PC客户端)上正确显示页面。
我已经调整了局域网IP, 127.0.0.1的--bind_ip选项,或者没有指定它,但是这并没有改变任何东西。