mongod won't start after upgrade from 3 to 5 - mongodb

I'm running ubuntu 20.04 and did the following:
$ sudo apt purge '*mongo*
and
$ sudo apt install -y mongodb-org
everything appeared to install correclty but when I run $ sudo systemctl status mongod I get a failure
The log shows the following errors:
{"t":{"$date":"2022-07-28T04:58:05.912-07:00"},"s":"E", "c":"NETWORK", "id":23024, "ctx":"initandlisten","msg":"Failed to unlink socket file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Operation not permitted"}}
{"t":{"$date":"2022-07-28T04:58:05.912-07:00"},"s":"F", "c":"-", "id":23091, "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":40486,"file":"src/mongo/transport/transport_layer_asio.cpp","line":1019}}
{"t":{"$date":"2022-07-28T04:58:05.912-07:00"},"s":"F", "c":"-", "id":23092, "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}
How do I fix?

Related

Errors with mongo-community6 on mac cannot start

I am having these issues with mongo startup on mac. There are two. One when I start without sudo and one with sudo. Setup with brew.
brew install mongodb-community#6.0
Tried: sudo brew services restart mongodb-community
Without sudo, permission denied error.
{"t":{"$date":"2022-12-10T14:01:32.755-05:00"},"s":"E", "c":"NETWORK", "id":23024, "ctx":"initandlisten","msg":"Failed to unlink socket file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Permission denied"}}
With sudo
{"t":{"$date":"2022-12-10T13:55:50.382-05:00"},"s":"F", "c":"CONTROL", "id":20573, "ctx":"initandlisten","msg":"Wrong mongod version","attr":{"error":"UPGRADE PROBLEM: Found an invalid featureCompatibilityVersion document (ERROR: Location4926900: Invalid featureCompatibilityVersion document in admin.system.version: { _id: \"featureCompatibilityVersion\", version: \"4.2\" }. See https://docs.mongodb.com/master/release-notes/5.0-compatibility/#feature-compatibility. :: caused by :: Invalid feature compatibility version value, expected '5.0' or '5.3' or '6.0. See https://docs.mongodb.com/master/release-notes/5.0-compatibility/#feature-compatibility.). If the current featureCompatibilityVersion is below 5.0, see the documentation on upgrading at https://docs.mongodb.com/master/release-notes/5.0/#upgrade-procedures."}}
{"t":{"$date":"2022-12-10T13:5

MongoDB 6.0.x - No longer runs on macOS Ventura 13.1 or 13.2

Just upgraded (14.12.2022) to macOS Ventura 13.1 (22C65).
Using Mongo on /usr/local/Cellar/mongodb-community/6.0.1/bin:
brew services restart mongodb-community#6.0
Stopping `mongodb-community`... (might take a while)
==> Successfully stopped `mongodb-community` (label: homebrew.mxcl.mongodb-community)
==> Successfully started `mongodb-community` (label: homebrew.mxcl.mongodb-community)
Then I run "mongosh":
mongosh
Now gives:
Current Mongosh Log ID: 6399ebcbf7b524ab8380978a
Connecting to: mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.1
MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017
Also unable to use: MongoDB Compass or Studio 3T.
Was working fine before I upgraded macOS Ventura 13.0.1 -> 13.1. TIA.
/usr/local/var/log/mongodb/mongo.log
{"t":{"$date":"2022-12-14T17:26:52.465+00:00"},"s":"I", "c":"NETWORK", "id":4915701, "ctx":"thread1","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":17},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":17},"outgoing":{"minWireVersion":6,"maxWireVersion":17},"isInternalClient":true}}}
{"t":{"$date":"2022-12-14T17:26:52.466+00:00"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"thread1","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2022-12-14T17:26:52.467+00:00"},"s":"I", "c":"NETWORK", "id":4648602, "ctx":"thread1","msg":"Implicit TCP FastOpen in use."}
{"t":{"$date":"2022-12-14T17:26:52.480+00:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","namespace":"config.tenantMigrationDonors"}}
{"t":{"$date":"2022-12-14T17:26:52.480+00:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","namespace":"config.tenantMigrationRecipients"}}
{"t":{"$date":"2022-12-14T17:26:52.480+00:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"ShardSplitDonorService","namespace":"config.tenantSplitDonors"}}
{"t":{"$date":"2022-12-14T17:26:52.480+00:00"},"s":"I", "c":"CONTROL", "id":5945603, "ctx":"thread1","msg":"Multi threading initialized"}
{"t":{"$date":"2022-12-14T17:26:52.480+00:00"},"s":"I", "c":"CONTROL", "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":4184,"port":27017,"dbPath":"/usr/local/var/mongodb","architecture":"64-bit","host":"MacBook-Pro-2.local"}}
{"t":{"$date":"2022-12-14T17:26:52.480+00:00"},"s":"I", "c":"CONTROL", "id":23403, "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"6.0.1","gitVersion":"32f0f9c88dc44a2c8073a5bd47cf779d4bfdee6b","modules":[],"allocator":"system","environment":{"distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2022-12-14T17:26:52.480+00:00"},"s":"I", "c":"CONTROL", "id":51765, "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Mac OS X","version":"22.2.0"}}}
{"t":{"$date":"2022-12-14T17:26:52.480+00:00"},"s":"I", "c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set by command line","attr":{"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"}}}}
{"t":{"$date":"2022-12-14T17:26:52.482+00:00"},"s":"I", "c":"NETWORK", "id":5693100, "ctx":"initandlisten","msg":"Asio socket.set_option failed with std::system_error","attr":{"note":"acceptor TCP fast open","option":{"level":6,"name":261,"data":"00 04 00 00"},"error":{"what":"set_option: Invalid argument","message":"Invalid argument","category":"asio.system","value":22}}}
{"t":{"$date":"2022-12-14T17:26:52.502+00:00"},"s":"I", "c":"STORAGE", "id":22270, "ctx":"initandlisten","msg":"Storage engine to use detected by data files","attr":{"dbpath":"/usr/local/var/mongodb","storageEngine":"wiredTiger"}}
{"t":{"$date":"2022-12-14T17:26:52.502+00:00"},"s":"I", "c":"STORAGE", "id":22315, "ctx":"initandlisten","msg":"Opening WiredTiger","attr":{"config":"create,cache_size=32256M,session_max=33000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,remove=true,path=journal,compressor=snappy),builtin_extension_config=(zstd=(compression_level=6)),file_manager=(close_idle_time=600,close_scan_interval=10,close_handle_minimum=2000),statistics_log=(wait=0),json_output=(error,message),verbose=[recovery_progress:1,checkpoint_progress:1,compact_progress:1,backup:0,checkpoint:0,compact:0,evict:0,history_store:0,recovery:0,rts:0,salvage:0,tiered:0,timestamp:0,transaction:0,verify:0,log:0],"}}
{"t":{"$date":"2022-12-14T17:26:53.152+00:00"},"s":"E", "c":"WT", "id":22435, "ctx":"initandlisten","msg":"WiredTiger error message","attr":{"error":13,"message":"[1671038813:151111][4184:0x7ff845fae8c0], wiredtiger_open: [WT_VERB_DEFAULT][ERROR]: int __posix_open_file(WT_FILE_SYSTEM *, WT_SESSION *, const char *, WT_FS_OPEN_FILE_TYPE, uint32_t, WT_FILE_HANDLE **), 805: /usr/local/var/mongodb/WiredTiger.turtle: handle-open: open: Permission denied"}}
{"t":{"$date":"2022-12-14T17:26:53.154+00:00"},"s":"E", "c":"WT", "id":22435, "ctx":"initandlisten","msg":"WiredTiger error message","attr":{"error":13,"message":"[1671038813:154273][4184:0x7ff845fae8c0], wiredtiger_open: [WT_VERB_DEFAULT][ERROR]: int __posix_open_file(WT_FILE_SYSTEM *, WT_SESSION *, const char *, WT_FS_OPEN_FILE_TYPE, uint32_t, WT_FILE_HANDLE **), 805: /usr/local/var/mongodb/WiredTiger.turtle: handle-open: open: Permission denied"}}
{"t":{"$date":"2022-12-14T17:26:53.155+00:00"},"s":"E", "c":"WT", "id":22435, "ctx":"initandlisten","msg":"WiredTiger error message","attr":{"error":13,"message":"[1671038813:155027][4184:0x7ff845fae8c0], wiredtiger_open: [WT_VERB_DEFAULT][ERROR]: int __posix_open_file(WT_FILE_SYSTEM *, WT_SESSION *, const char *, WT_FS_OPEN_FILE_TYPE, uint32_t, WT_FILE_HANDLE **), 805: /usr/local/var/mongodb/WiredTiger.turtle: handle-open: open: Permission denied"}}
{"t":{"$date":"2022-12-14T17:26:53.155+00:00"},"s":"W", "c":"STORAGE", "id":22347, "ctx":"initandlisten","msg":"Failed to start up WiredTiger under any compatibility version. This may be due to an unsupported upgrade or downgrade."}
{"t":{"$date":"2022-12-14T17:26:53.155+00:00"},"s":"F", "c":"STORAGE", "id":28595, "ctx":"initandlisten","msg":"Terminating.","attr":{"reason":"13: Permission denied"}}
{"t":{"$date":"2022-12-14T17:26:53.155+00:00"},"s":"F", "c":"ASSERT", "id":23091, "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":28595,"file":"src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp","line":702}}
{"t":{"$date":"2022-12-14T17:26:53.155+00:00"},"s":"F", "c":"ASSERT", "id":23092, "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}
BTW - Had to move back to "mongodb-community/5.0.7":
cd /usr/local/Cellar/mongodb-community/5.0.7/bin
./mongod --repair --dbpath /usr/local/var/mongodb --storageEngine wiredTiger
...
./mongod --config /usr/local/etc/mongod.conf
Then works:
./mongo
MongoDB shell version v5.0.7
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("fb718853-38f5-4ac7-809a-b5e5b4c3d184") }
MongoDB server version: 5.0.7
================
Warning: the "mongo" shell has been superseded by "mongosh",
which delivers improved usability and compatibility.The "mongo" shell has been deprecated and will be removed in
an upcoming release.
For installation instructions, see
https://docs.mongodb.com/mongodb-shell/install/
================
---
The server generated these startup warnings when booting:
2022-12-14T21:38:33.980+00:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
2022-12-14T21:38:33.998+00:00: Soft rlimits for open file descriptors too low
2022-12-14T21:38:33.998+00:00: currentValue: 256
2022-12-14T21:38:33.998+00:00: recommendedMinimum: 64000
---
---
Enable MongoDB's free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).
The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.
To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---
FIXED (20/12/22):
brew unpin mongodb-community
brew upgrade
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
You have 2 outdated formulae installed.
You can upgrade them with brew upgrade
or list them with brew outdated.
Error: Not upgrading 1 pinned package:
wildfly-as 27.0.1
==> Upgrading 1 outdated package:
mongodb/brew/mongodb-community 6.0.3
==> Fetching mongodb/brew/mongodb-community
==> Downloading https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-6.0.3.tgz
######################################################################## 100.0%
==> Upgrading mongodb/brew/mongodb-community
-> 6.0.3
==> Caveats
To restart mongodb/brew/mongodb-community after an upgrade:
brew services restart 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/6.0.3: 10 files, 208.8MB, built in 3 seconds
==> Running `brew cleanup mongodb-community`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /usr/local/Cellar/mongodb-community/5.0.7... (11 files, 182.5MB)
brew services restart mongodb/brew/mongodb-community
Stopping `mongodb-community`... (might take a while)
==> Successfully stopped `mongodb-community` (label: homebrew.mxcl.mongodb-community)
==> Successfully started `mongodb-community` (label: homebrew.mxcl.mongodb-community)
23.01.23
Just upgrade macOS to 13.2 & 'mongodb-community' fails to run 6.0.3 & 6.0.4.
mongosh
Current Mongosh Log ID: 63ceeb88a1274eb5a6e6f8e0
Connecting to: mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.2
MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017
Just noticed on β€˜brew’ that MongoDB 6.0.1 can be upgraded to β†’ 6.0.3 (20.12.22).
brew unpin mongodb-community
brew upgrade
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
You have 2 outdated formulae installed.
You can upgrade them with brew upgrade
or list them with brew outdated.
==> Upgrading 1 outdated package:
mongodb/brew/mongodb-community 6.0.3
==> Fetching mongodb/brew/mongodb-community
==> Downloading https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-6.0.3.tgz
######################################################################## 100.0%
==> Upgrading mongodb/brew/mongodb-community
-> 6.0.3
==> Caveats
To restart mongodb/brew/mongodb-community after an upgrade:
brew services restart 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/6.0.3: 10 files, 208.8MB, built in 3 seconds
==> Running `brew cleanup mongodb-community`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /usr/local/Cellar/mongodb-community/5.0.7... (11 files, 182.5MB)
Obviously a bug with MongoDB on macOS. The two upgrads of 6.01 to 6.0.2/6.0.3 fixes:
brew services restart mongodb/brew/mongodb-community
Stopping `mongodb-community`... (might take a while)
==> **Successfully stopped `mongodb-community` (label: homebrew.mxcl.mongodb-community)**
==> **Successfully started `mongodb-community` (label: homebrew.mxcl.mongodb-community)**
(23/01/2023):
Just upgrade Intel macOS to 13.2 & 'mongodb-community' fails to run 6.0.3.
brew services restart mongodb/brew/mongodb-community
Stopping `mongodb-community`... (might take a while)
==> Successfully stopped `mongodb-community` (label: homebrew.mxcl.mongodb-community)
==> Successfully started `mongodb-community` (label: homebrew.mxcl.mongodb-community)
mongosh
Current Mongosh Log ID: 63ceeb88a1274eb5a6e6f8e0
Connecting to: mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.2
MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017
(25/01/2023) Fixed MongoDB mongodb-community 6.0.4 on macOS 13.2 using 'brew':
Deleted files inside:
usr/local/var/mongodb/
Run:
brew services stop mongodb-community
mongod --config /usr/local/etc/mongod.conf
mongod --repair --dbpath /usr/local/var/mongodb --storageEngine wiredTiger
brew services restart mongodb/brew/mongodb-community
==> Successfully started `mongodb-community` (label: homebrew.mxcl.mongodb-community)
Then run 'mongosh':
Current Mongosh Log ID: 63d12734740a00eef4b7d5f3
Connecting to: mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.2
Using MongoDB: 6.0.4
Using Mongosh: 1.6.2
For mongosh info see: https://docs.mongodb.com/mongodb-shell/
------
The server generated these startup warnings when booting
2023-01-25T12:57:12.608+00:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
------
------
Enable MongoDB's free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).
The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.
To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
------
Warning: Found ~/.mongorc.js, but not ~/.mongoshrc.js. ~/.mongorc.js will not be loaded.
You may want to copy or rename ~/.mongorc.js to ~/.mongoshrc.js.
test>
For anyone else finding this thread and still having issues with an M1 Mac, be sure Homebrew is properly (re)installed.
Homebrew uses different directories on M1 (/opt/homebrew) than Intel. And even though Brew won't complain, mongosh won't start if Brew was installed in the old intel directories and therefore mongo was installed in the wrong place as well.
See this post for details on how to properly install Homebrew on M1
then follow the official MongoDB install here and mongosh will properly connect.

Upgraded Mongo from 4.4 to 5.0 now DB won't start

My DB runs in AWS and I upgraded to Mongo 5.0. Now I cannot even start the database because I get the the following error:
mongod.service - MongoDB Database Server
Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2021-10-25 00:16:42 UTC; 26min ago
Docs: https://docs.mongodb.org/manual
Process: 3888 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=62)
Process: 3886 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 3883 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 3881 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)
According to the docs status=62 means there is an incompatibility issue.
I would like to downgrade back to 4.4 but there is no clear way to do so. Mongo Docs assumes the DB is running and says to run db.adminCommand( { setFeatureCompatibilityVersion: "4.4" } )
I can't run this command since the DB won't even start.
I deleted the the 5.0 binaries but that didn't do anything. The DB version is still showing "5.0.3"
Any help you can provide would be greatly appreciated
Here is some additional output:
Unit mongod.service has begun starting up.
mongod[3591]: about to fork child process, waiting until server is ready for connections.
mongod[3591]: forked process: 3594
mongod[3591]: ERROR: child process failed, exited with 62
mongod[3591]: To see additional information in this output, start without the "--fork" option.
sudo[3579]: pam_unix(sudo:session): session closed for user root
systemd[1]: mongod.service: control process exited, code=exited status=62
systemd[1]: Failed to start MongoDB Database Server.
Subject: Unit mongod.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mongod.service has failed.
--
-- The result is failed.
systemd[1]: Unit mongod.service entered failed state.
systemd[1]: mongod.service failed.
Ran the following command: cat mongod.log | tail -10
{"t":{"$date":"2021-10-25T22:49:33.833+00:00"},"s":"I", "c":"STORAGE", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1635202173:833865][3594:0x7f52128ce280], WT_SESSION.checkpoint: [WT_VERB_CHECKPOINT_PROGRESS] saving checkpoint snapshot min: 2, snapshot max: 2 snapshot count: 0, oldest timestamp: (0, 0) , meta checkpoint timestamp: (0, 0) base write gen: 441594"}}
{"t":{"$date":"2021-10-25T22:49:33.839+00:00"},"s":"I", "c":"STORAGE", "id":4795903, "ctx":"initandlisten","msg":"Reconfigure complete","attr":{"durationMillis":127}}
{"t":{"$date":"2021-10-25T22:49:33.839+00:00"},"s":"I", "c":"STORAGE", "id":4795902, "ctx":"initandlisten","msg":"Closing WiredTiger","attr":{"closeConfig":"leak_memory=true,"}}
{"t":{"$date":"2021-10-25T22:49:33.839+00:00"},"s":"I", "c":"STORAGE", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1635202173:839582][3594:0x7f52128ce280], close_ckpt: [WT_VERB_CHECKPOINT_PROGRESS] saving checkpoint snapshot min: 4, snapshot max: 4 snapshot count: 0, oldest timestamp: (0, 0) , meta checkpoint timestamp: (0, 0) base write gen: 441594"}}
{"t":{"$date":"2021-10-25T22:49:33.867+00:00"},"s":"I", "c":"STORAGE", "id":4795901, "ctx":"initandlisten","msg":"WiredTiger closed","attr":{"durationMillis":28}}
{"t":{"$date":"2021-10-25T22:49:33.867+00:00"},"s":"I", "c":"STORAGE", "id":22279, "ctx":"initandlisten","msg":"shutdown: removing fs lock..."}
{"t":{"$date":"2021-10-25T22:49:33.867+00:00"},"s":"I", "c":"-", "id":4784931, "ctx":"initandlisten","msg":"Dropping the scope cache for shutdown"}
{"t":{"$date":"2021-10-25T22:49:33.867+00:00"},"s":"I", "c":"FTDC", "id":4784926, "ctx":"initandlisten","msg":"Shutting down full-time data capture"}
{"t":{"$date":"2021-10-25T22:49:33.867+00:00"},"s":"I", "c":"CONTROL", "id":20565, "ctx":"initandlisten","msg":"Now exiting"}
{"t":{"$date":"2021-10-25T22:49:33.867+00:00"},"s":"I", "c":"CONTROL", "id":23138, "ctx":"initandlisten","msg":"Shutting down","attr":{"exitCode":62}}
This solved the same problem for me.
Remove version 5.0
Stop mongod service
sudo systemctl stop mongod
sudo rm /tmp/mongodb-27017.sock
Backup your data directory
cp -r /var/lib/mongodb /var/lib/mongodb_backup
Remove version 5.0 and it's data
sudo apt purge mongodb-org
sudo apt autoremove
sudo rm /etc/mongod.conf
# Remove all mongo-org apt sources
sudo rm /etc/apt/sources.list.d/mongodb-org-*
Install version 4.4
Follow the instructions here mongodb v4.4 documentation
Run version 4.4 server
sudo systemctl start mongod
sudo systemctl status mongod
Backup your data using mongodump
mkdir $HOME/Desktop/mongo-data
cd $HOME/Desktop/mongo-data
mongodump
Remove version 4.4
Stop mongod service
sudo systemctl stop mongod
sudo rm /tmp/mongodb-27017.sock
Delete data directory
rm -r /var/lib/mongodb
Remove version 4.4 and it's data
sudo apt purge mongodb-org
sudo apt autoremove
sudo rm /etc/mongod.conf
# Remove all mongo-org apt sources
sudo rm /etc/apt/sources.list.d/mongodb-org-*
Install version 5.0
Follow the instructions here mongodb v5.0 documentation
Run version 5.0 server
sudo systemctl start mongod
sudo systemctl status mongod
Restore your data using mongorestore
cd $HOME/Desktop/mongo-data
mongorestore
Congratulations! now you have your old data working on v5.0
I had the same problem and even with a clean new installation I was unable to upgrade from 4.4 to 5.0 without getting the exit code 62 EXIT_NEED_DOWNGRADE. Sad, but true.
Anyway, my solution was to back up the database (version 4.2) using mongodump, completely remove MongoDB from my system and then cleanly install it again, but in the latest version (6.0). Then I was able to restore the database using mongorestore without any problems.
The backup allowed me to skip an upgrade from 4.2 to 4.4, to 5.0 to 6.0, without any errors.

