samongod或brew服务启动mongodb-community@4.0来启动mongoDB服务器吗?

时间:2019-05-14 07:40:41

标签: mongodb homebrew

我是mongodb的新手。我正在使用the installation guide安装MongoDB 4.0 community edition。安装后,我使用brew services start mongodb-community@4.0运行MongoDB。为了彻底关闭服务器,我启动了mongo shell,并运行了use admindb.shutdown.Server()

接下来,要重新启动服务器,我运行了brew services start mongodb-community@4.0并获得了

`Service `mongodb-community` already started, use `brew services restart mongodb-community` to restart.` 

所以我做了brew services restart mongodb-community@4.0,并在下面得到了返回的消息:

Stopping `mongodb-community`... (might take a while)
==> Successfully stopped `mongodb-community` (label: homebrew.mxcl.mongodb-community)
==> Successfully started `mongodb-community` (label: homebrew.mxcl.mongodb-community)

我的问题: (1)运行brew services start mongodb-community@4.0是否与运行mongod相同? (2)当我再次启动服务器时,为什么说Service mongodb-community already started?我没有彻底关闭服务器吗?

1 个答案:

答案 0 :(得分:0)

我认为您有2个选择。可以将其作为应用程序之类的服务运行(您的第一个选择)。或从命令行运行它(第二个选项)。因此,根据您的需求,您可以选择其中一个。

请参阅文档。如果您使用过:brew install mongodb-community@4.0

日志和数据库文件夹已经创建。

相关问题