MongoDB
 sql >> Teknologi Basis Data >  >> NoSQL >> MongoDB

Tips untuk Meningkatkan Server Percona untuk MongoDB

Server Percona untuk MongoDB adalah distribusi sumber terbuka MongoDB yang didukung oleh Percona. Ini adalah gratis, sepenuhnya kompatibel, dan pengganti untuk edisi Komunitas MongoDB. Ini juga menyediakan fitur “tingkat perusahaan” yang seharusnya hanya tersedia di MongoDB Edisi Enterprise, misalnya:Otentikasi dan Otorisasi LDAP, Logging Audit, Otentikasi Kerberos.

Memutakhirkan Server Percona untuk MongoDB sangat mudah. Di blog ini, kita akan membahas beberapa tips upgrade dan menunjukkan contoh cara upgrade dari versi 3.6 ke versi 4.0.

Persiapan Upgrade

Sebelum menjalankan upgrade, Anda mungkin ingin melakukan beberapa persiapan. Selalu periksa perubahan kompatibilitas dalam dokumentasi dan di sisi aplikasi Anda; periksa dokumentasi yang terkait dengan perubahan dan peningkatan fitur, fungsionalitas usang (jika ada).

Periksa matriks kompatibilitas driver untuk MongoDB guna memahami apakah Anda juga perlu memutakhirkan driver.

Siapkan daftar periksa langkah demi langkah tentang bagaimana pemutakhiran akan dijalankan. Tuliskan rencana aksi, pihak-pihak perlu dilibatkan dalam dokumentasi, rencana rollback untuk skenario terburuk.

Memperbarui Server Percona untuk MongoDB

Selalu baik untuk menguji pemutakhiran Anda di lingkungan pengembangan atau pementasan sebelum Anda pindah ke lingkungan produksi. Anda dapat membangun arsitektur MongoDB yang sama persis dengan produksi, pengujian, dan pemulihan data dari cadangan terakhir. Setelah itu, Anda dapat menguji pemutakhiran dan memvalidasi rencana pemutakhiran Anda, tidak hanya itu Anda bisa mendapatkan perkiraan berapa lama pemutakhiran akan berlangsung dan juga memverifikasi apakah aplikasi tersebut kompatibel dengan versi database yang baru.

Proses upgrade tinggal install package baru dari repositori percona, begini cara upgrade berbasis CentOS dari versi 3.6 ke versi 4.0.

Langkah Pertama

Jika Anda belum menginstal Percona Repository, Anda dapat menginstal percona-release-latest.

[[email protected] ~]# yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm

Loaded plugins: fastestmirror

percona-release-latest.noarch.rpm                                                                                   |  19 kB  00:00:00

Examining /var/tmp/yum-root-evWD4w/percona-release-latest.noarch.rpm: percona-release-1.0-25.noarch

Marking /var/tmp/yum-root-evWD4w/percona-release-latest.noarch.rpm to be installed

Resolving Dependencies

--> Running transaction check

---> Package percona-release.noarch 0:1.0-25 will be installed

--> Finished Dependency Resolution



Dependencies Resolved



===========================================================================================================================================

 Package                          Arch                    Version                    Repository                                       Size

===========================================================================================================================================

Installing:

 percona-release                  noarch                  1.0-25                     /percona-release-latest.noarch                   31 k



Transaction Summary

===========================================================================================================================================

Install  1 Package



Total size: 31 k

Installed size: 31 k

Is this ok [y/d/N]: y

Langkah Kedua

Setelah menginstal repositori Percona, aktifkan Server Percona untuk MongoDB 4.0

[[email protected] ~]# percona-release enable psmdb-40

* Enabling the Percona Server for MongoDB 4.0 repository

<*> All done!

Langkah Ketiga

Instal paket baru percona-server-mongodb, maka secara otomatis akan menghapus paket lama dan menginstal paket baru:

[[email protected] ~]# yum install percona-server-mongodb

Loaded plugins: fastestmirror

Repository percona-release-noarch is listed more than once in the configuration

base                                                                                                                | 3.6 kB  00:00:00

extras                                                                                                              | 2.9 kB  00:00:00

percona-release                                                                                                     | 2.9 kB  00:00:00

percona-release-noarch                                                                                              | 2.9 kB  00:00:00

percona-release-x86_64                                                                                              | 2.9 kB  00:00:00

prel-release-noarch                                                                                                 | 2.9 kB  00:00:00

psmdb-40-release-x86_64                                                                                             | 2.9 kB  00:00:00

updates                                                                                                             | 2.9 kB  00:00:00

(1/3): prel-release-noarch/7/primary_db                                                                             | 2.5 kB  00:00:00

(2/3): psmdb-40-release-x86_64/7/primary_db                                                                         |  47 kB  00:00:01

(3/3): percona-release-x86_64/7/primary_db                                                                          | 1.1 MB  00:00:03

