将Mongodb从3.2升级到3.6时出错
我需要在我的环境中将mongodb从3.2升级到3.6.对于此过程,我首先按照建议从3.2迁移到3.4.成功迁移到3.4之后,我开始迁移到3.6我无法启动mongod.当检查日志文件时,我发现如下错误: 重要信息:升级问题:数据文件需要完全升级到3.4版,然后再尝试升级到3.6;参见 http://dochub.mongodb.org/core/3.6-upgrade-fcv了解更多信息.
I needed to upgrade mongodb from 3.2 to 3.6 in my environment. For the process i first migrated from 3.2 to 3.4 as recommended. After successful migration to 3.4, i started migration to 3.6 i am not able to start mongod. When checked log file i found error like: IMPORTANT: UPGRADE PROBLEM: The data files need to be fully upgraded to version 3.4 before attempting an upgrade to 3.6; see http://dochub.mongodb.org/core/3.6-upgrade-fcv for more details.
MY Mongod.conf
MY Mongod.conf
systemLog: 目的地:文件 logAppend:true 路径:/var/log/mongodb/mongod.log
systemLog: destination: file logAppend: true path: /var/log/mongodb/mongod.log
存储: dbPath:/var/lib/mongo 杂志: 已启用:true
storage: dbPath: /var/lib/mongo journal: enabled: true
processManagement: fork:true#fork并在后台运行 pidFilePath:/var/run/mongodb/mongod.pid#pidfile的位置
processManagement: fork: true # fork and run in background pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
净额: 端口:27017 bindIp:127.0.0.1
net: port: 27017 bindIp: 127.0.0.1
我有类似的问题,我已经在 Ubuntu 16.04 上从MongoDB 3.4升级到3.6,但是我错过了这一重要步骤
I have similar problem, I've upgraded on Ubuntu 16.04 from MongoDB 3.4 to 3.6 but I missed this important step
db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )
然后,我必须降级为3.4,然后再次升级为3.6.这是详细步骤:
Then I must downgrade to 3.4 to do it and then upgrade to 3.6 again. Here is the detail steps:
1.卸载3.6
备份/etc/mongod.conf
备份/etc/apt/sources.list.d/mongodb-org-3.6.listed
(重命名或移动到另一个文件夹)
Backup /etc/mongod.conf
Backup /etc/apt/sources.list.d/mongodb-org-3.6.listed
(rename or move it to another folder)
sudo apt-get update
sudo apt-get remove mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
2.重新安装3.4
检查文件夹/etc/apt/sources.list.d/
以查看此文件是否存在:mongodb-org-3.4.list
.
如果不存在,则可以通过以下命令重新创建:
2. Re-install 3.4
Check folder /etc/apt/sources.list.d/
to see if this file exists or not: mongodb-org-3.4.list
.
If it does not exist, you can re-create by this command:
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
然后通过apt-get
sudo apt-get update
sudo apt-get install -y mongodb-org
mongod --version
sudo systemctl start mongod
在我的情况下,命令systemctl start mongod
返回错误Failed to start mongod.service: Unit mongod.service not found
我通过以下命令解决了:
In my case the command systemctl start mongod
return error Failed to start mongod.service: Unit mongod.service not found
I resolved by these commands:
sudo systemctl enable mongod
sudo service mongod restart
sudo service mongod status
3.执行非常重要的命令
降级到3.4后,运行此
3. Execute very important command
After downgrade to 3.4, run this
mongo
MongoDB shell version v3.4.10
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.10
> db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )
{ "featureCompatibilityVersion" : "3.4", "ok" : 1 }
> exit
4.再次升级3.6
恢复此文件/etc/apt/sources.list.d/mongodb-org-3.6.listed
4. Upgrade 3.6 again
Restore this file /etc/apt/sources.list.d/mongodb-org-3.6.listed
sudo apt-get update
sudo apt-get install mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
还原/etc/mongod.conf
.现在,MongoDB 3.6顺利启动了
Restore /etc/mongod.conf
. Now, MongoDB 3.6 started without any problem