折腾:
【已解决】Mac中导入恢复MongoDB数据到本地Mongo
期间,在Mac中,想要查看当前MongoDB是否正在运行。
systemctl status mongod
结果:
systemctl status mongod zsh: command not found: systemctl
Mac中没有systemctl
参考
去试试:
brew services status mongodb-community
结果也不对:
brew services status mongodb-community Usage: brew services [subcommand] Manage background services with macOS' launchctl(1) daemon manager. If sudo is passed, operate on /Library/LaunchDaemons (started at boot). Otherwise, operate on ~/Library/LaunchAgents (started at login). [sudo] brew services [list]: List all managed services for the current user (or root). [sudo] brew services run (formula|--all): Run the service formula without registering to launch at login (or boot). [sudo] brew services start (formula|--all): Start the service formula immediately and register it to launch at login (or boot). [sudo] brew services stop (formula|--all): Stop the service formula immediately and unregister it from launching at login (or boot). [sudo] brew services restart (formula|--all): Stop (if necessary) and start the service formula immediately and register it to launch at login (or boot). [sudo] brew services cleanup: Remove all unused services. --all Run subcommand on all services. -d, --debug Display any debugging information. -q, --quiet Make some output more quiet. -v, --verbose Make some output more verbose. -h, --help Show this message. Error: Invalid usage: unknown subcommand: status
好像是list?
brew services list Name Status User Plist mongodb-community@4.2 started xxx /Users/xxx/Library/LaunchAgents/homebrew.mxcl.mongodb-community@4.2.plist

【总结】
此处,Mac中,查看MongoDB服务状态,是否正在运行,可以用:
brew services list
此处输出:
brew services list Name Status User Plist mongodb-community@4.2 started xxx /Users/xxx/Library/LaunchAgents/homebrew.mxcl.mongodb-community@4.2.plist
其中的:
Status=started,表示已启动,正在运行。
转载请注明:在路上 » 【已解决】Mac中查看当前MongoDB的服务的状态是否正在运行