Upgraded MongoDb to 3.4.3 but mongod --version still shows 3.2.1

时间:2017-04-08 22:36:12

标签: mongodb ubuntu ubuntu-16.04

I have upgraded my MongoDB community version to 3.4.3

When i run sudo apt-get install -y mongodb-org

i get

Reading package lists... Done
Building dependency tree
Reading state information... Done
mongodb-org is already the newest version (3.4.3).

but when i run mongod --version

i get

db version v3.2.11
git version: 009580ad490190ba33d1c6253ebd8d91808923e4
OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
allocator: tcmalloc
modules: none
build environment:
    distmod: ubuntu1604
    distarch: x86_64
    target_arch: x86_64

Edit

I ran apt-file list mongodb-server and I got result

Update(Temp Solution)

I decided to download v3.4.3 binaries using tarball

mkdir ~/bin && cd ~/bin
curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.4.3.tgz
tar -zxvf mongodb-linux-x86_64-3.4.3.tgz
mv ./mongodb-linux-x86_64-3.4.3 ./mongodb
rm mongodb-linux-x86_64-3.4.3.tgz

updated the mongod.service file by replacing /usr/bin/mongod to ~/bin/mongodb/bin/mongod

reloaded the systemctl daemon and restarted the service

2 个答案:

答案 0 :(得分:1)

我认为这不是一个正确的解决方案,但我昨天确实遇到了同样的问题,我解决了这个问题

  1. sudo apt-get install -y mongodb(这回到db版本v2.6.10)
  2. sudo apt-get install -y mongodb-org(这确实安装了db版本v3.4.3)
  3. 并重启服务(sudo service mongod restart)

    我希望这可以帮到你!

    此致

答案 1 :(得分:0)

检查sources.list所在的mongodb-server。官方包mongodb-org应来自http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse

备份您的配置,并强制重新安装:sudo apt-get --reinstall install -y mongodb-org