Fresh MongoDB Community Edition install will not start (Installed through a fresh Homebrew install)

39 Views Asked by At

I had Homebrew install for many years. A few weeks ago, I installed MongoDB Community through Homebrew. I was able to start MongoDB and connect to it by mongosh.

I restarted my computer and MongoDB would not restart. Although, when starting it would say it started.

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

But the truth is

Name              Status     User File
mongodb-community error  512      /usr/local/opt/mongodb-community/homebrew.mxcl.mongodb-community.plist

I checked for lock files in /tmp/. Did not see any files having to do with MongoDB.

I uninstall and removed all of Homebrew and Mongodb. Then installed them again, and got the same errors.

Has anyone solved this issue?

Any help would be greatly appreciated.

Edit 1: Here are the logs from /usr/local/var/log/mongodb/output.log

Unrecognized option: net.ssl.PEMCertificateFile
try '/usr/local/opt/mongodb-community/bin/mongod --help' for more information
{"t":{"$date":"2024-03-04T08:29:19.900Z"},"s":"W",  "c":"CONTROL",  "id":23320,   "ctx":"thread1","msg":"Option: Given key is deprecated. Please use preferred key instead.","attr":{"deprecatedKey":"net.ssl.PEMKeyFile","preferredKey":"net.tls.certificateKeyFile"}}
Unrecognized option: net.ssl.PEMCertificateFile
try '/usr/local/opt/mongodb-community/bin/mongod --help' for more information
{"t":{"$date":"2024-03-04T16:57:06.256Z"},"s":"W",  "c":"CONTROL",  "id":23320,   "ctx":"thread1","msg":"Option: Given key is deprecated. Please use preferred key instead.","attr":{"deprecatedKey":"net.ssl.PEMKeyFile","preferredKey":"net.tls.certificateKeyFile"}}
Unrecognized option: net.ssl.PEMCertificateFile
try '/usr/local/opt/mongodb-community/bin/mongod --help' for more information
{"t":{"$date":"2024-03-04T17:16:32.791Z"},"s":"W",  "c":"CONTROL",  "id":23320,   "ctx":"thread1","msg":"Option: Given key is deprecated. Please use preferred key instead.","attr":{"deprecatedKey":"net.ssl.PEMKeyFile","preferredKey":"net.tls.certificateKeyFile"}}
Unrecognized option: net.ssl.PEMCertificateFile
try '/usr/local/opt/mongodb-community/bin/mongod --help' for more information
{"t":{"$date":"2024-03-04T17:17:23.014Z"},"s":"W",  "c":"CONTROL",  "id":23320,   "ctx":"thread1","msg":"Option: Given key is deprecated. Please use preferred key instead.","attr":{"deprecatedKey":"net.ssl.PEMKeyFile","preferredKey":"net.tls.certificateKeyFile"}}
Unrecognized option: net.ssl.PEMCertificateFile
try '/usr/local/opt/mongodb-community/bin/mongod --help' for more information
{"t":{"$date":"2024-03-04T19:00:00.733Z"},"s":"W",  "c":"CONTROL",  "id":23320,   "ctx":"thread1","msg":"Option: Given key is deprecated. Please use preferred key instead.","attr":{"deprecatedKey":"net.ssl.PEMKeyFile","preferredKey":"net.tls.certificateKeyFile"}}
Unrecognized option: net.ssl.PEMCertificateFile
try '/usr/local/opt/mongodb-community/bin/mongod --help' for more information
{"t":{"$date":"2024-03-04T19:08:23.290Z"},"s":"W",  "c":"CONTROL",  "id":23320,   "ctx":"thread1","msg":"Option: Given key is deprecated. Please use preferred key instead.","attr":{"deprecatedKey":"net.ssl.PEMKeyFile","preferredKey":"net.tls.certificateKeyFile"}}
Unrecognized option: net.ssl.PEMCertificateFile
try '/usr/local/opt/mongodb-community/bin/mongod --help' for more information
{"t":{"$date":"2024-03-04T19:12:50.509Z"},"s":"W",  "c":"CONTROL",  "id":23320,   "ctx":"thread1","msg":"Option: Given key is deprecated. Please use preferred key instead.","attr":{"deprecatedKey":"net.ssl.PEMKeyFile","preferredKey":"net.tls.certificateKeyFile"}}
Unrecognized option: net.ssl.PEMCertificateFile
try '/usr/local/opt/mongodb-community/bin/mongod --help' for more information
{"t":{"$date":"2024-03-04T19:15:29.945Z"},"s":"W",  "c":"CONTROL",  "id":23320,   "ctx":"thread1","msg":"Option: Given key is deprecated. Please use preferred key instead.","attr":{"deprecatedKey":"net.ssl.PEMKeyFile","preferredKey":"net.tls.certificateKeyFile"}}
Unrecognized option: net.ssl.PEMCertificateFile
try '/usr/local/opt/mongodb-community/bin/mongod --help' for more information

Edit 2: Solution: Thanks to @Joe in the comments. This is my conf file: /usr/local/etc/mongod.conf

systemLog:
  destination: file
  path: /usr/local/var/log/mongodb/mongo.log
  logAppend: true
storage:
  dbPath: /usr/local/var/mongodb
net:
  bindIp: 127.0.0.1, ::1
  ipv6: true
  port: 27017
  ssl:
    mode: requireSSL
    PEMKeyFile: /usr/local/etc/ssl/mongodb-cert.key
    PEMCertificateFile: /usr/local/etc/ssl/mongodb-cert.crt 

Comparing it to mongodb.com/docs/manual/reference/configuration-options; the attribute that is missing is PEMCertificateFile. Apparently this is no longer a supported attribute. For good measure, I commented out the ssl attribute and its children.

And everything worked.

1

There are 1 best solutions below

0
user2517182 On

Shout out to @Joe in the comments of the post.

The following is the /usr/local/etc/mongod.conf that comes with a fresh install of mongodb via homebrew.

systemLog:
  destination: file
  path: /usr/local/var/log/mongodb/mongo.log
  logAppend: true
storage:
  dbPath: /usr/local/var/mongodb
net:
  bindIp: 127.0.0.1, ::1
  ipv6: true
  port: 27017
  ssl:
    mode: requireSSL
    PEMKeyFile: /usr/local/etc/ssl/mongodb-cert.key
    PEMCertificateFile: /usr/local/etc/ssl/mongodb-cert.crt 

Comparing it to mongodb.com/docs/manual/reference/configuration-options; the attribute that is missing is problematic is PEMCertificateFile. Apparently this is no longer a supported attribute. For good measure, I commented out the ssl attribute and its children.

And everything worked.

So my /usr/local/etc/mongod.conf no looks like

systemLog:
  destination: file
  path: /usr/local/var/log/mongodb/mongo.log
  logAppend: true
storage:
  dbPath: /usr/local/var/mongodb
net:
  bindIp: 127.0.0.1, ::1
  ipv6: true
  port: 27017
  # ssl:
  #   mode: requireSSL
  #   PEMKeyFile: /usr/local/etc/ssl/mongodb-cert.key
  #   PEMCertificateFile: /usr/local/etc/ssl/mongodb-cert.crt