当我升级 mongo 时,它仍然显示 version 2.x.x ,我该如何升级到更高版本? [英] when i upgrade mongo it still says version 2.x.x , how can i go to a higher version?

查看:50
本文介绍了当我升级 mongo 时,它仍然显示 version 2.x.x ,我该如何升级到更高版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从 mongo 版本 2 升级到版本 3?

我正在尝试从 mongo 2.x.x 升级到最新版本(当时是 3.2.x).

  1. 然后下载二进制文件,并将它们直接复制到/usr/bin/.

像这样:

$ curl https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1404-3.0.14.tgz -o mongo_3.0.14.tgz$ tar -xvf mongo_3.0.14.tgz$ sudo service mongod stop # 停止数据库$ sudo cp mongodb-linux-x86_64-ubuntu1404-3.0.14/bin/*/usr/bin$ sudo service mongod start # 并重启$ mongo --version

<块引用>

MongoDB shell 版本:3.0.14

成功!!

因此,正确的方法是遵循最初的说明 - 但是,起初我不清楚复制二进制文件"的含义,以及使用 apt-get 我真的认为这将是简单而正确的方法(为什么不工作??) - 我怀疑其他人会遇到这个问题,所以我将第三次尝试作为答案并仍然发布问题

How do I upgrade from mongo version 2 to version 3 ?

I am trying to upgrade from mongo 2.x.x to the latest version (which at the time is 3.2.x).

The official (3.2 upgrade) instructions say I need to go to version 3.0.x first and so that is all i'm trying to achieve right now - to get from version 2 to version 3.

First try : apt-get

I first tried using apt-get, following these instructions (linked to from this page, which was linked to from these official (3.0 upgrade) instructions).
That all appeared to work alright, however my version ($ mongo --version) number didn't change, so no upgrade actually happened at all.

Second try : mongod-10gen

I then found these instructions and followed them.
This time, again, every step was successful but the end result was that my version has now gone down! (from 2.6.1 to 2.4.14)

I've also tried following the instructions in this SO answer, which are essentially the same as the other instructions - and gave the same result - success on every step, but the final result is still a v2 mongo.

解决方案

Third try : copy the binaries

The official (3.0 upgrade) instructions actually first suggest downloading and copying over the binaries (but I tried the auto install instructions first because that seemed easier).

My binaries are all actually directly in /usr/bin/.

  1. Get the url for the binaries for your system (for the curl command below) from the download binaries page.
    (For me it was for Ubuntu 14, for previous release, v3.0.14)

  1. Then download the binaries, and copy them directly into /usr/bin/.

Like so:

$ curl https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1404-3.0.14.tgz -o mongo_3.0.14.tgz
$ tar -xvf mongo_3.0.14.tgz
$ sudo service mongod stop # stop DB
$ sudo cp mongodb-linux-x86_64-ubuntu1404-3.0.14/bin/* /usr/bin
$ sudo service mongod start # and restart
$ mongo --version 

MongoDB shell version: 3.0.14

Success!!

So, the correct approach was to follow the initial instructions - however it was not obvious to me what "copy the binaries" meant at first, and the alternative auto install with apt-get I really thought would be the simple and right way to go (why doesn't that work??) - I suspect others will come across this problem so I will put this third try as an answer and still post the question

这篇关于当我升级 mongo 时,它仍然显示 version 2.x.x ,我该如何升级到更高版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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