Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
mongo_upgrade [2019/09/10 13:13] – andonovj | mongo_upgrade [2019/10/18 20:04] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | =====Overview===== | + | ======Overview====== |
- | Upgrading in mongo is performed | + | The upgrade of Mongo can be performed |
- | If you are like me and started with old release like 2.6, then you are screwed because you will have to pass through a lot of upgrades to reach the current one (4.3). | + | |
- | So let's get going: | + | |
- | =====Upgrade | + | * [[mongo_upgrade_binaries|Upgrade |
- | In order to upgrade from 2.6 to 4.3 we have to do the following: | + | |
+ | This method involves upgrading to binaries from one version to the other. It can be very exhaustive and repetative, if you are staring from old release. | ||
- | | + | |
- | - Upgrade datafiles: 3.2 -> 3.4 | + | |
- | - Upgrade Binaries: 3.4 -> 3.6 -> 4.0 -> 4.2 -> 4.3 | + | |
- | So let's get going: | + | This method |
- | + | ||
- | ====Upgrade to 3.0==== | + | |
- | The upgrades until 3.4 are so called " | + | |
- | + | ||
- | - Stop the server | + | |
- | - Modify the yum configuration file | + | |
- | - Upgrade the libraries | + | |
- | - Start the server | + | |
- | - Check the version | + | |
- | + | ||
- | ===Stop the server=== | + | |
- | As I mentioned, stopping of the server can be done gracefully or killfully. Let's do it killfully (not recommended though) | + | |
- | + | ||
- | <sxh bash> | + | |
- | [root@localhost yum.repos.d]# | + | |
- | root 5275 | + | |
- | root 6258 4382 0 07:35 pts/0 00:00:00 grep --color=auto mongo | + | |
- | [root@localhost yum.repos.d]# | + | |
- | [root@localhost yum.repos.d]# | + | |
- | root 6267 4382 0 07:35 pts/0 00:00:00 grep --color=auto mongo | + | |
- | </ | + | |
- | + | ||
- | ===Modify yum config file=== | + | |
- | In order to upgrade the libraries, we have to add new entry in the / | + | |
- | + | ||
- | <sxh bash> | + | |
- | ******************************* | + | |
- | [mongodb-org-3.0] | + | |
- | name=MongoDB Repository | + | |
- | baseurl=https:// | + | |
- | gpgcheck=1 | + | |
- | enabled=1 | + | |
- | gpgkey=https:// | + | |
- | </ | + | |
- | + | ||
- | Once it is added, we can upgrade to the new version: | + | |
- | + | ||
- | ===Upgrade the libraries=== | + | |
- | <sxh bash> | + | |
- | [root@localhost yum.repos.d]# | + | |
- | Loaded plugins: fastestmirror, | + | |
- | Loading mirror speeds from cached hostfile | + | |
- | * base: ftp.vectranet.pl | + | |
- | * extras: ftp.agh.edu.pl | + | |
- | * updates: ftp.man.poznan.pl | + | |
- | mongodb-org-2.6 | + | |
- | mongodb-org-3.0 | + | |
- | mongodb-org-3.0/ | + | |
- | ============================================================================================================ N/S matched: mongo ============================================================================================================= | + | |
- | google-noto-sans-mongolian-fonts.noarch : Sans Mongolian font | + | |
- | mongodb-org.x86_64 : MongoDB open source document-oriented database system (metapackage) | + | |
- | mongodb-org-mongos.x86_64 : MongoDB sharded cluster query router | + | |
- | mongodb-org-server.x86_64 : MongoDB database server | + | |
- | mongodb-org-shell.x86_64 : MongoDB shell client | + | |
- | mongodb-org-tools.x86_64 : MongoDB tools | + | |
- | autocorr-mn.noarch : Mongolian auto-correction rules | + | |
- | hunspell-mn.noarch : Mongolian hunspell dictionaries | + | |
- | hyphen-mn.noarch : Mongolian hyphenation rules | + | |
- | + | ||
- | Name and summary matches only, use " | + | |
- | [root@localhost yum.repos.d]# | + | |
- | Loaded plugins: fastestmirror, | + | |
- | Loading mirror speeds from cached hostfile | + | |
- | * base: ftp.vectranet.pl | + | |
- | * extras: ftp.agh.edu.pl | + | |
- | * updates: ftp.man.poznan.pl | + | |
- | Resolving Dependencies | + | |
- | --> Running transaction check | + | |
- | ---> Package mongodb-org-server.x86_64 0: | + | |
- | ---> Package mongodb-org-server.x86_64 0: | + | |
- | --> Finished Dependency Resolution | + | |
- | + | ||
- | Dependencies Resolved | + | |
- | + | ||
- | ============================================================================================================================================================================================================================================= | + | |
- | | + | |
- | ============================================================================================================================================================================================================================================= | + | |
- | Updating: | + | |
- | | + | |
- | + | ||
- | Transaction Summary | + | |
- | ============================================================================================================================================================================================================================================= | + | |
- | Upgrade | + | |
- | + | ||
- | Total download size: 13 M | + | |
- | Is this ok [y/d/N]: y | + | |
- | Downloading packages: | + | |
- | Delta RPMs disabled because / | + | |
- | warning: / | + | |
- | Public key for mongodb-org-server-3.0.22-1.el7.x86_64.rpm is not installed | + | |
- | mongodb-org-server-3.0.22-1.el7.x86_64.rpm | + | |
- | Retrieving key from https:// | + | |
- | Importing GPG key 0xEA312927: | + | |
- | | + | |
- | | + | |
- | | + | |
- | Is this ok [y/N]: y | + | |
- | Running transaction check | + | |
- | Running transaction test | + | |
- | Transaction test succeeded | + | |
- | Running transaction | + | |
- | Updating | + | |
- | Cleanup | + | |
- | Verifying | + | |
- | Verifying | + | |
- | + | ||
- | Updated: | + | |
- | mongodb-org-server.x86_64 0: | + | |
- | + | ||
- | Complete! | + | |
- | </ | + | |
- | + | ||
- | And voila, the mongo was upgraded from 2.6 -> 3.0. | + | |
- | Now, let's verify | + | |
- | + | ||
- | ===Start the server=== | + | |
- | <sxh bash> | + | |
- | [root@localhost yum.repos.d]# | + | |
- | about to fork child process, waiting until server is ready for connections. | + | |
- | forked process: 5275 | + | |
- | child process started successfully, | + | |
- | [root@localhost yum.repos.d]# | + | |
- | </ | + | |
- | + | ||
- | ===Check the version=== | + | |
- | <sxh bash> | + | |
- | [root@localhost yum.repos.d]# | + | |
- | MongoDB shell version: 3.0.15 | + | |
- | connecting to: 192.168.0.172: | + | |
- | Server has startup warnings: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | rs0: | + | |
- | ExampleDB | + | |
- | admin 0.078GB | + | |
- | local 2.077GB | + | |
- | test | + | |
- | rs0: | + | |
- | 3.0.22 <- Very happy | + | |
- | </ | + | |
- | + | ||
- | So let's continue then. | + | |
- | + | ||
- | + | ||
- | ====Upgrade to 3.2==== | + | |
- | One again: | + | |
- | + | ||
- | ===Stop the server=== | + | |
- | P.S. THIS ISN'T RECOMMENDED WAY TO STOP IT, please addess " | + | |
- | + | ||
- | <sxh bash> | + | |
- | [root@localhost yum.repos.d]# | + | |
- | root 5275 | + | |
- | root 6258 4382 0 07:35 pts/0 00:00:00 grep --color=auto mongo | + | |
- | [root@localhost yum.repos.d]# | + | |
- | [root@localhost yum.repos.d]# | + | |
- | root 6267 4382 0 07:35 pts/0 00:00:00 grep --color=auto mongo | + | |
- | </ | + | |
- | + | ||
- | ===Modify the yum config file=== | + | |
- | <sxh bash> | + | |
- | ************************************ | + | |
- | [mongodb-org-3.2] | + | |
- | name=MongoDB Repository | + | |
- | baseurl=https:// | + | |
- | gpgcheck=1 | + | |
- | enabled=1 | + | |
- | gpgkey=https:// | + | |
- | </ | + | |
- | + | ||
- | ===Upgrade the libraries=== | + | |
- | + | ||
- | <sxh bash> | + | |
- | [root@localhost yum.repos.d]# | + | |
- | Loaded plugins: fastestmirror, | + | |
- | Loading mirror speeds | + | |
- | * base: ftp.vectranet.pl | + | |
- | * extras: ftp.agh.edu.pl | + | |
- | * updates: ftp.man.poznan.pl | + | |
- | mongodb-org-3.0 | + | |
- | mongodb-org-3.2 | + | |
- | mongodb-org-3.2/ | + | |
- | ============================================================================================================ N/S matched: mongo ============================================================================================================= | + | |
- | google-noto-sans-mongolian-fonts.noarch : Sans Mongolian font | + | |
- | mongodb-org.x86_64 : MongoDB open source document-oriented database system | + | |
- | mongodb-org-mongos.x86_64 : MongoDB sharded cluster query router | + | |
- | mongodb-org-server.x86_64 : MongoDB database server | + | |
- | mongodb-org-shell.x86_64 : MongoDB shell client | + | |
- | mongodb-org-tools.x86_64 : MongoDB tools | + | |
- | autocorr-mn.noarch : Mongolian auto-correction rules | + | |
- | hunspell-mn.noarch : Mongolian hunspell dictionaries | + | |
- | hyphen-mn.noarch : Mongolian hyphenation rules | + | |
- | + | ||
- | Name and summary matches only, use " | + | |
- | [root@localhost yum.repos.d]# | + | |
- | Loaded plugins: fastestmirror, | + | |
- | Loading mirror speeds from cached hostfile | + | |
- | * base: ftp.vectranet.pl | + | |
- | * extras: ftp.agh.edu.pl | + | |
- | * updates: ftp.man.poznan.pl | + | |
- | Resolving Dependencies | + | |
- | --> Running transaction check | + | |
- | ---> Package mongodb-org-server.x86_64 0: | + | |
- | ---> Package mongodb-org-server.x86_64 0:3.2.22-1.el7 will be an update | + | |
- | --> Finished Dependency Resolution | + | |
- | + | ||
- | Dependencies Resolved | + | |
- | + | ||
- | ============================================================================================================================================================================================================================================= | + | |
- | | + | |
- | ============================================================================================================================================================================================================================================= | + | |
- | Updating: | + | |
- | | + | |
- | + | ||
- | Transaction Summary | + | |
- | ============================================================================================================================================================================================================================================= | + | |
- | Upgrade | + | |
- | + | ||
- | Total download size: 13 M | + | |
- | Is this ok [y/d/N]: y | + | |
- | Downloading packages: | + | |
- | Delta RPMs disabled because / | + | |
- | warning: / | + | |
- | Public key for mongodb-org-server-3.2.22-1.el7.x86_64.rpm is not installed | + | |
- | mongodb-org-server-3.2.22-1.el7.x86_64.rpm | + | |
- | Retrieving key from https:// | + | |
- | Importing GPG key 0xEA312927: | + | |
- | | + | |
- | | + | |
- | | + | |
- | Is this ok [y/N]: y | + | |
- | Running transaction check | + | |
- | Running transaction test | + | |
- | Transaction test succeeded | + | |
- | Running transaction | + | |
- | Updating | + | |
- | Cleanup | + | |
- | Verifying | + | |
- | Verifying | + | |
- | + | ||
- | Updated: | + | |
- | mongodb-org-server.x86_64 0: | + | |
- | + | ||
- | Complete! | + | |
- | </ | + | |
- | + | ||
- | ===Start the server=== | + | |
- | <sxh bash> | + | |
- | [root@localhost yum.repos.d]# | + | |
- | about to fork child process, waiting until server is ready for connections. | + | |
- | forked process: 6371 | + | |
- | child process started successfully, | + | |
- | </ | + | |
- | + | ||
- | ===Check the version=== | + | |
- | <sxh bash> | + | |
- | [root@localhost yum.repos.d]# | + | |
- | MongoDB shell version: 3.0.15 | + | |
- | connecting to: 192.168.0.172: | + | |
- | Server has startup warnings: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | rs0: | + | |
- | 3.2.22 | + | |
- | rs0: | + | |
- | </ | + | |
- | + | ||
- | ====Upgrade to 3.4==== | + | |
- | And again :) | + | |
- | + | ||
- | ===Shutdown server=== | + | |
- | <sxh bash> | + | |
- | [root@localhost yum.repos.d]# | + | |
- | root 6371 | + | |
- | root 6559 4382 0 07:39 pts/0 00:00:00 grep --color=auto mongo | + | |
- | [root@localhost yum.repos.d]# | + | |
- | [root@localhost yum.repos.d]# | + | |
- | root 6567 4382 0 07:39 pts/0 00:00:00 grep --color=auto mongo | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | ===Modify the yum config file=== | + | |
- | <sxh bash> | + | |
- | ************************************************************************** | + | |
- | [mongodb-org-3.4] | + | |
- | name=MongoDB Repository | + | |
- | baseurl=https:// | + | |
- | gpgcheck=1 | + | |
- | enabled=1 | + | |
- | gpgkey=https:// | + | |
- | </ | + | |
- | + | ||
- | ===Upgrade the libraries=== | + | |
- | + | ||
- | <sxh bash> | + | |
- | [root@localhost yum.repos.d]# | + | |
- | Loaded plugins: fastestmirror, | + | |
- | Loading mirror speeds from cached hostfile | + | |
- | * base: ftp.upjs.sk | + | |
- | * extras: ftp.upjs.sk | + | |
- | * updates: ftp.upjs.sk | + | |
- | mongodb-org-3.0 | + | |
- | mongodb-org-3.2 | + | |
- | mongodb-org-3.4 | + | |
- | mongodb-org-3.4/ | + | |
- | ============================================================================================================ N/S matched: mongo ============================================================================================================= | + | |
- | google-noto-sans-mongolian-fonts.noarch : Sans Mongolian font | + | |
- | mongodb-org.x86_64 : MongoDB open source document-oriented database system (metapackage) | + | |
- | mongodb-org-mongos.x86_64 : MongoDB sharded cluster query router | + | |
- | mongodb-org-server.x86_64 : MongoDB database server | + | |
- | mongodb-org-shell.x86_64 : MongoDB shell client | + | |
- | mongodb-org-tools.x86_64 : MongoDB tools | + | |
- | autocorr-mn.noarch : Mongolian auto-correction rules | + | |
- | hunspell-mn.noarch : Mongolian hunspell dictionaries | + | |
- | hyphen-mn.noarch : Mongolian hyphenation rules | + | |
- | + | ||
- | Name and summary matches only, use " | + | |
- | [root@localhost yum.repos.d]# | + | |
- | Loaded plugins: fastestmirror, | + | |
- | Loading mirror speeds from cached hostfile | + | |
- | * base: ftp.vectranet.pl | + | |
- | * extras: ftp.agh.edu.pl | + | |
- | * updates: ftp.man.poznan.pl | + | |
- | Resolving Dependencies | + | |
- | --> Running transaction check | + | |
- | ---> Package mongodb-org-server.x86_64 0: | + | |
- | ---> Package mongodb-org-server.x86_64 0: | + | |
- | --> Finished Dependency Resolution | + | |
- | + | ||
- | Dependencies Resolved | + | |
- | + | ||
- | ============================================================================================================================================================================================================================================= | + | |
- | | + | |
- | ============================================================================================================================================================================================================================================= | + | |
- | Updating: | + | |
- | | + | |
- | + | ||
- | Transaction Summary | + | |
- | ============================================================================================================================================================================================================================================= | + | |
- | Upgrade | + | |
- | + | ||
- | Total download size: 20 M | + | |
- | Is this ok [y/d/N]: y | + | |
- | Downloading packages: | + | |
- | Delta RPMs disabled because / | + | |
- | warning: / | + | |
- | Public key for mongodb-org-server-3.4.22-1.el7.x86_64.rpm is not installed | + | |
- | mongodb-org-server-3.4.22-1.el7.x86_64.rpm | + | |
- | Retrieving key from https:// | + | |
- | Importing GPG key 0xA15703C6: | + | |
- | | + | |
- | | + | |
- | | + | |
- | Is this ok [y/N]: y | + | |
- | Running transaction check | + | |
- | Running transaction test | + | |
- | Transaction test succeeded | + | |
- | Running transaction | + | |
- | Updating | + | |
- | Cleanup | + | |
- | Verifying | + | |
- | Verifying | + | |
- | + | ||
- | Updated: | + | |
- | mongodb-org-server.x86_64 0: | + | |
- | + | ||
- | Complete! | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | ===Start the server=== | + | |
- | <sxh bash> | + | |
- | [root@localhost yum.repos.d]# | + | |
- | about to fork child process, waiting until server is ready for connections. | + | |
- | forked process: 6649 | + | |
- | child process started successfully, | + | |
- | [root@localhost yum.repos.d]# | + | |
- | </ | + | |
- | + | ||
- | ===Verify the version=== | + | |
- | <sxh bash> | + | |
- | [root@localhost yum.repos.d]# | + | |
- | MongoDB shell version: 3.0.15 | + | |
- | connecting to: 192.168.0.172: | + | |
- | Server has startup warnings: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | rs0: | + | |
- | 3.4.22 | + | |
- | rs0: | + | |
- | </ | + | |
- | + | ||
- | Now I know that this was boring BUT, I wanted to reach at least up to 3.4 so I can show you what happens if you don't upgrade the datafiles as well. If you continue like that and upgrade to 3.6, without upgrading the datafiles, you will receive the following error: | + | |
- | + | ||
- | + | ||
- | <sxh bash> | + | |
- | [root@localhost yum.repos.d]# | + | |
- | about to fork child process, waiting until server is ready for connections. | + | |
- | forked process: 7100 | + | |
- | ERROR: child process failed, exited with error number 62 | + | |
- | </ | + | |
- | + | ||
- | That pretty much says, that there was a problem starting the server, but no what is THE PROBLEM :) You can find more info in the LOG file, whose location is configured in the main config file (e.g. / | + | |
- | + | ||
- | <sxh bash> | + | |
- | 2019-09-10T07: | + | |
- | 2019-09-10T07: | + | |
- | </ | + | |
- | + | ||
- | So in order to not encounter that (because if we encounter it we have to delete the 3.6, install 3.4 and do what we will do now :) ) | + | |
- | We have to upgrade also the datafiles | + | |
- | + | ||
- | ===Upgrade datafiles=== | + | |
- | It is done very easy. Just login on the server and execute: db.adminCommand( { setFeatureCompatibilityVersion: | + | |
- | + | ||
- | <sxh bash> | + | |
- | [root@localhost ~]# mongo | + | |
- | MongoDB shell version: 3.0.15 | + | |
- | connecting to: test | + | |
- | Server has startup warnings: | + | |
- | 2019-09-10T08: | + | |
- | 2019-09-10T08: | + | |
- | 2019-09-10T08: | + | |
- | 2019-09-10T08: | + | |
- | 2019-09-10T08: | + | |
- | 2019-09-10T08: | + | |
- | 2019-09-10T08: | + | |
- | 2019-09-10T08: | + | |
- | 2019-09-10T08: | + | |
- | 2019-09-10T08: | + | |
- | 2019-09-10T08: | + | |
- | 2019-09-10T08: | + | |
- | 2019-09-10T08: | + | |
- | 2019-09-10T08: | + | |
- | 2019-09-10T08: | + | |
- | 2019-09-10T08: | + | |
- | 2019-09-10T08: | + | |
- | 2019-09-10T08: | + | |
- | 2019-09-10T08: | + | |
- | 2019-09-10T08: | + | |
- | 2019-09-10T08: | + | |
- | > db.version() | + | |
- | 3.4.22 | + | |
- | > db.adminCommand( { setFeatureCompatibilityVersion: | + | |
- | { " | + | |
- | > | + | |
- | > | + | |
- | > | + | |
- | </ | + | |
- | + | ||
- | And that is that, so let's continue to 3.6 and then I will skip it till 4.3 :) | + | |