I recently completed the m001 basics course on Mongo University and connecting to Atlas with the connection string was not a problem. With experimenting I messed up and now I am not able to start mongo. The steps I followed are (from my root directory):
brew doctor --verbose
to make sure Homebrew is running correctly and there were no issues.
HomeBrew version: 3.0.1,
macOs: 11.1,
Homebrew Cask Staging Location: /usr/local/Caskroom
Homebrew Cask Taps: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask (3823 casks)
/usr/bin/xattr
brew cleanup
brew update
brew tap mongodb/brew
Mongo Docs installationbrew install [email protected]
Already downloaded: /Users/kevinturney/Library/Caches/Homebrew/downloads/269692f6b2d908000ecd7602021f4826947a782576c1fea760d25ece5ccbb521--mongodb-macos-x86_64-4.4.3.tgz
brew services start [email protected]
Service mongodb-community
already started, use brew services restart mongodb-community
to restart.
brew services restart mongodb-community
==> Successfully stopped mongodb-community
(label: homebrew.mxcl.mongodb-community)
==> Successfully started mongodb-community
(label: homebrew.mxcl.mongodb-community)
- kevinturney / $
brew services list
Here is the error:
Name | Status | User | Plist |
---|---|---|---|
mongodb-community | error | kevinturney | /Users/kevinturney/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist |
mysql | stopped | ||
postgresql | stopped | ||
redis | stopped | ||
unbound | stopped |
I checked the processes,
ps -ef | grep mongo
501 10770 81999 0 10:34AM ttys007 0:00.00 grep mongo
ps -ef | grep mongod
501 10776 81999 0 10:34AM ttys007 0:00.00 grep mongod
ps -ef | grep mongos
01 10781 81999 0 10:34AM ttys007 0:00.00 grep mongos
mongo --version
MongoDB shell version v4.2.2
git version: a0bbbff6ada159e19298d37946ac8dc4b497eadf
allocator: system
modules: enterprise
build environment:
distarch: x86_64
target_arch: x86_64
mongod --version
db version v4.2.2
git version: a0bbbff6ada159e19298d37946ac8dc4b497eadf
allocator: system
modules: enterprise
build environment:
distarch: x86_64
target_arch: x86_64
When I run brew services start mongodb-community
it successfully starts and then
mongo
this is the result:
kevinturney / $ brew services start mongodb-community
==> Successfully started `mongodb-community` (label: homebrew.mxcl.mongodb-community)
kevinturney / $ mongo
MongoDB shell version v4.2.2<br/>
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb<br/>
2021-02-17T11:37:32.192-0500 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, <br/>connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:341:17<br/>
@(connect):2:6
2021-02-17T11:37:32.195-0500 F - [main] exception: connect failed
2021-02-17T11:37:32.195-0500 E - [main] exiting with code 1
I followed a very similar StackOverflow question, went though mongo docs, uninstalled, reinstalled, Also, tried this great post I am not sure what to try next.