mongodb 即使在重新安装后,Mongo 仍在等待 27017

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29403638/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 20:22:27  来源:igfitidea点击:

Mongo waiting on 27017 even after reinstall

mongodbwindows-8

提问by jason m

I have uninstalled and reinstalled mongo (3.0.1), being sure i accepted the network access on windows 8, and yet i still have the same issue of "waiting on 27017".

我已经卸载并重新安装了 mongo (3.0.1),确保我接受了 Windows 8 上的网络访问,但我仍然遇到“等待 27017”的相同问题。

The commands i sent are the following:

我发送的命令如下:

PS C:\Program Files\MongoDB\Server.0\bin> .\mongod.exe --dbpath  C:\mongodb\data
2015-04-01T21:33:46.787-0400 I JOURNAL  [initandlisten] journal dir=C:\mongodb\data\journal
2015-04-01T21:33:46.790-0400 I JOURNAL  [initandlisten] recover : no journal files present, no recovery needed
2015-04-01T21:33:46.972-0400 I JOURNAL  [durability] Durability thread started
2015-04-01T21:33:46.973-0400 I JOURNAL  [journal writer] Journal writer thread started
2015-04-01T21:33:47.134-0400 I CONTROL  [initandlisten] MongoDB starting : pid=7436 port=27017 dbpath=C:\mongodb\data 64
-bit host=CookieMunster
2015-04-01T21:33:47.135-0400 I CONTROL  [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2015-04-01T21:33:47.135-0400 I CONTROL  [initandlisten] db version v3.0.1
2015-04-01T21:33:47.136-0400 I CONTROL  [initandlisten] git version: 534b5a3f9d10f00cd27737fbcd951032248b5952
2015-04-01T21:33:47.137-0400 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1j-fips 15 Oct 2014
2015-04-01T21:33:47.137-0400 I CONTROL  [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=1, buil
d=7601, platform=2, service_pack='Service Pack 1') BOOST_LIB_VERSION=1_49
2015-04-01T21:33:47.139-0400 I CONTROL  [initandlisten] allocator: system
2015-04-01T21:33:47.141-0400 I CONTROL  [initandlisten] options: { storage: { dbPath: "C:\mongodb\data" } }
2015-04-01T21:33:47.148-0400 I INDEX    [initandlisten] allocating new ns file C:\mongodb\data\local.ns, filling with ze
roes...
2015-04-01T21:33:47.587-0400 I STORAGE  [FileAllocator] allocating new datafile C:\mongodb\data\local.0, filling with ze
roes...
2015-04-01T21:33:47.589-0400 I STORAGE  [FileAllocator] creating directory C:\mongodb\data\_tmp
2015-04-01T21:33:47.721-0400 I STORAGE  [FileAllocator] done allocating datafile C:\mongodb\data\local.0, size: 64MB,  t
ook 0.007 secs
2015-04-01T21:33:47.747-0400 I NETWORK  [initandlisten] waiting for connections on port 27017

This is pending and will continue to do see endlessly.

这是悬而未决的,并将继续无休止地看到。

Hitting my head against a wall and any help is wonderful.

把我的头撞在墙上,任何帮助都很棒。

Thanks

谢谢

回答by Waqas

The waiting for connections message in the console output indicates that the mongod.exe process is running successfully.

控制台输出中的等待连接消息表明 mongod.exe 进程运行成功。

http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/?_ga=1.82566930.525730850.1428016333

http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/?_ga=1.82566930.525730850.1428016333

Next you need to connect to MongoDB through mongo.exe shell using another command promt.

接下来,您需要使用另一个命令提示符通过 mongo.exe shell 连接到 MongoDB。

As soon as you are done with that, the waiting message in first console would change to connection accepted.

完成后,第一个控制台中的等待消息将更改为已接受连接。

Hope that helps :)

希望有帮助:)

回答by Sid

For Mac users, if you have same issue then go open a new terminal window apart from the one already open and waiting for connection, go to /usr/local/binand type ./mongo

对于 Mac 用户,如果您有同样的问题,那么除了已经打开并等待连接的终端窗口之外,再打开一个新的终端窗口,转到/usr/local/bin并输入./mongo

回答by user2386411

Later, to stop MongoDB, press Ctrl+ Cin the terminal where the mongodinstance is running.

稍后,要停止 MongoDB,请在运行实例的终端中按Ctrl+ 。Cmongod

回答by Andy Lai

I have a similar problem.

我有一个类似的问题。

In my case when I ran MongoDb on docker with the following command and expected entering mongo shell to do some query but I got meesage 'waiting for connections on port 27017' and couldn't do anything.

在我的情况下,当我使用以下命令在 docker 上运行 MongoDb 并希望进入 mongo shell 进行一些查询时,我得到消息“正在等待端口 27017 上的连接”并且无法执行任何操作。

docker run -p 27017:27017 --name mongo-container mongo 

It seems that I was supposed to launch MongoDb on the background with -d option first and then use docker exec to enter the shell

看来我应该先用 -d 选项在后台启动 MongoDb,然后使用 docker exec 进入 shell

docker run -p 27017:27017 --name mongo-container mongo -d
docker exec -it mongo-container mongo admin

回答by monirakandha

If You are windows go to your root folder C:\Program Files\mongodb\Server\4.0\bin...open cmd as a Administration open cmd then type mongo start your mongodb server.

如果您是 Windows,请转到您的根文件夹 C:\Program Files\mongodb\Server\4.0\bin...打开 cmd 作为管理打开 cmd 然后键入 mongo 启动您的 mongodb 服务器。

回答by Puneeth Reddy

  1. open the control panelsearch for MongoDBfile
  2. Right click on it and select repairoption

  3. and click okfor all the options that show

  1. 打开控制面板搜索MongoDB文件
  2. 右键单击它并选择修复选项

  3. 并为显示的所有选项单击确定

回答by Sandeep K

It seems your mondodb local server is running. You need to install tool like robo 3T and connect to localhost://27017 to connect to local mongodb.

看来您的 mondodb 本地服务器正在运行。您需要安装robo 3T之类的工具并连接到localhost://27017才能连接到本地mongodb。

回答by Devender

It is clearly mentioned in above message that mongoDB is starting.

在上面的消息中明确提到 mongoDB 正在启动。

 2015-04-01T21:33:47.134-0400 I CONTROL  [initandlisten] MongoDB starting : pid=7436 port=27017 dbpath=C:\mongodb\data 64
    -bit host=CookieMunster

If you want to connect to the mongoDB shell, open a new cmd window and write command:

如果要连接到 mongoDB shell,请打开一个新的 cmd 窗口并写入命令:

mongo.exe

回答by Manoj K

You Keep your first screen(which you are facing issue) open as it is. Now open one more screen and go inside mongodbfolder. now execute ./bin/mongod.and you can its connectedas below .

您保持第一个屏幕(您面临的问题)保持打开状态。现在再打开一个屏幕并进入mongodb文件夹。现在执行./bin/mongod.,你可以连接如下。

2016-11-04T13:44:02.414+0800 I NETWORK  [initandlisten] waiting for connections on port 27017
2016-11-04T13:50:26.990+0800 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:51541 #1 (1 connection now open)