mongo 3.6.2无法在Windows 7/10中启动

时间:2018-01-26 19:06:31

标签: windows mongodb

我正在尝试在我的Windows机器上安装mongodb。

执行" mongo"命令,我收到以下错误:

C:\Users\Mohamed>mongo
MongoDB shell version v3.6.2
connecting to: mongodb://127.0.0.1:27017
2018-01-26T18:51:11.568+0100 W NETWORK  [thread1] Failed to connect to 127.0.0.1
:27017 after 5000ms milliseconds, giving up.
2018-01-26T18:51:11.568+0100 E QUERY    [thread1] Error: couldn't connect to ser
ver 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:251:13
@(connect):1:6
exception: connect failed

执行" mongod"命令,我得到以下输出:

C:\Users\Mohamed>mongod

我删除了一些输出以绕过强制限制

create,cache_size=2510M,session_max=20000,eviction=(threads_min=4,threads_max=4)
,config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal
,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0
),verbose=(recovery_progress),
2018-01-26T18:54:10.321+0100 I CONTROL  [initandlisten]
2018-01-26T18:54:10.322+0100 I CONTROL  [initandlisten] ** WARNING: Access contr
ol is not enabled for the database.
2018-01-26T18:54:10.323+0100 I CONTROL  [initandlisten] **          Read and wri
te access to data and configuration is unrestricted.
2018-01-26T18:54:10.325+0100 I CONTROL  [initandlisten]
2018-01-26T18:54:10.325+0100 I CONTROL  [initandlisten] ** WARNING: This server
is bound to localhost.
2018-01-26T18:54:10.326+0100 I CONTROL  [initandlisten] **          Remote syste
ms will be unable to connect to this server.
2018-01-26T18:54:10.328+0100 I CONTROL  [initandlisten] **          Start the se
rver with --bind_ip <address> to specify which IP
2018-01-26T18:54:10.329+0100 I CONTROL  [initandlisten] **          addresses it
 should serve responses from, or with --bind_ip_all to
2018-01-26T18:54:10.330+0100 I CONTROL  [initandlisten] **          bind to all
interfaces. If this behavior is desired, start the
2018-01-26T18:54:10.330+0100 I CONTROL  [initandlisten] **          server with
--bind_ip 127.0.0.1 to disable this warning.
2018-01-26T18:54:10.331+0100 I CONTROL  [initandlisten]
2018-01-26T18:54:10.331+0100 I CONTROL  [initandlisten] Hotfix KB2731284 or late
r update is not installed, will zero-out data files.
2018-01-26T18:54:10.332+0100 I CONTROL  [initandlisten]
2018-01-26T18:54:10.333+0100 I CONTROL  [initandlisten] ** WARNING: The file sys
tem cache of this machine is configured to be greater than 40% of the total memo
ry. This can lead to increased memory pressure and poor performance.
2018-01-26T18:54:10.334+0100 I CONTROL  [initandlisten] See http://dochub.mongod
b.org/core/wt-windows-system-file-cache
2018-01-26T18:54:10.335+0100 I CONTROL  [initandlisten]
2018-01-26T18:54:10.338+0100 I STORAGE  [initandlisten] createCollection: admin.
system.version with provided UUID: 70e33b89-7e69-4b86-8309-ff9b06207e41
2018-01-26T18:54:10.520+0100 I COMMAND  [initandlisten] setting featureCompatibi
lityVersion to 3.6
2018-01-26T18:54:10.531+0100 I STORAGE  [initandlisten] createCollection: local.
startup_log with generated UUID: 6728ada5-b42d-443c-823a-1a8ead4eebc2
2018-01-26T18:54:11.584+0100 W FTDC     [initandlisten] Failed to initialize Per
formance Counters for FTDC: WindowsPdhError: PdhExpandCounterPathW failed with '
L'objet spécifié n'a pas été trouvé sur l'ordinateur.' for counter '\Memory\Avai
lable Bytes'
2018-01-26T18:54:11.585+0100 I FTDC     [initandlisten] Initializing full-time d
iagnostic data capture with directory 'C:/data/db/diagnostic.data'
2018-01-26T18:54:11.590+0100 I NETWORK  [initandlisten] waiting for connections
on port 27017

你能协助我解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

仅运行 mongod 后,您可以运行 mongo 。否则,它会抛出上述错误。

这就是我所做的:

  • 使用终端
  • 运行 mongod
  • 在新窗口/标签页中运行 - mongo

在您的情况下,您已完成上述两个步骤。只需在新的终端窗口/标签中尝试运行 mongo

希望它有所帮助。随意纠正我的答案:)