在无意的 mongo 版本升级后升级旧的 mongo 数据库 [英] Upgrading older mongo database after unintentional mongo version upgrade

查看:43
本文介绍了在无意的 mongo 版本升级后升级旧的 mongo 数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

mongodb 包被无意升级(3.4.9 -> 3.6.1)后,有没有办法升级mongo 数据库?

Is there any way to upgrade a mongo database after the mongodb package was unintentionally upgraded (3.4.9 -> 3.6.1)?

根据 mongo 文档,作为 先决条件 的升级,featureCompatibilityVersion 必须从 mongo cli 工具中设置,但是,它需要一个正在运行的 mongod 数据库守护进程,但是,如果 mongodb 包已经升级并且数据库没有设置 featureCompatibilityVersion 标志,它将不会运行.

According to the mongo docs, as a prerequisite of the upgrade, featureCompatibilityVersion has to be set from the mongo cli tool, which, however, needs a running mongod database daemon, which, however, won't run if mongodb package was already upgraded and the database was not set the featureCompatibilityVersion flag.

我在 ArchLinux 上,我在 IgnorePkg 中有 mongodb 但它的依赖项 boost-libswiredtiger 无论如何都升级了.pacman 缓存已经被清除,我自己编译了旧版本的包,但运行 mongodb 一直失败并出现此错误:

I'm on ArchLinux, I had mongodb in IgnorePkg but it's dependencies boost-libs and wiredtiger got upgraded anyways. Having pacman cache already wiped out, I compiled older versions of the packages myself, but running mongodb keeps failing with this error:

unsupported WiredTiger file version: this build  only supports major/minor versions up to 1/0,  and the file is version 2/0: WT_ERROR: non-specific WiredTiger error

我不知道这到底是什么意思(wiredtiger 有问题的版本是 2.9.3-1,升级后的版本是 2.9.3.20171205-2).

I don't have a clue what the hell this means (the problematic version of wiredtiger is 2.9.3-1, version after the upgrade is 2.9.3.20171205-2).

好像不能降级也不能升级...

Seems like I can neither downgrade nor upgrade...

其他 cli 工具(例如 mongodump)在没有正在运行的数据库的情况下也无法运行,是否还有其他可能性(某些 wiredtiger 相关工具)?删除数据库并重新开始不是一种选择.

Other cli tools (e.g. mongodump) also won't run without a running database, is there any other possibility (some wiredtiger related tool)? Deleting the database and starting afresh is not an option.

推荐答案

我通过在一个系统上安装旧版本的 mongodb 解决了这个问题,在这个系统上预打包它不是问题(嗯,Windows 10,即使官方声明该软件包适用于 Windows Server 2008),将数据库文件(/var/lib/mongodb 的内容)复制到那里,使用 --dbpath 运行它> param (mongod --dbpath/path/to/dbfiles),根据docs 最后将db文件复制回服务器.

I solved the problem by installing the older version of mongodb on a system for which it wasn't a problem to get it pre-packaged (well, Windows 10, even though oficially it's stated the package is for Windows Server 2008), copying the database files (contents of /var/lib/mongodb) there, running it with --dbpath param (mongod --dbpath /path/to/dbfiles), setting the compatibility flag according to the docs and finally copying the db files back to the server.

想知道更好的选择,但很高兴知道 db 文件很容易转移到另一个系统,甚至是另一个架构(尽管 db 相对简单和小).

Would like to know about a better option, but it's good to know the db files are easily transferable to another system, even another architecture (the db was relatively simple and small though).

这篇关于在无意的 mongo 版本升级后升级旧的 mongo 数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