Loading mirror speeds from cached hostfile

 * base: mirror.buana.web.id

 * extras: mirror.buana.web.id

 * updates: mirror.buana.web.id

Resolving Dependencies

--> Running transaction check

---> Package Percona-Server-MongoDB-36.x86_64 0:3.6.19-8.0.el7 will be obsoleted

---> Package percona-server-mongodb.x86_64 0:4.0.20-14.el7 will be obsoleting

--> Processing Dependency: percona-server-mongodb-tools = 4.0.20-14.el7 for package: percona-server-mongodb-4.0.20-14.el7.x86_64

--> Processing Dependency: percona-server-mongodb-mongos = 4.0.20-14.el7 for package: percona-server-mongodb-4.0.20-14.el7.x86_64

--> Processing Dependency: percona-server-mongodb-shell = 4.0.20-14.el7 for package: percona-server-mongodb-4.0.20-14.el7.x86_64

--> Processing Dependency: percona-server-mongodb-server = 4.0.20-14.el7 for package: percona-server-mongodb-4.0.20-14.el7.x86_64

--> Running transaction check

---> Package Percona-Server-MongoDB-36-mongos.x86_64 0:3.6.19-8.0.el7 will be obsoleted

---> Package Percona-Server-MongoDB-36-server.x86_64 0:3.6.19-8.0.el7 will be obsoleted

---> Package Percona-Server-MongoDB-36-shell.x86_64 0:3.6.19-8.0.el7 will be obsoleted

---> Package Percona-Server-MongoDB-36-tools.x86_64 0:3.6.19-8.0.el7 will be obsoleted

---> Package percona-server-mongodb-mongos.x86_64 0:4.0.20-14.el7 will be obsoleting

---> Package percona-server-mongodb-server.x86_64 0:4.0.20-14.el7 will be obsoleting

---> Package percona-server-mongodb-shell.x86_64 0:4.0.20-14.el7 will be obsoleting

---> Package percona-server-mongodb-tools.x86_64 0:4.0.20-14.el7 will be obsoleting

--> Finished Dependency Resolution



Dependencies Resolved



===========================================================================================================================================

 Package                                     Arch                 Version                      Repository                             Size

===========================================================================================================================================

Installing:

 percona-server-mongodb                      x86_64               4.0.20-14.el7                psmdb-40-release-x86_64               4.9 k

     replacing  Percona-Server-MongoDB-36.x86_64 3.6.19-8.0.el7

 percona-server-mongodb-mongos               x86_64               4.0.20-14.el7                psmdb-40-release-x86_64               8.9 M

     replacing  Percona-Server-MongoDB-36-mongos.x86_64 3.6.19-8.0.el7

 percona-server-mongodb-server               x86_64               4.0.20-14.el7                psmdb-40-release-x86_64                19 M

     replacing  Percona-Server-MongoDB-36-server.x86_64 3.6.19-8.0.el7

 percona-server-mongodb-shell                x86_64               4.0.20-14.el7                psmdb-40-release-x86_64               9.8 M

     replacing  Percona-Server-MongoDB-36-shell.x86_64 3.6.19-8.0.el7

 percona-server-mongodb-tools                x86_64               4.0.20-14.el7                psmdb-40-release-x86_64                28 M

     replacing  Percona-Server-MongoDB-36-tools.x86_64 3.6.19-8.0.el7



Transaction Summary

===========================================================================================================================================

Install  5 Packages



Total download size: 66 M

Is this ok [y/d/N]: y

Downloading packages:

(1/5): percona-server-mongodb-4.0.20-14.el7.x86_64.rpm                                                              | 4.9 kB  00:00:05

(2/5): percona-server-mongodb-mongos-4.0.20-14.el7.x86_64.rpm                                                       | 8.9 MB  00:00:39

(3/5): percona-server-mongodb-shell-4.0.20-14.el7.x86_64.rpm                                                        | 9.8 MB  00:00:42

(4/5): percona-server-mongodb-server-4.0.20-14.el7.x86_64.rpm                                                       |  19 MB  00:01:23

(5/5): percona-server-mongodb-tools-4.0.20-14.el7.x86_64.rpm                                                        |  28 MB  00:02:00

-------------------------------------------------------------------------------------------------------------------------------------------

Total                                                                                                      332 kB/s |  66 MB  00:03:22

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

  Installing : percona-server-mongodb-shell-4.0.20-14.el7.x86_64                                                                      1/10

  Installing : percona-server-mongodb-server-4.0.20-14.el7.x86_64                                                                     2/10

