Próbuję uruchomić MongoDB, uruchamiając brew services start mongodb-community@4.2, ale pojawia się błąd, który widzisz poniżej:

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$ 

Czy brew nie jest poleceniem, a services tylko parametrem? Nie rozumiem, dlaczego błąd mówi, że services jest nieznanym poleceniem. Dziękuję Ci.

AKTUALIZACJA 1: Widzę dwa ostrzeżenia, kiedy próbuję ponownie uruchomić brew install mongodb-community@4.2. Może to ma coś wspólnego z problemem ?:

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.

AKTUALIZACJA 2: Kiedy używam mongo, coś robi:

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$  

Może nie muszę używać brew services start mongodb-community@4.2? Pomyślałem, że to konieczne, aby uruchomić MongoDB Community Edition.

UPDATE 3: Uruchamiam ps aux | grep -v grep | grep mongod i nic nie zwraca. Próbuję sprawdzić, czy MongoDB działa, więc szukam mongod w moich uruchomionych procesach, ale nic nie zwraca, co oznacza, że MongoDB chyba nie działa.

AKTUALIZACJA 4: Zobacz, co się stanie, gdy uruchomię brew doctor --verbose:

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.

Prawdopodobnie powinieneś zmienić własność i uprawnienia / usr / local z powrotem na swoje konto użytkownika. sudo chown -R $ (whoami): admin / usr / local

Kiedy uruchamiam sudo chown -R $(whoami):admin /usr/local, widzę to:

jaimes-mbp:SMR jaimemontoya$ sudo chown -R $(whoami):admin /usr/local
Password:
chown: /usr/local: Operation not permitted
jaimes-mbp:SMR jaimemontoya$ 

brew update nie działa:

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$ 
5
Jaime Montoya 13 marzec 2020, 15:27

2 odpowiedzi

Najlepsza odpowiedź

Postępowałem zgodnie z radą MikeMcQuaid podaną na https://github.com/Homebrew/brew/issues/3665:

Musisz odinstalować i zainstalować Homebrew za pomocą https://github.com/Homebrew/install

Jak wyjaśniono na https://github.com/Homebrew/install, po raz pierwszy uruchomiłem {{X0} }. Potem uruchomiłem /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)".

Następnie uruchomiłem to:

jaimes-mbp:SMR jaimemontoya$ brew tap mongodb/brew
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
No changes to formulae.

==> Tapping mongodb/brew
Cloning into '/usr/local/Homebrew/Library/Taps/mongodb/homebrew-brew'...
remote: Enumerating objects: 86, done.
remote: Counting objects: 100% (86/86), done.
remote: Compressing objects: 100% (76/76), done.
remote: Total 145 (delta 41), reused 21 (delta 10), pack-reused 59
Receiving objects: 100% (145/145), 30.18 KiB | 2.16 MiB/s, done.
Resolving deltas: 100% (68/68), done.
Tapped 6 formulae (33 files, 83.0KB).
jaimes-mbp:SMR jaimemontoya$ brew install mongodb-community@4.2
==> Installing mongodb-community from mongodb/brew
==> Downloading https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.2.3.tgz
######################################################################## 100.0%
==> Caveats
To have launchd start mongodb/brew/mongodb-community now and restart at login:
  brew services start mongodb/brew/mongodb-community
Or, if you don't want/need a background service you can just run:
  mongod --config /usr/local/etc/mongod.conf
==> Summary
🍺  /usr/local/Cellar/mongodb-community/4.2.3: 21 files, 304.3MB, built in 1 minute 54 seconds
jaimes-mbp:SMR jaimemontoya$ brew services start mongodb-community@4.2
==> Tapping homebrew/services
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-services'...
remote: Enumerating objects: 88, done.
remote: Counting objects: 100% (88/88), done.
remote: Compressing objects: 100% (47/47), done.
remote: Total 691 (delta 31), reused 69 (delta 25), pack-reused 603
Receiving objects: 100% (691/691), 192.79 KiB | 1.68 MiB/s, done.
Resolving deltas: 100% (270/270), done.
Tapped 1 command (39 files, 266.3KB).
==> Successfully started `mongodb-community` (label: homebrew.mxcl.mongodb-community)
jaimes-mbp:SMR jaimemontoya$ ps aux | grep -v grep | grep mongod
jaimemontoya     17763   0.1  0.2  5544164  38300   ??  S     8:11AM   0:00.65 /usr/local/opt/mongodb-community/bin/mongod --config /usr/local/etc/mongod.conf
jaimes-mbp:SMR jaimemontoya$ 

To działa!

1
Jaime Montoya 13 marzec 2020, 14:12

Wygląda na to, że masz problem z brew.

Uruchom brew doctor --verbose, aby sprawdzić, czy napar działa prawidłowo.

A następnie brew update, aby zaktualizować wersję napar.

Po tym uruchomieniu brew services list, aby wyświetlić wszystkie usługi w naparze.

Jeśli widzisz na liście mongodb-community@4.2, uruchom brew services start mongodb-community@4.2

Powinno działać.

1
Vijay Rajpurohit 13 marzec 2020, 13:04