3

Today, without making any aware change, my mongodb-community stopped working.

When I checked the brew services I saw error as status

mongodb-community error  3584 user ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community@4.2.plist

I checked the logs and I found this error:

2022-02-25T15:50:58.324-0800 I  CONTROL  [main] ***** SERVER RESTARTED *****
2022-02-25T15:50:58.330-0800 I  CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2022-02-25T15:50:58.359-0800 W  ASIO     [main] No TransportLayer configured during NetworkInterface startup
2022-02-25T15:50:58.360-0800 I  CONTROL  [initandlisten] MongoDB starting : pid=64356 port=27017 dbpath=/usr/local/var/mongodb 64-bit host=Als-MacBook-Pro.local
2022-02-25T15:50:58.360-0800 I  CONTROL  [initandlisten] db version v4.2.18
2022-02-25T15:50:58.360-0800 I  CONTROL  [initandlisten] git version: f65ce5e25c0b26a00d091a4d24eec1a8b3a4c016
2022-02-25T15:50:58.360-0800 I  CONTROL  [initandlisten] allocator: system
2022-02-25T15:50:58.360-0800 I  CONTROL  [initandlisten] modules: none
2022-02-25T15:50:58.360-0800 I  CONTROL  [initandlisten] build environment:
2022-02-25T15:50:58.360-0800 I  CONTROL  [initandlisten]     distarch: x86_64
2022-02-25T15:50:58.360-0800 I  CONTROL  [initandlisten]     target_arch: x86_64
2022-02-25T15:50:58.360-0800 I  CONTROL  [initandlisten] options: { config: "/usr/local/etc/mongod.conf", net: { bindIp: "127.0.0.1" }, storage: { dbPath: "/usr/local/var/mongodb" }, systemLog: { destination: "file", logAppend: true, path: "/usr/local/var/log/mongodb/mongo.log" } }
2022-02-25T15:50:58.361-0800 I  STORAGE  [initandlisten] Detected data files in /usr/local/var/mongodb created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2022-02-25T15:50:58.361-0800 I  STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=7680M,cache_overflow=(file_max=0M),session_max=33000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000,close_scan_interval=10,close_handle_minimum=250),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress],
2022-02-25T15:50:58.788-0800 E  STORAGE  [initandlisten] WiredTiger error (13) [1645833058:788043][64356:0x11468e600], wiredtiger_open: __posix_open_file, 665: /usr/local/var/mongodb/WiredTiger.turtle: handle-open: open: Permission denied Raw: [1645833058:788043][64356:0x11468e600], wiredtiger_open: __posix_open_file, 665: /usr/local/var/mongodb/WiredTiger.turtle: handle-open: open: Permission denied
2022-02-25T15:50:58.789-0800 E  STORAGE  [initandlisten] WiredTiger error (13) [1645833058:789197][64356:0x11468e600], wiredtiger_open: __posix_open_file, 665: /usr/local/var/mongodb/WiredTiger.turtle: handle-open: open: Permission denied Raw: [1645833058:789197][64356:0x11468e600], wiredtiger_open: __posix_open_file, 665: /usr/local/var/mongodb/WiredTiger.turtle: handle-open: open: Permission denied
2022-02-25T15:50:58.789-0800 E  STORAGE  [initandlisten] WiredTiger error (13) [1645833058:789360][64356:0x11468e600], wiredtiger_open: __posix_open_file, 665: /usr/local/var/mongodb/WiredTiger.turtle: handle-open: open: Permission denied Raw: [1645833058:789360][64356:0x11468e600], wiredtiger_open: __posix_open_file, 665: /usr/local/var/mongodb/WiredTiger.turtle: handle-open: open: Permission denied
2022-02-25T15:50:58.789-0800 E  STORAGE  [initandlisten] WiredTiger error (13) [1645833058:789507][64356:0x11468e600], wiredtiger_open: __posix_open_file, 665: /usr/local/var/mongodb/WiredTiger.turtle: handle-open: open: Permission denied Raw: [1645833058:789507][64356:0x11468e600], wiredtiger_open: __posix_open_file, 665: /usr/local/var/mongodb/WiredTiger.turtle: handle-open: open: Permission denied
2022-02-25T15:50:58.789-0800 E  STORAGE  [initandlisten] WiredTiger error (13) [1645833058:789685][64356:0x11468e600], wiredtiger_open: __posix_open_file, 665: /usr/local/var/mongodb/WiredTiger.turtle: handle-open: open: Permission denied Raw: [1645833058:789685][64356:0x11468e600], wiredtiger_open: __posix_open_file, 665: /usr/local/var/mongodb/WiredTiger.turtle: handle-open: open: Permission denied
2022-02-25T15:50:58.789-0800 W  STORAGE  [initandlisten] Failed to start up WiredTiger under any compatibility version.
2022-02-25T15:50:58.789-0800 F  STORAGE  [initandlisten] Reason: 13: Permission denied
2022-02-25T15:50:58.789-0800 F  -        [initandlisten] Fatal Assertion 28595 at src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 928
2022-02-25T15:50:58.789-0800 F  -        [initandlisten] \n\n***aborting after fassert() failure\n\n

I searched in Google and Stack and found some solutions like downgrading MongoDB to version 4.2.x, or setting permissions, but none of them worked.

What can I do? I'd even consider losing data since this is a local server with dummy data. In any case, I would like to fix it in the right way.

Thanks.

Peter
  • 2,004
  • 2
  • 24
  • 57
  • it seems you need to fix data folder permissions: "Reason: 13: Permission denied" , something like chown -R mongo /data/ – R2D2 Feb 28 '22 at 21:47

2 Answers2

3

This usually happens on upgrades, so please check your mongo version. I had the same issue on a couple of servers. The proper way to avoid this is to set FCV (featureCompatibilityVersion) to the correct one before we do mongo upgrade. In this case, it should be set to version 4.2 before we do upgrade to mongo 4.4. To check current FCV, run this command in mongo shell (admin db):

db.adminCommand({ getParameter: 1, featureCompatibilityVersion: 1 })

In my case it was 4.0, so I had to update it by executing:

db.adminCommand( { setFeatureCompatibilityVersion: "4.2" } )

And then upgrade to mongo 4.4 was smooth.

In case you have already messed up it should be possible to downgrade to mongo 4.2.6 or a later version, update FCV as stated above, and then upgrade to mongo 4.4. Based on your logs, look like it does not have permissions to access some files (e.g. /var/lib/mongodb/), so make sure those are owned by mongodb user.

benjamin
  • 61
  • 4
0

I did installed the non-official mongoDB using:

sudo apt-get install mongodb

then I uninstalled it, but using remove instead of purge

then installed the mongodb-org according to the official webpage,and get the same errorFailed to start up WiredTiger under any compatibility version.

after that, I uninstalled everything about mongodb using pruge, re-installed mongdb, uninstall it again using purge, then re-installed mongodb-org.

Problem soved.

Draculea
  • 303
  • 2
  • 7