升级mongodb无效,仍显示旧版本 [英] Upgrading mongodb has no effect and still shows the old version
问题描述
以下是我用来将mongodb版本从2.6.9升级到最新版本的命令,但仍显示了以前的版本.让我知道升级过程中我做错了什么.问题是mongod -version
仍显示升级后安装的旧版本.
Following are the commands which I used to upgrade my mongodb version from 2.6.9 to latest, but its still showing me the previous version. Let me know what I am doing wrong with the upgrading process. The problem is that mongod -version
still shows the old version installed after upgrade.
我引用的文档- Mongodb文档
我遵循的步骤-
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
- 回声"deb http://repo.mongodb.org/apt/ubuntu " $ (lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee/etc/apt/sources.list.d/mongodb-org-3.0.list
- sudo apt-get更新
- sudo apt-get install -y mongodb-org
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
- echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
- sudo apt-get update
- sudo apt-get install -y mongodb-org
结果-
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
mongodb-org
1 upgraded, 0 newly installed, 0 to remove and 139 not upgraded.
Need to get 3,608 B of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://repo.mongodb.org/apt/ubuntu/ trusty/mongodb-org/3.0/multiverse mongodb-org amd64 3.0.2 [3,608 B]
Fetched 3,608 B in 0s (18.3 kB/s)
(Reading database ... 298790 files and directories currently installed.)
Preparing to unpack .../mongodb-org_3.0.2_amd64.deb ...
arg: upgrade
Unpacking mongodb-org (3.0.2) over (2.6.9) ...
Setting up mongodb-org (3.0.2) ...
此后,我重新启动了服务-sudo service mongod restart
After this I re started the service - sudo service mongod restart
但是它仍然向我显示版本2.6.9
让我知道我在这里做错了..或错过了任何步骤吗?
But still its showing me version 2.6.9
Let me know what I am doing wrong here..or missed any step ?
推荐答案
我处于完全相同的情况,遵循完全相同的步骤,并且遇到了相同的问题.
I'm in the exact same situation, followed the exact same steps, and had the same issue.
对我有用的是:
卸载:
sudo service mongod stop
sudo apt-get purge mongodb-org*
请勿删除数据目录-这样做会丢失所有数据.
Do NOT remove data directories - all your data will be lost if doing so.
注意:调用sudo apt-get purge mongodb-org*
会删除mongod.conf
文件.如果要在更新后保留此文件,请确保您创建该文件的备份副本并在安装新版本后使用它.
Note: Calling sudo apt-get purge mongodb-org*
deletes the mongod.conf
file. In case you want to keep this file after the update, make sure you create a backup copy of it and use it after the new version has been installed.
然后安装mongodb 与:
sudo apt-get install -y mongodb-org
这假设您已经按照声明执行了先前的安装步骤(导入公钥,创建列表文件,重新加载本地软件包数据库).
This assumes that you've already performed the previous installation steps (importing the public key, creating a list file, reloading local package database) as you've stated.
这篇关于升级mongodb无效,仍显示旧版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!