Unable to start mongodb as a service - Exception; Collection does not have UUID in KVCatalog
-
07-02-2021 - |
Domanda
I have installed Mongodb 4.2
and when running
sudo service mongod start|restart
It does not start the server and I have the log below in mongod.log file.
Exception in initAndListen: MustDowngrade: Collection does not have UUID in KVCatalog. Collection: local.startup_log, terminating
Here is more detail:
CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
CONTROL [initandlisten] MongoDB starting : pid=7434 port=27017 dbpath=/var/lib/mongodb 64-bit host=vm2851358555.bitcommand.com
CONTROL [initandlisten] db version v4.2.0
CONTROL [initandlisten] git version: a4b751dcf51dd249c5865812b390cfd1c0129c30
CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.0k 28 May 2019
CONTROL [initandlisten] allocator: tcmalloc
CONTROL [initandlisten] modules: none
CONTROL [initandlisten] build environment:
CONTROL [initandlisten] distmod: debian92
CONTROL [initandlisten] distarch: x86_64
CONTROL [initandlisten] target_arch: x86_64
CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, processManagement: { timeZoneInfo: "/usr/share/zoneinfo" }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
STORAGE [initandlisten] Detected data files in /var/lib/mongodb created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
STORAGE [initandlisten]
STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
STORAGE [initandlisten] wiredtiger_open config: create,cache_size=256M,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),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress],
STORAGE [initandlisten] WiredTiger message [1567525272:967263][7434:0x7fb79a56f140], txn-recover: Recovering log 16 through 17
STORAGE [initandlisten] WiredTiger message [1567525273:183321][7434:0x7fb79a56f140], txn-recover: Recovering log 17 through 17
STORAGE [initandlisten] WiredTiger message [1567525273:257888][7434:0x7fb79a56f140], txn-recover: Main recovery loop: starting at 16/768 to 17/256
STORAGE [initandlisten] WiredTiger message [1567525273:401263][7434:0x7fb79a56f140], txn-recover: Recovering log 16 through 17
STORAGE [initandlisten] WiredTiger message [1567525273:492743][7434:0x7fb79a56f140], txn-recover: Recovering log 17 through 17
STORAGE [initandlisten] WiredTiger message [1567525273:557051][7434:0x7fb79a56f140], txn-recover: Set global recovery timestamp: (0,0)
RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
STORAGE [initandlisten] WiredTigerKVEngine shutting down
STORAGE [initandlisten] Shutting down session sweeper thread
STORAGE [initandlisten] Finished shutting down session sweeper thread
STORAGE [initandlisten] Shutting down journal flusher thread
STORAGE [initandlisten] Finished shutting down journal flusher thread
STORAGE [initandlisten] Shutting down checkpoint thread
STORAGE [initandlisten] Finished shutting down checkpoint thread
STORAGE [initandlisten] Downgrading WiredTiger datafiles.
STORAGE [initandlisten] WiredTiger message [1567525275:122312][7434:0x7fb79a56f140], txn-recover: Recovering log 17 through 18
STORAGE [initandlisten] WiredTiger message [1567525275:243324][7434:0x7fb79a56f140], txn-recover: Recovering log 18 through 18
STORAGE [initandlisten] WiredTiger message [1567525275:351715][7434:0x7fb79a56f140], txn-recover: Main recovery loop: starting at 17/2944 to 18/256
STORAGE [initandlisten] WiredTiger message [1567525275:482006][7434:0x7fb79a56f140], txn-recover: Recovering log 17 through 18
STORAGE [initandlisten] WiredTiger message [1567525275:576281][7434:0x7fb79a56f140], txn-recover: Recovering log 18 through 18
STORAGE [initandlisten] WiredTiger message [1567525275:642376][7434:0x7fb79a56f140], txn-recover: Set global recovery timestamp: (0,0)
STORAGE [initandlisten] exception in initAndListen: MustDowngrade: Collection does not have UUID in KVCatalog. Collection: local.startup_log, terminating
NETWORK [initandlisten] shutdown: going to close listening sockets...
NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
- [initandlisten] Stopping further Flow Control ticket acquisitions.
CONTROL [initandlisten] now exiting
CONTROL [initandlisten] shutting down with code:100
How can I fix it?
Soluzione
The problem can be solved by:
- Backing-up all the databases (using
mongodump
) - Removing every file in
/data/db
, due to their incompatibility with the newer version:rm -rf /data/db/*
- Restarting the MongoDB service
- Restoring all the databases (using
mongorestore
)
Altri suggerimenti
I have met similiar problem with admin db, when upgrade from old mongodb 3.4 to 4.2.
Solution is to mongodump all dbs and delete /var/lib/mongodb, then mongorestore all dbs back.
STORAGE [initandlisten] exception in initAndListen: MustDowngrade: Collection does not have UUID in KVCatalog. Collection: admin.system.users, terminating
2019-09-24T21:59:55.274+0000 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2019-09-24T21:59:55.274+0000 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2019-09-24T21:59:55.274+0000 I - [initandlisten] Stopping further Flow Control ticket acquisitions.
2019-09-24T21:59:55.274+0000 I CONTROL [initandlisten] now exiting
2019-09-24T21:59:55.274+0000 I CONTROL [initandlisten] shutting down with code:100
The cause of problem: mongodb 4.2 will add userId with UUID value in system.user collection. Hope this will help.
When upgrading another mongo db, I met the exact same problem as yours on startup_log, it seems I did not stop the mongodb when delete the /var/lib/mongodb folder, after stop mongod and delete the /var/lib/mongodb and upgrade to 4.2, error goes away.
A bug report on this issue recommended following the full upgrade path and that worked for me. I was able to go back to my old version (3.4) when I ran into this error, and then upgrade one step at a time properly.
Specifically: upgrade just one major version at a time and check the prerequisites and upgrade steps carefully. The most important part of this is checking your compatibility with db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )
and make sure it matches the current version before upgrading to the next version. Update it with db.adminCommand( { setFeatureCompatibilityVersion: "3.6" } )
Read the full docs at pages like https://docs.mongodb.com/manual/release-notes/3.6/#upgrade-procedures https://docs.mongodb.com/manual/release-notes/4.0/#upgrade-procedures etc