MongoDB和WiredTiger兼容性问题

问题描述

今天,我在Google Kubernetes Engine上运行的MongoDB容器突然停止工作,这是生成的日志:

2020-09-30T07:01:42.782+0000 I CONTROL [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=mongo-db-0
2020-09-30T07:01:42.782+0000 I CONTROL [initandlisten] db version v3.6.20
2020-09-30T07:01:42.782+0000 I CONTROL [initandlisten] git version: 39c200878284912f19553901a6fea4b31531a899
2020-09-30T07:01:42.782+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
2020-09-30T07:01:42.782+0000 I CONTROL [initandlisten] allocator: tcmalloc
2020-09-30T07:01:42.782+0000 I CONTROL [initandlisten] modules: none
2020-09-30T07:01:42.782+0000 I CONTROL [initandlisten] build environment:
2020-09-30T07:01:42.782+0000 I CONTROL [initandlisten] distmod: ubuntu1604
2020-09-30T07:01:42.782+0000 I CONTROL [initandlisten] distarch: x86_64
2020-09-30T07:01:42.782+0000 I CONTROL [initandlisten] target_arch: x86_64
2020-09-30T07:01:42.782+0000 I CONTROL [initandlisten] options: { net: { bindIpAll: true } }
2020-09-30T07:01:42.782+0000 I - [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine,so setting the active storage engine to 'wiredTiger'.
2020-09-30T07:01:42.783+0000 I STORAGE [initandlisten]
2020-09-30T07:01:42.783+0000 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2020-09-30T07:01:42.783+0000 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2020-09-30T07:01:42.783+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=334M,cache_overflow=(file_max=0M),session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),compatibility=(release="3.0",require_max="3.0"),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),2020-09-30T07:01:43.433+0000 E STORAGE [initandlisten] WiredTiger error (95) [1601449303:433554][1:0x7f9f6c49da40],wiredtiger_open: __wt_conn_compat_config,226: Version incompatibility detected: required max of 3.0cannot be larger than saved release 3.3: Operation not supported Raw: [1601449303:433554][1:0x7f9f6c49da40],226: Version incompatibility detected: required max of 3.0cannot be larger than saved release 3.3: Operation not supported
2020-09-30T07:01:43.434+0000 E - [initandlisten] Assertion: 28595:95: Operation not supported src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 488
2020-09-30T07:01:43.434+0000 I STORAGE [initandlisten] exception in initAndListen: Location28595: 95: Operation not supported,terminating
2020-09-30T07:01:43.434+0000 F - [initandlisten] Invariant failure globalStorageEngine src/mongo/db/service_context_d.cpp 272
2020-09-30T07:01:43.435+0000 F - [initandlisten]

我测试了较旧的Mongo容器版本,但是没有用。我以前曾遇到过此问题,可以完全擦除持久性存储来解决此问题,但是不幸的是,这次我无法做到这一点。

如何在不清除存储数据的情况下解决此兼容性问题?

解决方法

存储的WiredTiger版本3.3表示数据文件是由MongoDB版本4.2.6到4.2.8编写的。

其中一个版本应该能够打开那些文件。