我试图运行MongoDB通过运行brew服务开始mongodb-community@4.2
但我得到的错误,你看到下面:
jaimes-mbp:SMR jaimemontoya$ brew services start mongodb-community@4.2
==> Tapping homebrew/services
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-services'...
remote: Enumerating objects: 27, done.
remote: Counting objects: 100% (27/27), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 27 (delta 0), reused 16 (delta 0), pack-reused 0
Unpacking objects: 100% (27/27), done.
Checking connectivity... done.
Tapped 0 formulae (63 files, 276K)
Error: Unknown command: services
jaimes-mbp:SMR jaimemontoya$
brew
不是命令吗,services
只是一个参数?我不明白为什么错误说services
是一个未知命令。谢谢你。
更新1:当我尝试再次运行brew installmongodb-community@4.2
时,我看到两个警告。也许这与问题有关?:
jaimes-mbp:SMR jaimemontoya$ brew install mongodb-community@4.2
Warning: mongodb/brew/mongodb-community-4.2.3 already installed
Warning: You are using OS X 10.15.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
更新2:当我使用mongo
时,它正在做某事:
jaimes-mbp:SMR jaimemontoya$ mongo
MongoDB shell version v4.2.3
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
2020-03-13T06:41:22.073-0600 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:341:17
@(connect):2:6
2020-03-13T06:41:22.076-0600 F - [main] exception: connect failed
2020-03-13T06:41:22.076-0600 E - [main] exiting with code 1
jaimes-mbp:SMR jaimemontoya$
也许我不需要使用brew服务开始mongodb-community@4.2
?我认为有必要运行MongoDB社区版。
更新3:我运行ps aux|grep-v grep|grepmongod
,它什么也不返回。我试图验证MongoDB是否正在运行,所以我在正在运行的进程中搜索mongod
,但它什么也不返回,这意味着我猜MongoDB没有运行。
更新4:看看当我运行brew医生--详细
时会发生什么:
Warning: You are using OS X 10.15.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
Warning: Your Homebrew is outdated.
You haven't updated for at least 24 hours. This is a long time in brewland!
To update Homebrew, run `brew update`.
Warning: The /usr/local directory is not writable.
Even if this directory was writable when you installed Homebrew, other
software may change permissions on this directory. Some versions of the
"InstantOn" component of Airfoil are known to do this.
您可能应该将 /usr/local的所有权和权限更改回您的用户帐户。sudo chown-R$(whoami): admin /usr/local
当我运行sudo chown-R$(whoami): admin /usr/local
时,我得到了这个:
jaimes-mbp:SMR jaimemontoya$ sudo chown -R $(whoami):admin /usr/local
Password:
chown: /usr/local: Operation not permitted
jaimes-mbp:SMR jaimemontoya$
brew update
不起作用:
jaimes-mbp:SMR jaimemontoya$ brew update
Error: The /usr/local directory is not writable.
Even if this directory was writable when you installed Homebrew, other
software may change permissions on this directory. Some versions of the
"InstantOn" component of Airfoil are known to do this.
You should probably change the ownership and permissions of /usr/local
back to your user account.
sudo chown -R $(whoami):admin /usr/local
jaimes-mbp:SMR jaimemontoya$
似乎您遇到了brew
的问题。
运行brew医生--详细
检查brew是否正常工作。
然后brew update
更新brew版本。
运行后,brew服务列表
显示brew中的所有服务。
如果您在列表中看到mongodb-community@4.2,则运行brew service startmongodb-community@4.2
它应该工作。