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

查看:241
本文介绍了意外升级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文档,以先决条件升级时,必须通过mongo cli工具设置featureCompatibilityVersion,但是该工具需要运行的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参数(mongod --dbpath /path/to/dbfiles)运行它,并根据文档,最后将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天全站免登陆