mongo_upgrade

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
mongo_upgrade [2019/09/10 19:05] – [Upgrade to 4.0] andonovjmongo_upgrade [2019/10/18 20:04] (current) – external edit 127.0.0.1
Line 1: Line 1:
-=====Overview===== +======Overview====== 
-Upgrading in mongo is performed depending on the starting point. +The upgrade of Mongo can be performed in several waysbut in general there are 2 ways:
-If you are like me and started with old release like 2.6then 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 from 2.6 to 4.3===== +  * [[mongo_upgrade_binaries|Upgrade binaries]]
-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 binaries: 2.6 -> 3.0 -> 3.2 -> 3.4  +  * [[mongo_upgrade_logical|Migrate to newer version]]
-  - 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 is way better if you are staring from old release (e.g. 2.6). In nutshell, you will perform a logical export and import into the newer release. However there are some limitations to that method.
- +
-====Upgrade to 3.0==== +
-The upgrades until 3.4 are so called "drop-in" upgrades. Meaning exactly that: +
- +
-  - 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]# ps -ef | grep mongo +
-root      5275      0 07:20 ?        00:00:02 /bin/mongod -f /etc/mongod.conf --fork +
-root      6258  4382  0 07:35 pts/0    00:00:00 grep --color=auto mongo +
-[root@localhost yum.repos.d]# kill -9 5275 +
-[root@localhost yum.repos.d]# ps -ef | grep mongo +
-root      6267  4382  0 07:35 pts/0    00:00:00 grep --color=auto mongo +
-</sxh> +
- +
-===Modify yum config file=== +
-In order to upgrade the libraries, we have to add new entry in the /etc/yum.repod.d/mongodb.conf for the new repository: +
- +
-<sxh bash> +
-******************************* +
-[mongodb-org-3.0] +
-name=MongoDB Repository +
-baseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/3.0/x86_64/ +
-gpgcheck=1 +
-enabled=1 +
-gpgkey=https://www.mongodb.org/static/pgp/server-3.0.asc +
-</sxh> +
- +
-Once it is added, we can upgrade to the new version: +
- +
-===Upgrade the libraries=== +
-<sxh bash> +
-[root@localhost yum.repos.d]# yum search mongo +
-Loaded plugins: fastestmirror, langpacks +
-Loading mirror speeds from cached hostfile +
- * base: ftp.vectranet.pl +
- * extras: ftp.agh.edu.pl +
- * updates: ftp.man.poznan.pl +
-mongodb-org-2.6                                                                                                                                                                                                       | 2.5 kB  00:00:00 +
-mongodb-org-3.0                                                                                                                                                                                                       | 2.5 kB  00:00:00 +
-mongodb-org-3.0/primary_db                                                                                                                                                                                            |  94 kB  00:00:00 +
-============================================================================================================ 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 "search all" for everything. +
-[root@localhost yum.repos.d]# yum install mongodb-org-server.x86_64 +
-Loaded plugins: fastestmirror, langpacks +
-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:2.6.15-1.el7 will be updated +
----> Package mongodb-org-server.x86_64 0:3.0.22-1.el7 will be an update +
---> Finished Dependency Resolution +
- +
-Dependencies Resolved +
- +
-============================================================================================================================================================================================================================================= +
- Package                                                       Arch                                              Version                                                    Repository                                                  Size +
-============================================================================================================================================================================================================================================= +
-Updating: +
- mongodb-org-server                                            x86_64                                            3.0.22-1.el7                                               mongodb-org-3.0                                             13 M +
- +
-Transaction Summary +
-============================================================================================================================================================================================================================================= +
-Upgrade  1 Package +
- +
-Total download size: 13 M +
-Is this ok [y/d/N]: y +
-Downloading packages: +
-Delta RPMs disabled because /usr/bin/applydeltarpm not installed. +
-warning: /var/cache/yum/x86_64/7/mongodb-org-3.0/packages/mongodb-org-server-3.0.22-1.el7.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID ea312927: NOKEY=============================                    ] 8.4 MB/s | 9.9 MB  00:00:00 ETA +
-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                                                                                                                                                                            |  13 MB  00:00:01 +
-Retrieving key from https://www.mongodb.org/static/pgp/server-3.0.asc +
-Importing GPG key 0xEA312927: +
- Userid     : "MongoDB 3.0 Release Signing Key <[email protected]>" +
- Fingerprint: 42f3 e95a 2c4f 0827 9c49 60ad d68f a50f ea31 2927 +
- From       : https://www.mongodb.org/static/pgp/server-3.0.asc +
-Is this ok [y/N]: y +
-Running transaction check +
-Running transaction test +
-Transaction test succeeded +
-Running transaction +
-  Updating   : mongodb-org-server-3.0.22-1.el7.x86_64                                                                                                                                                                                    1/2 +
-  Cleanup    : mongodb-org-server-2.6.15-1.el7.x86_64                                                                                                                                                                                    2/2 +
-  Verifying  : mongodb-org-server-3.0.22-1.el7.x86_64                                                                                                                                                                                    1/2 +
-  Verifying  : mongodb-org-server-2.6.15-1.el7.x86_64                                                                                                                                                                                    2/2 +
- +
-Updated: +
-  mongodb-org-server.x86_64 0:3.0.22-1.el7 +
- +
-Complete! +
-</sxh> +
- +
-And voila, the mongo was upgraded from 2.6 -> 3.0.  +
-Now, let's verify if all was fine with the upgrade: +
- +
-===Start the server=== +
-<sxh bash> +
-[root@localhost yum.repos.d]# /bin/mongod -f /etc/mongod.conf --fork +
-about to fork child process, waiting until server is ready for connections. +
-forked process: 5275 +
-child process started successfully, parent exiting +
-[root@localhost yum.repos.d]# +
-</sxh> +
- +
-===Check the version=== +
-<sxh bash> +
-[root@localhost yum.repos.d]# mongo 192.168.0.172:27017 +
-MongoDB shell version: 3.0.15 +
-connecting to: 192.168.0.172:27017/test +
-Server has startup warnings: +
-2019-09-10T07:20:25.663-0400 I STORAGE  [initandlisten] +
-2019-09-10T07:20:25.663-0400 I STORAGE  [initandlisten] ** WARNING: Readahead for /var/lib/mongo is set to 4096KB +
-2019-09-10T07:20:25.663-0400 I STORAGE  [initandlisten] **          We suggest setting it to 256KB (512 sectors) or less +
-2019-09-10T07:20:25.663-0400 I STORAGE  [initandlisten] **          http://dochub.mongodb.org/core/readahead +
-2019-09-10T07:20:25.958-0400 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended. +
-2019-09-10T07:20:25.958-0400 I CONTROL  [initandlisten] +
-2019-09-10T07:20:25.958-0400 I CONTROL  [initandlisten] +
-2019-09-10T07:20:25.958-0400 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'+
-2019-09-10T07:20:25.958-0400 I CONTROL  [initandlisten] **        We suggest setting it to 'never' +
-2019-09-10T07:20:25.958-0400 I CONTROL  [initandlisten] +
-2019-09-10T07:20:25.958-0400 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'+
-2019-09-10T07:20:25.958-0400 I CONTROL  [initandlisten] **        We suggest setting it to 'never' +
-2019-09-10T07:20:25.958-0400 I CONTROL  [initandlisten] +
-rs0:PRIMARY> show dbs +
-ExampleDB  0.078GB +
-admin      0.078GB +
-local      2.077GB +
-test       0.078GB +
-rs0:PRIMARY> db.version() +
-3.0.22 <- Very happy +
-</sxh> +
- +
-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 "Stopping/Starting" section in the chapter for better way. I do it like that to save time, since I will need to change the IP and use localhost and bla bla bla... +
- +
-<sxh bash> +
-[root@localhost yum.repos.d]# ps -ef | grep mongo +
-root      5275      0 07:20 ?        00:00:02 /bin/mongod -f /etc/mongod.conf --fork +
-root      6258  4382  0 07:35 pts/0    00:00:00 grep --color=auto mongo +
-[root@localhost yum.repos.d]# kill -9 5275 +
-[root@localhost yum.repos.d]# ps -ef | grep mongo +
-root      6267  4382  0 07:35 pts/0    00:00:00 grep --color=auto mongo +
-</sxh> +
- +
-===Modify the yum config file=== +
-<sxh bash> +
-************************************ +
-[mongodb-org-3.2] +
-name=MongoDB Repository +
-baseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/3.2/x86_64/ +
-gpgcheck=1 +
-enabled=1 +
-gpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc +
-</sxh> +
- +
-===Upgrade the libraries=== +
- +
-<sxh bash> +
-[root@localhost yum.repos.d]# yum search mongo +
-Loaded plugins: fastestmirror, langpacks +
-Loading mirror speeds from cached hostfile +
- * base: ftp.vectranet.pl +
- * extras: ftp.agh.edu.pl +
- * updates: ftp.man.poznan.pl +
-mongodb-org-3.0                                                                                                                                                                                                       | 2.5 kB  00:00:00 +
-mongodb-org-3.2                                                                                                                                                                                                       | 2.5 kB  00:00:00 +
-mongodb-org-3.2/primary_db                                                                                                                                                                                            |  94 kB  00:00:00 +
-============================================================================================================ 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 "search all" for everything. +
-[root@localhost yum.repos.d]# yum install mongodb-org-server.x86_64 +
-Loaded plugins: fastestmirror, langpacks +
-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:3.0.15-1.el7 will be updated +
----> Package mongodb-org-server.x86_64 0:3.2.22-1.el7 will be an update +
---> Finished Dependency Resolution +
- +
-Dependencies Resolved +
- +
-============================================================================================================================================================================================================================================= +
- Package                                                       Arch                                              Version                                                    Repository                                                  Size +
-============================================================================================================================================================================================================================================= +
-Updating: +
- mongodb-org-server                                            x86_64                                            3.2.22-1.el7                                               mongodb-org-3.2                                             13 M +
- +
-Transaction Summary +
-============================================================================================================================================================================================================================================= +
-Upgrade  1 Package +
- +
-Total download size: 13 M +
-Is this ok [y/d/N]: y +
-Downloading packages: +
-Delta RPMs disabled because /usr/bin/applydeltarpm not installed. +
-warning: /var/cache/yum/x86_64/7/mongodb-org-3.2/packages/mongodb-org-server-3.2.22-1.el7.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID ea312927: NOKEY=============================                    ] 8.4 MB/s | 9.9 MB  00:00:00 ETA +
-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                                                                                                                                                                            |  13 MB  00:00:01 +
-Retrieving key from https://www.mongodb.org/static/pgp/server-3.2.asc +
-Importing GPG key 0xEA312927: +
- Userid     : "MongoDB 3.2 Release Signing Key <[email protected]>" +
- Fingerprint: 42f3 e95a 2c4f 0827 9c49 60ad d68f a50f ea31 2927 +
- From       : https://www.mongodb.org/static/pgp/server-3.2.asc +
-Is this ok [y/N]: y +
-Running transaction check +
-Running transaction test +
-Transaction test succeeded +
-Running transaction +
-  Updating   : mongodb-org-server-3.2.22-1.el7.x86_64                                                                                                                                                                                    1/2 +
-  Cleanup    : mongodb-org-server-3.0.15-1.el7.x86_64                                                                                                                                                                                    2/2 +
-  Verifying  : mongodb-org-server-3.2.22-1.el7.x86_64                                                                                                                                                                                    1/2 +
-  Verifying  : mongodb-org-server-3.0.15-1.el7.x86_64                                                                                                                                                                                    2/2 +
- +
-Updated: +
-  mongodb-org-server.x86_64 0:3.2.22-1.el7 +
- +
-Complete! +
-</sxh> +
- +
-===Start the server=== +
-<sxh bash> +
-[root@localhost yum.repos.d]# /bin/mongod -f /etc/mongod.conf --fork +
-about to fork child process, waiting until server is ready for connections. +
-forked process: 6371 +
-child process started successfully, parent exiting +
-</sxh> +
- +
-===Check the version=== +
-<sxh bash> +
-[root@localhost yum.repos.d]# mongo 192.168.0.172:27017 +
-MongoDB shell version: 3.0.15 +
-connecting to: 192.168.0.172:27017/test +
-Server has startup warnings: +
-2019-09-10T07:37:19.381-0400 I STORAGE  [initandlisten] +
-2019-09-10T07:37:19.381-0400 I STORAGE  [initandlisten] ** WARNING: Readahead for /var/lib/mongo is set to 4096KB +
-2019-09-10T07:37:19.381-0400 I STORAGE  [initandlisten] **          We suggest setting it to 256KB (512 sectors) or less +
-2019-09-10T07:37:19.381-0400 I STORAGE  [initandlisten] **          http://dochub.mongodb.org/core/readahead +
-2019-09-10T07:37:19.548-0400 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended. +
-2019-09-10T07:37:19.548-0400 I CONTROL  [initandlisten] +
-2019-09-10T07:37:19.548-0400 I CONTROL  [initandlisten] +
-2019-09-10T07:37:19.548-0400 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'+
-2019-09-10T07:37:19.548-0400 I CONTROL  [initandlisten] **        We suggest setting it to 'never' +
-2019-09-10T07:37:19.548-0400 I CONTROL  [initandlisten] +
-2019-09-10T07:37:19.548-0400 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'+
-2019-09-10T07:37:19.548-0400 I CONTROL  [initandlisten] **        We suggest setting it to 'never' +
-2019-09-10T07:37:19.548-0400 I CONTROL  [initandlisten] +
-rs0:PRIMARY> db.version() +
-3.2.22 +
-rs0:PRIMARY> +
-</sxh> +
- +
-====Upgrade to 3.4==== +
-And again :) +
- +
-===Shutdown server=== +
-<sxh bash> +
-[root@localhost yum.repos.d]# ps -ef | grep mongo +
-root      6371      0 07:37 ?        00:00:00 /bin/mongod -f /etc/mongod.conf --fork +
-root      6559  4382  0 07:39 pts/0    00:00:00 grep --color=auto mongo +
-[root@localhost yum.repos.d]# kill -9 6371 +
-[root@localhost yum.repos.d]# ps -ef | grep mongo +
-root      6567  4382  0 07:39 pts/0    00:00:00 grep --color=auto mongo +
-</sxh> +
- +
- +
-===Modify the yum config file=== +
-<sxh bash> +
-************************************************************************** +
-[mongodb-org-3.4] +
-name=MongoDB Repository +
-baseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/3.4/x86_64/ +
-gpgcheck=1 +
-enabled=1 +
-gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc +
-</sxh> +
- +
-===Upgrade the libraries=== +
- +
-<sxh bash> +
-[root@localhost yum.repos.d]# yum search mongo +
-Loaded plugins: fastestmirror, langpacks +
-Loading mirror speeds from cached hostfile +
- * base: ftp.upjs.sk +
- * extras: ftp.upjs.sk +
- * updates: ftp.upjs.sk +
-mongodb-org-3.0                                                                                                                                                                                                       | 2.5 kB  00:00:00 +
-mongodb-org-3.2                                                                                                                                                                                                       | 2.5 kB  00:00:00 +
-mongodb-org-3.4                                                                                                                                                                                                       | 2.5 kB  00:00:00 +
-mongodb-org-3.4/primary_db                                                                                                                                                                                            |  92 kB  00:00:00 +
-============================================================================================================ 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 "search all" for everything. +
-[root@localhost yum.repos.d]# yum install mongodb-org-server.x86_64 +
-Loaded plugins: fastestmirror, langpacks +
-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:3.2.22-1.el7 will be updated +
----> Package mongodb-org-server.x86_64 0:3.4.22-1.el7 will be an update +
---> Finished Dependency Resolution +
- +
-Dependencies Resolved +
- +
-============================================================================================================================================================================================================================================= +
- Package                                                       Arch                                              Version                                                    Repository                                                  Size +
-============================================================================================================================================================================================================================================= +
-Updating: +
- mongodb-org-server                                            x86_64                                            3.4.22-1.el7                                               mongodb-org-3.4                                             20 M +
- +
-Transaction Summary +
-============================================================================================================================================================================================================================================= +
-Upgrade  1 Package +
- +
-Total download size: 20 M +
-Is this ok [y/d/N]: y +
-Downloading packages: +
-Delta RPMs disabled because /usr/bin/applydeltarpm not installed. +
-warning: /var/cache/yum/x86_64/7/mongodb-org-3.4/packages/mongodb-org-server-3.4.22-1.el7.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID a15703c6: NOKEY===========================                      ] 9.2 MB/s |  15 MB  00:00:00 ETA +
-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                                                                                                                                                                            |  20 MB  00:00:01 +
-Retrieving key from https://www.mongodb.org/static/pgp/server-3.4.asc +
-Importing GPG key 0xA15703C6: +
- Userid     : "MongoDB 3.4 Release Signing Key <[email protected]>" +
- Fingerprint: 0c49 f373 0359 a145 1858 5931 bc71 1f9b a157 03c6 +
- From       : https://www.mongodb.org/static/pgp/server-3.4.asc +
-Is this ok [y/N]: y +
-Running transaction check +
-Running transaction test +
-Transaction test succeeded +
-Running transaction +
-  Updating   : mongodb-org-server-3.4.22-1.el7.x86_64                                                                                                                                                                                    1/2 +
-  Cleanup    : mongodb-org-server-3.2.22-1.el7.x86_64                                                                                                                                                                                    2/2 +
-  Verifying  : mongodb-org-server-3.4.22-1.el7.x86_64                                                                                                                                                                                    1/2 +
-  Verifying  : mongodb-org-server-3.2.22-1.el7.x86_64                                                                                                                                                                                    2/2 +
- +
-Updated: +
-  mongodb-org-server.x86_64 0:3.4.22-1.el7 +
- +
-Complete! +
-</sxh> +
- +
- +
-===Start the server=== +
-<sxh bash> +
-[root@localhost yum.repos.d]# /bin/mongod -f /etc/mongod.conf --fork +
-about to fork child process, waiting until server is ready for connections. +
-forked process: 6649 +
-child process started successfully, parent exiting +
-[root@localhost yum.repos.d]# +
-</sxh>  +
- +
-===Verify the version=== +
-<sxh bash> +
-[root@localhost yum.repos.d]# mongo 192.168.0.172:27017 +
-MongoDB shell version: 3.0.15 +
-connecting to: 192.168.0.172:27017/test +
-Server has startup warnings: +
-2019-09-10T07:40:08.027-0400 I STORAGE  [initandlisten] +
-2019-09-10T07:40:08.027-0400 I STORAGE  [initandlisten] ** WARNING: Readahead for /var/lib/mongo is set to 4096KB +
-2019-09-10T07:40:08.027-0400 I STORAGE  [initandlisten] **          We suggest setting it to 256KB (512 sectors) or less +
-2019-09-10T07:40:08.027-0400 I STORAGE  [initandlisten] **          http://dochub.mongodb.org/core/readahead +
-2019-09-10T07:40:08.217-0400 I CONTROL  [initandlisten] +
-2019-09-10T07:40:08.217-0400 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database. +
-2019-09-10T07:40:08.217-0400 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted. +
-2019-09-10T07:40:08.217-0400 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended. +
-2019-09-10T07:40:08.217-0400 I CONTROL  [initandlisten] +
-2019-09-10T07:40:08.217-0400 I CONTROL  [initandlisten] +
-2019-09-10T07:40:08.217-0400 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'+
-2019-09-10T07:40:08.217-0400 I CONTROL  [initandlisten] **        We suggest setting it to 'never' +
-2019-09-10T07:40:08.217-0400 I CONTROL  [initandlisten] +
-2019-09-10T07:40:08.217-0400 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'+
-2019-09-10T07:40:08.217-0400 I CONTROL  [initandlisten] **        We suggest setting it to 'never' +
-2019-09-10T07:40:08.217-0400 I CONTROL  [initandlisten] +
-rs0:PRIMARY> db.version() +
-3.4.22 +
-rs0:PRIMARY> +
-</sxh> +
- +
-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]# /bin/mongod -f /etc/mongod.conf +
-about to fork child process, waiting until server is ready for connections. +
-forked process: 7100 +
-ERROR: child process failed, exited with error number 62 +
-</sxh> +
- +
-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. /etc/mongod.conf) +
- +
-<sxh bash> +
-2019-09-10T07:46:43.617-0400 F CONTROL  [initandlisten] ** 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. +
-2019-09-10T07:46:43.617-0400 I NETWORK  [initandlisten] shutdown: going to close listening sockets... +
-</sxh> +
- +
-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 easyJust login on the server and execute: db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } ) +
- +
-<sxh bash> +
-[root@localhost ~]# mongo +
-MongoDB shell version: 3.0.15 +
-connecting to: test +
-Server has startup warnings: +
-2019-09-10T08:00:51.610-0400 I STORAGE  [initandlisten] +
-2019-09-10T08:00:51.610-0400 I STORAGE  [initandlisten] ** WARNING: Readahead for /var/lib/mongo is set to 4096KB +
-2019-09-10T08:00:51.610-0400 I STORAGE  [initandlisten] **          We suggest setting it to 256KB (512 sectors) or less +
-2019-09-10T08:00:51.610-0400 I STORAGE  [initandlisten] **          http://dochub.mongodb.org/core/readahead +
-2019-09-10T08:00:51.762-0400 I CONTROL  [initandlisten] +
-2019-09-10T08:00:51.762-0400 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database. +
-2019-09-10T08:00:51.762-0400 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted. +
-2019-09-10T08:00:51.762-0400 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root userwhich is not recommended. +
-2019-09-10T08:00:51.762-0400 I CONTROL  [initandlisten] +
-2019-09-10T08:00:51.763-0400 I CONTROL  [initandlisten] +
-2019-09-10T08:00:51.763-0400 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'+
-2019-09-10T08:00:51.763-0400 I CONTROL  [initandlisten] **        We suggest setting it to 'never' +
-2019-09-10T08:00:51.763-0400 I CONTROL  [initandlisten] +
-2019-09-10T08:00:51.763-0400 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'+
-2019-09-10T08:00:51.763-0400 I CONTROL  [initandlisten] **        We suggest setting it to 'never' +
-2019-09-10T08:00:51.763-0400 I CONTROL  [initandlisten] +
-2019-09-10T08:00:52.101-0400 I STORAGE  [initandlisten] +
-2019-09-10T08:00:52.101-0400 I STORAGE  [initandlisten] ** WARNING: mongod started without --replSet yet 1 documents are present in local.system.replset +
-2019-09-10T08:00:52.101-0400 I STORAGE  [initandlisten] **          Restart with --replSet unless you are doing maintenance and  no other clients are connected. +
-2019-09-10T08:00:52.101-0400 I STORAGE  [initandlisten] **          The TTL collection monitor will not start because of this. +
-2019-09-10T08:00:52.101-0400 I STORAGE  [initandlisten] +
-> db.version() +
-3.4.22 +
-> db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } ) +
-{ "ok" : 1 } +
-+
-+
-+
-</sxh> +
- +
-You can verify which is the current version of the datafiles using the following command: +
- +
-<sxh bash> +
-> db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } ) +
-{ "featureCompatibilityVersion" : "3.4", "ok" : 1 } +
-</sxh> +
- +
-And that is that, so let's continue to 3.6 and then I will skip it till 4.3 :) +
- +
-====Upgrade to 3.6==== +
-Remember that we should perform that step from now on :) +
- +
- +
-===Shutdown the server=== +
-This time we will do it gracefully to see that I also have hearth :) +
- +
-<sxh bash> +
-[root@localhost ~]# mongo localhost:27017/admin --eval "db.shutdownServer()" +
-MongoDB shell version: 3.0.15 +
-connecting to: localhost:27017/admin +
-2019-09-10T09:17:37.121-0400 I NETWORK  DBClientCursor::init call() failed +
-server should be down... +
-</sxh> +
- +
- +
-===Modify yum config file=== +
-<sxh bash> +
-*********************************************************** +
-[mongodb-org-3.6] +
-name=MongoDB Repository +
-baseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/3.6/x86_64/ +
-gpgcheck=1 +
-enabled=1 +
-gpgkey=https://www.mongodb.org/static/pgp/server-3.6.asc +
-</sxh> +
- +
- +
-===Upgrade the libraries=== +
-<sxh bash> +
-[root@localhost ~]# yum search mongo +
-Loaded plugins: fastestmirror, langpacks +
-Loading mirror speeds from cached hostfile +
- * base: mirror.it4i.cz +
- * extras: mirror.it4i.cz +
- * updates: mirror.it4i.cz +
-============================================================================================================ 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 "search all" for everything. +
-[root@localhost ~]# yum install mongodb-org-server.x86_64 +
-Loaded plugins: fastestmirror, langpacks +
-Loading mirror speeds from cached hostfile +
- * base: mirror.it4i.cz +
- * extras: mirror.it4i.cz +
- * updates: mirror.it4i.cz +
-mongodb-org-3.0                                                                                                                                                                                                       | 2.5 kB  00:00:00 +
-mongodb-org-3.2                                                                                                                                                                                                       | 2.5 kB  00:00:00 +
-mongodb-org-3.4                                                                                                                                                                                                       | 2.5 kB  00:00:00 +
-mongodb-org-3.6                                                                                                                                                                                                       | 2.5 kB  00:00:00 +
-Resolving Dependencies +
---> Running transaction check +
----> Package mongodb-org-server.x86_64 0:3.4.22-1.el7 will be updated +
----> Package mongodb-org-server.x86_64 0:3.6.14-1.el7 will be an update +
---> Finished Dependency Resolution +
- +
-Dependencies Resolved +
- +
-============================================================================================================================================================================================================================================= +
- Package                                                       Arch                                              Version                                                    Repository                                                  Size +
-============================================================================================================================================================================================================================================= +
-Updating: +
- mongodb-org-server                                            x86_64                                            3.6.14-1.el7                                               mongodb-org-3.6                                             20 M +
- +
-Transaction Summary +
-============================================================================================================================================================================================================================================= +
-Upgrade  1 Package +
- +
-Total download size: 20 M +
-Is this ok [y/d/N]: y +
-Downloading packages: +
-Delta RPMs disabled because /usr/bin/applydeltarpm not installed. +
-mongodb-org-server-3.6.14-1.el7.x86_64.rpm                                                                                                                                                                            |  20 MB  00:00:01 +
-Running transaction check +
-Running transaction test +
-Transaction test succeeded +
-Running transaction +
-  Updating   : mongodb-org-server-3.6.14-1.el7.x86_64                                                                                                                                                                                    1/2 +
-  Cleanup    : mongodb-org-server-3.4.22-1.el7.x86_64                                                                                                                                                                                    2/2 +
-  Verifying  : mongodb-org-server-3.6.14-1.el7.x86_64                                                                                                                                                                                    1/2 +
-  Verifying  : mongodb-org-server-3.4.22-1.el7.x86_64                                                                                                                                                                                    2/2 +
- +
-Updated: +
-  mongodb-org-server.x86_64 0:3.6.14-1.el7 +
- +
-Complete! +
-[root@localhost ~]# +
-</sxh> +
- +
- +
-===Start the server=== +
-<sxh bash> +
-[root@localhost ~]# /bin/mongod -f /etc/mongod.conf --fork +
-about to fork child process, waiting until server is ready for connections. +
-forked process: 5010 +
-child process started successfully, parent exiting +
-[root@localhost ~]# ps -ef | grep mongo^C +
-[root@localhost ~]# mongo +
-MongoDB shell version: 3.0.15 +
-connecting to: test +
-Server has startup warnings: +
-2019-09-10T09:53:17.388-0400 I STORAGE  [initandlisten] +
-2019-09-10T09:53:17.388-0400 I STORAGE  [initandlisten] ** WARNING: Readahead for /var/lib/mongo is set to 4096KB +
-2019-09-10T09:53:17.388-0400 I STORAGE  [initandlisten] **          We suggest setting it to 256KB (512 sectors) or less +
-2019-09-10T09:53:17.388-0400 I STORAGE  [initandlisten] **          http://dochub.mongodb.org/core/readahead +
-2019-09-10T09:53:17.559-0400 I CONTROL  [initandlisten] +
-2019-09-10T09:53:17.559-0400 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database. +
-2019-09-10T09:53:17.559-0400 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted. +
-2019-09-10T09:53:17.559-0400 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended. +
-2019-09-10T09:53:17.559-0400 I CONTROL  [initandlisten] +
-2019-09-10T09:53:17.559-0400 I CONTROL  [initandlisten] +
-2019-09-10T09:53:17.559-0400 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'+
-2019-09-10T09:53:17.559-0400 I CONTROL  [initandlisten] **        We suggest setting it to 'never' +
-2019-09-10T09:53:17.559-0400 I CONTROL  [initandlisten] +
-2019-09-10T09:53:17.559-0400 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'+
-2019-09-10T09:53:17.559-0400 I CONTROL  [initandlisten] **        We suggest setting it to 'never' +
-2019-09-10T09:53:17.559-0400 I CONTROL  [initandlisten] +
-2019-09-10T09:53:17.572-0400 I STORAGE  [initandlisten] +
-2019-09-10T09:53:17.572-0400 I STORAGE  [initandlisten] ** WARNING: This server is using MONGODB-CR, a deprecated authentication mechanism. +
-2019-09-10T09:53:17.573-0400 I STORAGE  [initandlisten] **          Support will be dropped in a future release. +
-2019-09-10T09:53:17.573-0400 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/3.0-upgrade-to-scram-sha-1 +
-2019-09-10T09:53:17.574-0400 I STORAGE  [initandlisten] +
-2019-09-10T09:53:17.574-0400 I STORAGE  [initandlisten] ** WARNING: mongod started without --replSet yet 1 documents are present in local.system.replset +
-2019-09-10T09:53:17.574-0400 I STORAGE  [initandlisten] **          Restart with --replSet unless you are doing maintenance and  no other clients are connected. +
-2019-09-10T09:53:17.574-0400 I STORAGE  [initandlisten] **          The TTL collection monitor will not start because of this. +
-2019-09-10T09:53:17.574-0400 I STORAGE  [initandlisten] +
-> db.version() +
-3.6.14 +
-> db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } ) +
-{ "featureCompatibilityVersion" : { "version" : "3.4" }, "ok" : 1 }  <- Database features are still 3.4 +
-</sxh> +
- +
- +
-===Upgrade the database=== +
-<sxh bash> +
-> db.adminCommand( { setFeatureCompatibilityVersion: "3.6" } ) +
-{ "ok" : 1 } +
-> db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } ) +
-{ "featureCompatibilityVersion" : { "version" : "3.6" }, "ok" : 1 } +
-+
-</sxh> +
- +
-====Upgrade to 4.0==== +
-I know this is getting annoying, but there are other specifics actions which should be done when upgrading to 4.0: Authentication schema upgrade. +
- +
- +
-In nutshell, the default authentication schema: Mongo-CR is removed in Mongo >= 4.X. Therefore we have to upgraded latest when we are Mongo 3.6. +
- +
-Therefore, we have to: +
-  * Enable authentication +
-  * Upgrade authentication schema +
- +
-Please follow the procedures for these two tasks in: [[mongo_usrs_roles| Users & Roles]] +
- +
-After you upgrade the autnetication schema  you can continue as normal :)+
  
  
  • mongo_upgrade.1568142350.txt.gz
  • Last modified: 2019/10/18 20:04
  • (external edit)