warning: /etc/mongod.conf created as /etc/mongod.conf.rpmnew

 * To start the service, configure your engine and start mongod

 ** WARNING: Access control is not enabled for the database.

 ** Read and write access to data and configuration is unrestricted.

 ** To fix this please use /usr/bin/percona-server-mongodb-enable-auth.sh

  Installing : percona-server-mongodb-mongos-4.0.20-14.el7.x86_64                                                                     3/10

  Installing : percona-server-mongodb-tools-4.0.20-14.el7.x86_64                                                                      4/10

  Installing : percona-server-mongodb-4.0.20-14.el7.x86_64                                                                            5/10

  Erasing    : Percona-Server-MongoDB-36-3.6.19-8.0.el7.x86_64                                                                        6/10

  Erasing    : Percona-Server-MongoDB-36-server-3.6.19-8.0.el7.x86_64                                                                 7/10

  Erasing    : Percona-Server-MongoDB-36-shell-3.6.19-8.0.el7.x86_64                                                                  8/10

  Erasing    : Percona-Server-MongoDB-36-mongos-3.6.19-8.0.el7.x86_64                                                                 9/10

  Erasing    : Percona-Server-MongoDB-36-tools-3.6.19-8.0.el7.x86_64                                                                 10/10

  Verifying  : percona-server-mongodb-server-4.0.20-14.el7.x86_64                                                                     1/10

  Verifying  : percona-server-mongodb-tools-4.0.20-14.el7.x86_64                                                                      2/10

  Verifying  : percona-server-mongodb-mongos-4.0.20-14.el7.x86_64                                                                     3/10

  Verifying  : percona-server-mongodb-shell-4.0.20-14.el7.x86_64                                                                      4/10

  Verifying  : percona-server-mongodb-4.0.20-14.el7.x86_64                                                                            5/10

  Verifying  : Percona-Server-MongoDB-36-server-3.6.19-8.0.el7.x86_64                                                                 6/10

  Verifying  : Percona-Server-MongoDB-36-tools-3.6.19-8.0.el7.x86_64                                                                  7/10

  Verifying  : Percona-Server-MongoDB-36-mongos-3.6.19-8.0.el7.x86_64                                                                 8/10

  Verifying  : Percona-Server-MongoDB-36-shell-3.6.19-8.0.el7.x86_64                                                                  9/10

  Verifying  : Percona-Server-MongoDB-36-3.6.19-8.0.el7.x86_64                                                                       10/10



Installed:

  percona-server-mongodb.x86_64 0:4.0.20-14.el7                        percona-server-mongodb-mongos.x86_64 0:4.0.20-14.el7

  percona-server-mongodb-server.x86_64 0:4.0.20-14.el7                 percona-server-mongodb-shell.x86_64 0:4.0.20-14.el7

  percona-server-mongodb-tools.x86_64 0:4.0.20-14.el7



Replaced:

  Percona-Server-MongoDB-36.x86_64 0:3.6.19-8.0.el7                    Percona-Server-MongoDB-36-mongos.x86_64 0:3.6.19-8.0.el7

  Percona-Server-MongoDB-36-server.x86_64 0:3.6.19-8.0.el7             Percona-Server-MongoDB-36-shell.x86_64 0:3.6.19-8.0.el7

  Percona-Server-MongoDB-36-tools.x86_64 0:3.6.19-8.0.el7



Complete!

Langkah Empat

Akhirnya, mulai layanan mongod.

$ systemctl start mongod.service

Proses instalasi berbasis Ubuntu/Debian serupa, Anda hanya memerlukan perintah dari APT package manager.

Dalam arsitektur MongoDB yang sangat tersedia, Anda dapat melakukan upgrade bergulir untuk meminimalkan waktu henti.

Jika aplikasi Anda sudah mendukung versi MongoDB terbaru, Anda dapat menyetel parameternya 

setFeatureCompatibilityVersion after the upgrade was completed.

> db.adminCommand( { setFeatureCompatibilityVersion: "4.0" } )

Verifikasi Tingkatkan Versi

Anda dapat memverifikasi apakah pemutakhiran berhasil dengan menghubungkan langsung ke instans MongoDB. Periksa apakah database berjalan dengan versi yang benar:

> db.version()

Atau Anda dapat memeriksa dari baris perintah:

[[email protected] lib]# mongod --version

db version v4.0.20-14

git version: b96ae5b9e6c70670b6880d4c5412167a7017713a

OpenSSL version: OpenSSL 1.0.2k-fips  26 Jan 2017

allocator: tcmalloc

modules: none

build environment:

    distarch: x86_64

    target_arch: x86_64

  1. Redis
  2.   
  3. MongoDB
  4.   
  5. Memcached
  6.   
  7. HBase
  8.   
  9. CouchDB
  1. MongoDB :kerangka kerja agregasi :$cocok antar bidang

  2. Manajemen Pengguna Basis Data Dengan ClusterControl

  3. Bagaimana cara menghapus entri duplikat dari array?

  4. MongoDB di Android

  5. Praktik Terbaik untuk Pencadangan Basis Data