MongoDB-Community not starting on Mac and giving errors

I am writing to inform that i had installed mongodb-community some time back using brew (High Sierra) and it was running. Then recently i upgraded and it doesn't seem to wire up. When i am running mongo in terminal, I am getting error:
MongoDB shell version v4.4.0
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
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:362:17
#(connect):2:6
exception: connect failed
exiting with code 1
When i checked logs for starting the mongodb-community service, I am getting following error:
{"t":{"$date":"2020-09-04T21:01:35.015-07:00"},"s":"W", "c":"CONTROL", "id":20698, "ctx":"main","msg":"***** SERVER RESTARTED *****","tags":["startupWarnings"]}
{"t":{"$date":"2020-09-04T21:01:35.021-07:00"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2020-09-04T21:01:35.027-07:00"},"s":"W", "c":"ASIO", "id":22601, "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2020-09-04T21:01:35.027-07:00"},"s":"I", "c":"NETWORK", "id":4648602, "ctx":"main","msg":"Implicit TCP FastOpen in use."}
{"t":{"$date":"2020-09-04T21:01:35.028-07:00"},"s":"I", "c":"STORAGE", "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":58706,"port":27017,"dbPath":"/Users/my_username/homebrew/var/mongodb","architecture":"64-bit","host":"SC-*"}}
{"t":{"$date":"2020-09-04T21:01:35.029-07:00"},"s":"I", "c":"CONTROL", "id":23403, "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"4.4.0","gitVersion":"563487e100c4215e2dce98d0af2a6a5a2d67c5cf","modules":[],"allocator":"system","environment":{"distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2020-09-04T21:01:35.029-07:00"},"s":"I", "c":"CONTROL", "id":51765, "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Mac OS X","version":"17.7.0"}}}
{"t":{"$date":"2020-09-04T21:01:35.029-07:00"},"s":"I", "c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"config":"/Users/my_username/homebrew/etc/mongod.conf","net":{"bindIp":"127.0.0.1"},"storage":{"dbPath":"/Users/my_username/homebrew/var/mongodb"},"systemLog":{"destination":"file","logAppend":true,"path":"/Users/my_username/homebrew/var/log/mongodb/mongo.log"}}}}
{"t":{"$date":"2020-09-04T21:01:35.038-07:00"},"s":"I", "c":"STORAGE", "id":22270, "ctx":"initandlisten","msg":"Storage engine to use detected by data files","attr":{"dbpath":"/Users/my_username/homebrew/var/mongodb","storageEngine":"wiredTiger"}}
{"t":{"$date":"2020-09-04T21:01:35.038-07:00"},"s":"I", "c":"STORAGE", "id":22315, "ctx":"initandlisten","msg":"Opening WiredTiger","attr":{"config":"create,cache_size=7680M,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,compact_progress],"}}
{"t":{"$date":"2020-09-04T21:01:36.177-07:00"},"s":"W", "c":"STORAGE", "id":22347, "ctx":"initandlisten","msg":"Failed to start up WiredTiger under any compatibility version. This may be due to an unsupported upgrade or downgrade."}
{"t":{"$date":"2020-09-04T21:01:36.178-07:00"},"s":"F", "c":"STORAGE", "id":28595, "ctx":"initandlisten","msg":"Terminating.","attr":{"reason":"45: Operation not supported"}}
{"t":{"$date":"2020-09-04T21:01:36.178-07:00"},"s":"F", "c":"-", "id":23091, "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":28595,"file":"src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp","line":1100}}
{"t":{"$date":"2020-09-04T21:01:36.178-07:00"},"s":"F", "c":"-", "id":23092, "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}
Can i please seek your help in fixing this? I am not having sudo rights and can't upgrade the OS, but am open to use mongo using any method
similar issue, final worked solution:
uninstall (latest, but not worked version: 4.4.3)
brew uninstall mongodb-community
reinstall, old but worked 4.2.1
brew install mongodb-community#4.2
run
for now: brew services run mongodb-community#4.2
for now and set bootable: brew services start mongodb-community#4.2
check status
brew services
The log is telling you what is going on
"Failed to start up WiredTiger under any compatibility version. This may be due to an unsupported upgrade or downgrade."
So you may want to read documentation of your old mongoDB version to see if it is upgradeable to version 4.4.0, if it is not, consider upgrading to a most recent version that is compatible with the WiredTiger version you are currently using
This link might be useful. To upgrade to mongoDB v4.0 or above you must be running at least mongoDB v3.6, otherwise you will have to to upgrade to v3.6 first
uninstall mongodb
remove /var/lib/mongodb/ # because WiredTiger was not uninstalled cleanly
reinstall mongodb
Had same issue it occurred when my mongodb docker container restarted. What I did was remove mongod.lock its in the root folder where database data is stored.
Try the following steps:
first copy your database folder to be sure you have a backup.
then execute the following command:
mongod --dbpath /data/db --repair
check now if it works, if it still does not work
try to temporarily move the mongod.lock to some other location to test if the mongod.lock is causing the issue. Start mongodb and check if it works. If it does not you should downgrade.
To downgrade to the correct version you can do the following:
bsondump mongo/diagnostic.data/metrics.2021-10-06T08-41-05Z-00000 | jq -s '.[] | select(.type == {"$numberInt": "0"})| .doc.buildInfo.version'
Keep in mind that the metrics file can have a different date this is just an example.
After you have the version you can start your container with that specific version and it should work.

Mongodb 3.4 on 64bit Ubuntu 16.04 mongodb-27017.sock ERROR

There are a few posts related Mongodb 3.2, but when I attempted to install 3.4 the startup does not occur. Instead an unusual error appears in the log file (shown at the very end of the listing).
Is this perhaps because of an older version that was installed?
I did do an apt-get remove and purge.
Can anybody suggest why the error appears?
I followed the steps below, as outlined here,
$ sudo apt-get remove mongodb*
$ sudo apt-get purge mongodb*
$ sudo rm -rf /usr/lib/mongodb
$ sudo rm -rf /usr/log/mongodb
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
$ echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
$ sudo apt-get update
$ sudo apt-get install -y mongodb-org
..
..
E: There were unauthenticated packages and -y was used without --allow-unauthenticated
$ sudo apt-get install mongodb-org # removed -y to get it going
..
..
Setting up mongodb-org (3.4.2) ...
$ sudo chown -R mongodb:mongodb /var/log/mongodb
$ sudo chown -R mongodb:mongodb /var/lib/mongodb # modified ownership in view of what is stated on the mongodb installation note
$ # created the following file
$ cat /etc/systemd/system/mongod.service
[Unit]
Description=MongoDB Database Service 3.4
Wants=network.target
After=network.target
[Service]
User=mongodb
Group=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf
StandardOutput=syslog
StandardError=syslog
[Install]
WantedBy=multi-user.target
# startup
$ sudo systemctl daemon-reload
$ sudo service mongod start
# nothing happens, I then viewed the log file and the following error appears:
$ cat /var/log/mongodb/mongod.log
2017-02-08T22:08:26.155+0000 I CONTROL [main] ***** SERVER RESTARTED *****
2017-02-08T22:08:26.159+0000 I CONTROL [initandlisten] MongoDB starting : pid=11384 port=27017 dbpath=/var/lib/mongodb 64-bit host=12g
2017-02-08T22:08:26.159+0000 I CONTROL [initandlisten] db version v3.4.2
2017-02-08T22:08:26.159+0000 I CONTROL [initandlisten] git version: 3f76e40c105fc223b3e5aac3e20dcd026b83b38b
2017-02-08T22:08:26.159+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
2017-02-08T22:08:26.159+0000 I CONTROL [initandlisten] allocator: tcmalloc
2017-02-08T22:08:26.159+0000 I CONTROL [initandlisten] modules: none
2017-02-08T22:08:26.159+0000 I CONTROL [initandlisten] build environment:
2017-02-08T22:08:26.159+0000 I CONTROL [initandlisten] distmod: ubuntu1604
2017-02-08T22:08:26.159+0000 I CONTROL [initandlisten] distarch: x86_64
2017-02-08T22:08:26.159+0000 I CONTROL [initandlisten] target_arch: x86_64
2017-02-08T22:08:26.159+0000 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log", quiet: true } }
2017-02-08T22:08:26.178+0000 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock Operation not permitted
Failed to unlink socket file /tmp/mongodb-27017.sock Operation not permitted
That means the mongod process was started by root user.So you can just remove the sock file or run this command to fix this issue :
sudo chown `whoami` /tmp/mongodb-*.sock
Make sure that the port you assign needs to be accessible and not blocked by your firewall and then just restart the mongod process.
The waiting for connections message in the console output indicates
that the mongod.exe process is running successfully.
You can check out Install MongoDB Community Edition on Ubuntu.
Hope this helps.
#mcgraddy, thanks, that was helpful indeed. Creating the directory and copying the service file was the answer.
$ sudo cp /etc/systemd/system/mongod.service /etc/systemd/system/mongodb.service
$ sudo mkdir -p /data/db
$ sudo chown -R $USER:$USER /data
I had to change ownership for /data.
Starting the service and viewing status shows everything is running as expected:
$ sudo service mongod start
$ sudo systemctl status mongodb
● mongodb.service - MongoDB Database Service
Loaded: loaded (/etc/systemd/system/mongodb.service; enabled; vendor preset:
Active: active (running) since Thu 2017-02-09 13:26:07 GMT; 9min ago
Main PID: 1184 (mongod)
CGroup: /system.slice/mongodb.service
└─1184 /usr/bin/mongod --quiet --config /etc/mongod.conf
Feb 09 13:26:07 systemd[1]: Started MongoDB Database Service.