Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mongod error (installed with homebrew)

Tags:

mongodb

I have installed mongodb with

brew install mongodb

Created folder

mkdir -p /data/db

Handle permissions

sudo chown -R `id -un` /data/db

Run

mongod    

Error log

2018-01-06T14:28:51.450+0100 I CONTROL  [initandlisten] MongoDB starting : pid=6120 port=27017 dbpath=/data/db 64-bit host=Zigas-MBP-2
2018-01-06T14:28:51.451+0100 I CONTROL  [initandlisten] db version v3.6.1
2018-01-06T14:28:51.451+0100 I CONTROL  [initandlisten] git version: 025d4f4fe61efd1fb6f0005be20cb45a004093d1
2018-01-06T14:28:51.451+0100 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2n  7 Dec 2017
2018-01-06T14:28:51.451+0100 I CONTROL  [initandlisten] allocator: system
2018-01-06T14:28:51.451+0100 I CONTROL  [initandlisten] modules: none
2018-01-06T14:28:51.451+0100 I CONTROL  [initandlisten] build environment:
2018-01-06T14:28:51.451+0100 I CONTROL  [initandlisten]     distarch: x86_64
2018-01-06T14:28:51.451+0100 I CONTROL  [initandlisten]     target_arch: x86_64
2018-01-06T14:28:51.451+0100 I CONTROL  [initandlisten] options: {}
2018-01-06T14:28:51.452+0100 I -        [initandlisten] Detected data files in /data/db created by the 'mmapv1' storage engine, so setting the active storage engine to 'mmapv1'.
2018-01-06T14:28:51.470+0100 I JOURNAL  [initandlisten] journal dir=/data/db/journal
2018-01-06T14:28:51.471+0100 I JOURNAL  [initandlisten] recover : no journal files present, no recovery needed
2018-01-06T14:28:51.494+0100 I JOURNAL  [durability] Durability thread started
2018-01-06T14:28:51.494+0100 I JOURNAL  [journal writer] Journal writer thread started
2018-01-06T14:28:51.495+0100 I CONTROL  [initandlisten]
2018-01-06T14:28:51.495+0100 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-01-06T14:28:51.495+0100 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2018-01-06T14:28:51.495+0100 I CONTROL  [initandlisten]
2018-01-06T14:28:51.495+0100 I CONTROL  [initandlisten] ** WARNING: This server is bound to localhost.
2018-01-06T14:28:51.495+0100 I CONTROL  [initandlisten] **          Remote systems will be unable toconnect to this server.
2018-01-06T14:28:51.495+0100 I CONTROL  [initandlisten] **          Start the server with --bind_ip <address> to specify which IP
2018-01-06T14:28:51.495+0100 I CONTROL  [initandlisten] **          addresses it should serve responses from, or with --bind_ip_all to
2018-01-06T14:28:51.495+0100 I CONTROL  [initandlisten] **          bind to all interfaces. If this behavior is desired, start the
2018-01-06T14:28:51.495+0100 I CONTROL  [initandlisten] **          server with --bind_ip 127.0.0.1 to disable this warning.
2018-01-06T14:28:51.495+0100 I CONTROL  [initandlisten]
2018-01-06T14:28:51.762+0100 F CONTROL  [initandlisten] ** IMPORTANT: UPGRADE PROBLEM: The data files need to be fully upgraded to version 3.4 before attempting an upgrade to 3.6; see http://dochub.mongodb.org/core/3.6-upgrade-fcv for more details.
2018-01-06T14:28:51.762+0100 I NETWORK  [initandlisten] shutdown: going to close listening sockets...
2018-01-06T14:28:51.763+0100 I NETWORK  [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2018-01-06T14:28:51.763+0100 I REPL     [initandlisten] shutdown: removing all drop-pending collections...
2018-01-06T14:28:51.763+0100 I REPL     [initandlisten] shutdown: removing checkpointTimestamp collection...
2018-01-06T14:28:51.763+0100 I STORAGE  [initandlisten] shutdown: waiting for fs preallocator...
2018-01-06T14:28:51.763+0100 I STORAGE  [initandlisten] shutdown: final commit...
2018-01-06T14:28:51.770+0100 I JOURNAL  [initandlisten] journalCleanup...
2018-01-06T14:28:51.770+0100 I JOURNAL  [initandlisten] removeJournalFiles
2018-01-06T14:28:51.770+0100 I JOURNAL  [initandlisten] old journal file will be removed: /data/db/journal/j._0
2018-01-06T14:28:51.771+0100 I JOURNAL  [initandlisten] Terminating durability thread ...
2018-01-06T14:28:51.870+0100 I JOURNAL  [journal writer] Journal writer thread stopped
2018-01-06T14:28:51.870+0100 I JOURNAL  [durability] Durability thread stopped
2018-01-06T14:28:51.870+0100 I STORAGE  [initandlisten] shutdown: closing all files...
2018-01-06T14:28:51.883+0100 I STORAGE  [initandlisten] closeAllFiles() finished
2018-01-06T14:28:51.883+0100 I STORAGE  [initandlisten] shutdown: removing fs lock...
2018-01-06T14:28:51.883+0100 I CONTROL  [initandlisten] now exiting
2018-01-06T14:28:51.883+0100 I CONTROL  [initandlisten] shutting down with code:62

Any help would be apprichiated.

like image 823
be-codified Avatar asked Jan 06 '18 13:01

be-codified


People also ask

How do I enable MongoDB on Mac?

Open the Terminal app and type brew update . Run the Mongo daemon, in one of your terminal windows run mongod . This should start the Mongo server.

How do I download MongoDB on Windows 10 64-bit?

Go to link and Download MongoDB Community Server. We will install the 64-bit version for Windows. Click on the “complete” button to install all of the components.


2 Answers

2018-01-06T14:28:51.762+0100 F CONTROL [initandlisten] ** IMPORTANT: UPGRADE PROBLEM: The data files need to be fully upgraded to version 3.4 before attempting an upgrade to 3.6; see http://dochub.mongodb.org/core/3.6-upgrade-fcv for more details.

This is the fault error in your log.

So I guess you have some 3.4 data in your /data/db.

  1. If you want a clean installation, just remove the contents of /data/db and restart mongod

or

  1. Get a 3.4 mongod

Ref: https://docs.mongodb.com/manual/release-notes/3.6-upgrade-standalone/

like image 71
shawn Avatar answered Nov 15 '22 23:11

shawn


The error is telling you that you have mongo 3.4 data inside /data/db but you have version 3.6 of Mongo installed.

To fix this you can use one of the options listed below...

  1. Remove the contents of /data/db and restart mongod. This should probably be backed up or you'll lose your data.
  2. Install mongodb 3.4 you can check if you previously installed it using brew list --versions mongodb then if a 3.4.* version comes up, 3.4.10 for example use brew switch mongodb 3.4.10 to move back to that version. If you never had the version installed see this answer to install the older version Homebrew install specific version of formula?
  3. Use #2 to move back to 3.4 then go into mongo shell using mongo and run db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } ). Exit the mongo shell and use the brew switch command to switch back to 3.6.
like image 30
Dan Webb Avatar answered Nov 15 '22 22:11

Dan Webb