{"id":95322,"date":"2020-09-28T07:42:39","date_gmt":"2020-09-28T05:42:39","guid":{"rendered":"https:\/\/prohoster.info\/blog\/administrirovanie\/kratkij-obzor-operatorov-postgresql-dlya-kubernetes-nash-vybor-i-opyt"},"modified":"2020-09-28T07:42:39","modified_gmt":"2020-09-28T05:42:39","slug":"kratkij-obzor-operatorov-postgresql-dlya-kubernetes-nash-vybor-i-opyt","status":"publish","type":"post","link":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/kratkij-obzor-operatorov-postgresql-dlya-kubernetes-nash-vybor-i-opyt","title":{"rendered":"P\u00ebrmbledhje e shkurt\u00ebr e operator\u00ebve PostgreSQL p\u00ebr Kubernetes, zgjedhja dhe p\u00ebrvoja jon\u00eb","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p><img decoding=\"async\" alt=\"P\u00ebrmbledhje e shkurt\u00ebr e operator\u00ebve PostgreSQL p\u00ebr Kubernetes, zgjedhja dhe p\u00ebrvoja jon\u00eb\" src=\"\/wp-content\/uploads\/2020\/09\/23b2db49941fa5bd5000358c8ffb991b.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\nPo shpesh e p\u00ebrjetojm\u00eb k\u00ebrkesat nga klient\u00ebt: \"D\u00ebshirojm\u00eb di\u00e7ka si Amazon RDS, por m\u00eb lir\u00eb\"; \"D\u00ebshirojm\u00eb si RDS, por kudo, n\u00eb \u00e7do infrastruktur\u00eb\". P\u00ebr t\u00eb realizuar nj\u00eb zgjidhje t\u00eb till\u00eb t\u00eb menaxhuar n\u00eb Kubernetes, ne shqyrtuam gjendjen aktuale t\u00eb operator\u00ebve m\u00eb t\u00eb njohur p\u00ebr PostgreSQL (Stolon, operator\u00ebt nga Crunchy Data dhe Zalando) dhe b\u00ebm\u00eb zgjedhjen ton\u00eb.<\/p>\n<p>Ky artikull \u00ebsht\u00eb p\u00ebrvoja q\u00eb kemi marr\u00eb dhe nga aspekti teorik (p\u00ebrmbledhje e zgjidhjeve) dhe nga ana praktike (\u00e7far\u00eb u zgjodh dhe \u00e7far\u00eb dol\u00ebn nga kjo). Por fillimisht, le t\u00eb p\u00ebrcaktojm\u00eb se cilat jan\u00eb k\u00ebrkesat q\u00eb k\u00ebrkohen p\u00ebr nj\u00eb z\u00ebvend\u00ebsim potencial t\u00eb RDS...<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<h2>\u00c7far\u00eb \u00ebsht\u00eb RDS<\/h2>\n<p>\nKur njer\u00ebzit flasin p\u00ebr RDS, nga p\u00ebrvoja jon\u00eb, ata kuptojn\u00eb nj\u00eb sh\u00ebrbim t\u00eb menaxhuar (managed) t\u00eb DBMS-it, i cili:<\/p>\n<ol>\n<li>leht\u00eb konfigurohet;<\/li>\n<li>ka mund\u00ebsin\u00eb e pun\u00ebs me snapshot dhe rikthimit prej tyre (preferohet \u2014 me mb\u00ebshtetje p\u00ebr <noindex><a rel=\"nofollow\" href=\"https:\/\/en.wikipedia.org\/wiki\/Point-in-time_recovery\">PITR<\/a><\/noindex>);<\/li>\n<li>lejon krijimin e topologjive master-slave;<\/li>\n<li>ka nj\u00eb list\u00eb t\u00eb pasur t\u00eb zgjerimeve;<\/li>\n<li>ofron auditimin dhe menaxhimin e p\u00ebrdoruesve\/accesseve.<\/li>\n<\/ol>\n<p>\nN\u00eb p\u00ebrgjith\u00ebsi, qasjet p\u00ebr realizimin e detyr\u00ebs s\u00eb vendosur mund t\u00eb jen\u00eb shum\u00eb t\u00eb ndryshme, megjithat\u00eb rruga me Ansible-nin e kushtuar nuk \u00ebsht\u00eb n\u00eb af\u00ebrsi me ne. (Mund t\u00eb arrijm\u00eb n\u00eb p\u00ebrfundimin e ngjash\u00ebm si koleg\u00ebt nga 2GIS si rezultat i <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/509926\/\">mund\u00ebsis\u00eb s\u00eb tyre<\/a><\/noindex> p\u00ebr t\u00eb krijuar \"nj\u00eb mjet p\u00ebr shp\u00ebrndarjen e shpejt\u00eb t\u00eb nj\u00eb klasteri t\u00eb q\u00ebndruesh\u00ebm mbi Postgres\".)<\/p>\n<p>Operator\u00ebt jan\u00eb qasja e pranuar gjer\u00ebsisht p\u00ebr t\u00eb zgjidhur k\u00ebto lloj problemesh n\u00eb ekosistemin Kubernetes. M\u00eb shum\u00eb rreth tyre n\u00eb lidhje me bazat e t\u00eb dh\u00ebnave q\u00eb drejtohen brenda Kubernetes-it, tashm\u00eb ka folur drejtori teknik i \"Flant\", <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/users\/distol\/\" class=\"user_link\">distol<\/a><\/noindex>, n\u00eb <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/flant\/blog\/431500\/\">n\u00eb nj\u00eb nga ligj\u00ebratat e tij<\/a><\/noindex>.<\/p>\n<p><i><strong>NB<\/strong><\/i><i>: P\u00ebr krijimin e shpejt\u00eb t\u00eb operator\u00ebve t\u00eb thjesht\u00eb, ne rekomandojm\u00eb t\u00eb kushtoni v\u00ebmendje ndaj utilitarit ton\u00eb Open Source <\/i><noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/flant\/shell-operator\"><i>shell-operator<\/i><\/a><\/noindex><i>. Duke e p\u00ebrdorur, mund ta b\u00ebni k\u00ebt\u00eb pa njohuri mbi Go, por me m\u00ebnyra m\u00eb t\u00eb njohura p\u00ebr administrator\u00ebt: n\u00eb Bash, Python etj.<\/i><\/p>\n<p>P\u00ebr PostgreSQL ekzistojn\u00eb disa operator\u00eb t\u00eb njohur K8s:<\/p>\n<ul>\n<li>Stolon;<\/li>\n<li>Operatori PostgreSQL i Crunchy Data;<\/li>\n<li>Operatori Postgres i Zalando.<\/li>\n<\/ul>\n<p>\nLe t\u00eb hedhim nj\u00eb v\u00ebshtrim m\u00eb t\u00eb af\u00ebrt n\u00eb to.<\/p>\n<h2>Zgjedhja e operatorit<\/h2>\n<p>\nP\u00ebrve\u00e7 mund\u00ebsive t\u00eb r\u00ebnd\u00ebsishme q\u00eb tashm\u00eb u p\u00ebrmend\u00ebn m\u00eb sip\u00ebr, ne - si inxhinier\u00eb t\u00eb operacioneve p\u00ebr infrastrukturen n\u00eb Kubernetes - gjithashtu prisnim nga operator\u00ebt t\u00eb tjer\u00eb:<\/p>\n<ul>\n<li> deplojim nga Git dhe me <noindex><a rel=\"nofollow\" href=\"https:\/\/kubernetes.io\/docs\/concepts\/extend-kubernetes\/operator\/#deploying-operators\">Burimet e Personalizuara<\/a><\/noindex>;<\/li>\n<li> mb\u00ebshtetje p\u00ebr anti-affinity p\u00ebr pod-in;<\/li>\n<li> instalimin e node affinity ose node selector;<\/li>\n<li> instalimin e tolerancave;<\/li>\n<li> prezenca e mund\u00ebsive t\u00eb optimizimit;<\/li>\n<li> teknologjit\u00eb dhe madje komandat e kuptueshme.<\/li>\n<\/ul>\n<p>\nDuke mos u theksuar n\u00eb detaje p\u00ebr secilin nga atributet (pyesni n\u00eb komentet n\u00ebse kan\u00eb mbetur pyetje pas leximit t\u00eb gjith\u00eb artikullit), do t\u00eb theksoja se k\u00ebto parametra jan\u00eb t\u00eb nevojshme p\u00ebr nj\u00eb p\u00ebrshkrim m\u00eb t\u00eb sakt\u00eb t\u00eb specializimit t\u00eb nyjave t\u00eb klasit, me q\u00ebllim q\u00eb t\u00eb porosit\u00ebn ato p\u00ebr aplikacione specifike. K\u00ebshtu, mund t\u00eb arrijm\u00eb nj\u00eb balancim optimal midis performanc\u00ebs dhe kostos.<\/p>\n<p>Tani \u2014 tek vet\u00eb operator\u00ebt PostgreSQL.<\/p>\n<h3>1. Stolon<\/h3>\n<p>\n<noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/sorintlab\/stolon\">Stolon<\/a><\/noindex> nga kompania italiane Sorint.lab n\u00eb <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/flant\/blog\/431500\/\">referatin e p\u00ebrmendur m\u00eb par\u00eb<\/a><\/noindex> u shqyrtua si nj\u00eb model nd\u00ebr operator\u00ebt p\u00ebr DBMS. Ky \u00ebsht\u00eb nj\u00eb projekt mjaft i vjet\u00ebr: publikimi i tij i par\u00eb ndodhi n\u00ebntor 2015(!), dhe repozitoriumi n\u00eb GitHub g\u00ebzon pothuajse 3000 yje dhe 40+ kontribues.<\/p>\n<p>Dhe v\u00ebrtet, Stolon \u00ebsht\u00eb nj\u00eb shembull i shk\u00eblqyer i arkitektur\u00ebs s\u00eb menduar:<\/p>\n<p><img decoding=\"async\" alt=\"P\u00ebrmbledhje e shkurt\u00ebr e operator\u00ebve PostgreSQL p\u00ebr Kubernetes, zgjedhja dhe p\u00ebrvoja jon\u00eb\" src=\"\/wp-content\/uploads\/2020\/09\/a34625c130bfd29c5645cf2417042de2.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\nP\u00ebr funksionimin e k\u00ebtij operatori n\u00eb detaje mund t\u00eb konsultoheni me referatin ose <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/sorintlab\/stolon\/blob\/master\/doc\/architecture.md\">dokumentacionin e projektit<\/a><\/noindex>. N\u00eb p\u00ebrgjith\u00ebsi, mjafton t\u00eb thuhet se ai di t\u00eb b\u00ebj\u00eb gjith\u00e7ka t\u00eb p\u00ebrmendur: d\u00ebshtim mbi k\u00ebrkes\u00eb, proxy p\u00ebr akses transparent t\u00eb klient\u00ebve, rezerv\u00eb\u2026 Gjithashtu, proxy ofrojn\u00eb akses p\u00ebrmes nj\u00eb pik\u00eb sh\u00ebrbimi \u2014 ndryshe nga dy zgjidhjet e tjera q\u00eb do t\u00eb shqyrtohen m\u00eb posht\u00eb (ato kan\u00eb dy sh\u00ebrbime p\u00ebr akses n\u00eb baz\u00eb).<\/p>\n<p>Megjithat\u00eb, Stolon <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/sorintlab\/stolon\/issues\/463#issuecomment-379666733\">s\u2019ka Resurset e Personalizuara<\/a><\/noindex>, gj\u00eb q\u00eb e b\u00ebn t\u00eb pamundur p\u00ebr ta vendosur n\u00eb m\u00ebnyr\u00eb t\u00eb till\u00eb q\u00eb t\u00eb krijohen shpejt dhe leht\u00eb \u2014 \"si tortat e nxehta\" \u2014 ekzemplar\u00eb DBMS n\u00eb Kubernetes. Menaxhimi b\u00ebhet p\u00ebrmes utilitarit <code>stolonctl<\/code>, nd\u00ebrrimi b\u00ebhet p\u00ebrmes Helm-chart, dhe p\u00ebrdoruesit p\u00ebrcaktohen n\u00eb ConfigMap.<\/p>\n<p>Nga nj\u00ebra an\u00eb, duket se operatori nuk \u00ebsht\u00eb shum\u00eb operator (sepse ai nuk p\u00ebrdor CRD). Por nga ana tjet\u00ebr \u2014 \u00ebsht\u00eb nj\u00eb sistem fleksib\u00ebl q\u00eb lejon konfigurimin e burimeve n\u00eb K8s ashtu si\u00e7 ju konvenon.<\/p>\n<p>Duke p\u00ebrmbledhur, personalisht p\u00ebr ne nuk dukej optimal t\u00eb krijonim nj\u00eb chart t\u00eb ve\u00e7ant\u00eb p\u00ebr secil\u00ebn DB. Prandaj filluam t\u00eb k\u00ebrkojm\u00eb alternativa.<\/p>\n<h3>2. Crunchy Data PostgreSQL Operator<\/h3>\n<p>\n<noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/CrunchyData\/postgres-operator\">Operatori nga Crunchy Data<\/a><\/noindex>, nj\u00eb startup amerikan i ri, dukej si nj\u00eb alternativ\u00eb logjike. Historia e tij publike fillon me publikimin e par\u00eb n\u00eb mars 2017, q\u00eb nga ajo koh\u00eb repozitoriumi n\u00eb GitHub ka marr\u00eb pak m\u00eb pak se 1300 yje dhe 50+ kontribues. Publikimi i fundit nga shtatori \u00ebsht\u00eb testuar p\u00ebr pun\u00eb me Kubernetes 1.15\u20141.18, OpenShift 3.11+ dhe 4.4+, GKE dhe VMware Enterprise PKS 1.3+.<\/p>\n<p>Arkitektura e Crunchy Data PostgreSQL Operator gjithashtu p\u00ebrputhet me k\u00ebrkesat e shpallura:<\/p>\n<p><img decoding=\"async\" alt=\"P\u00ebrmbledhje e shkurt\u00ebr e operator\u00ebve PostgreSQL p\u00ebr Kubernetes, zgjedhja dhe p\u00ebrvoja jon\u00eb\" src=\"\/wp-content\/uploads\/2020\/09\/343cd0494abae42fcf5b47c5bb4eb310.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\nMenaxhimi ndodh p\u00ebrmes utilitarit <code>pgo<\/code>, megjithat\u00eb, ajo nga ana e saj gjeneron Burime t\u00eb Personalizuara p\u00ebr Kubernetes. Prandaj, na g\u00ebzoi si p\u00ebrdorues potencial operatori:<\/p>\n<ul>\n<li> ka menaxhim p\u00ebrmes CRD;<\/li>\n<li> menaxhim i leht\u00eb i p\u00ebrdoruesve (po ashtu p\u00ebrmes CRD);<\/li>\n<li> integrare me komponente t\u00eb tjera <noindex><a rel=\"nofollow\" href=\"https:\/\/access.crunchydata.com\/documentation\/crunchy-postgres-containers\/4.3.1\/\">Crunchy Data Container Suite<\/a><\/noindex> \u2014 nj\u00eb koleksion i specializuar i imazheve t\u00eb kontejner\u00ebve p\u00ebr PostgreSQL dhe mjeteve p\u00ebr t\u00eb punuar me t\u00eb (p\u00ebrfshir\u00eb pgBackRest, pgAudit, zgjerime nga contrib, etj.).<\/li>\n<\/ul>\n<p>\nMegjithat\u00eb, p\u00ebrpjekjet p\u00ebr t\u00eb filluar p\u00ebrdorimin e operatorit nga Crunchy Data zbuluan disa probleme:<\/p>\n<ul>\n<li>Nuk kishte mund\u00ebsi tolerimesh \u2014 parashikohej vet\u00ebm nodeSelector.<\/li>\n<li>Pod\u2019\u00ebt e krijuar ishin pjes\u00eb e nj\u00eb Deployment\u2019i, ndon\u00ebse ne po e deploy-omim nj\u00eb aplikacion stateful. Ndryshe nga StatefulSet, Deployment\u2019\u00ebt nuk din\u00eb t\u00eb krijojn\u00eb disqe.<\/li>\n<\/ul>\n<p>\nDisavantazhi i fundit \u00e7on n\u00eb momente qesharake: n\u00eb ambientin testues arrit\u00ebm t\u00eb fillonin 3 replika me nj\u00eb disk <i>ruajtje lokale<\/i>, si rezultat operatori raportoi se 3 replika po funksiononin (ndon\u00ebse kjo nuk ishte e v\u00ebrtet\u00eb).<\/p>\n<p>Nj\u00eb tjet\u00ebr karakteristik\u00eb e k\u00ebtij operatori \u00ebsht\u00eb integrimi i tij i gatsh\u00ebm me sisteme t\u00eb ndryshme ndihm\u00ebse. P\u00ebr shembull, \u00ebsht\u00eb e leht\u00eb t\u00eb instalosh pgAdmin dhe pgBounce, dhe n\u00eb <noindex><a rel=\"nofollow\" href=\"https:\/\/access.crunchydata.com\/documentation\/postgres-operator\/4.4.0\/installation\/other\/ansible\/installing-metrics\/\">dokumentacionin<\/a><\/noindex> shihen Grafana dhe Prometheus t\u00eb parakonfiguruara. N\u00eb lansimin e fundit <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/CrunchyData\/postgres-operator\/releases\/tag\/v4.5.0-beta.1\">4.5.0-beta1<\/a><\/noindex> ve\u00e7an\u00ebrisht sh\u00ebnohet p\u00ebrmir\u00ebsimi i integrimit me projektin <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/CrunchyData\/pgmonitor\">pgMonitor<\/a><\/noindex>, duke ofruar k\u00ebshtu nj\u00eb vizualizim t\u00eb qart\u00eb t\u00eb metrikave p\u00ebr PgSQL \u201cnga fabrikat\u201d.<\/p>\n<p>Megjithat\u00eb, zgjedhja e \u00e7uditshme e burimeve t\u00eb gjeneruara nga Kubernetes na \u00e7oi n\u00eb nevoj\u00ebn p\u00ebr t\u00eb gjetur nj\u00eb zgjidhje tjet\u00ebr.<\/p>\n<h3>3. Zalando Postgres Operator<\/h3>\n<p>\nProduktet e Zalando na jan\u00eb t\u00eb njohura p\u00ebr nj\u00eb koh\u00eb t\u00eb gjat\u00eb: kemi p\u00ebrvoj\u00eb n\u00eb p\u00ebrdorimin e Zalenium dhe, sigurisht, kemi provuar <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/zalando\/patroni\">Patroni<\/a><\/noindex> \u2014 zgjidhja e tyre popullore HA p\u00ebr PostgreSQL. Eprori i kompanis\u00eb p\u00ebr nd\u00ebrtimin e <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/zalando\/postgres-operator\">Postgres Operator<\/a><\/noindex> e tregoi nj\u00eb nga autor\u00ebt e tij \u2014 Aleksei Klyukin \u2014 n\u00eb transmetimin <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/flant\/blog\/479438\/\">Postgres-t\u00eb Mart\u00ebs \u21165<\/a><\/noindex>, dhe na p\u00eblqeu.<\/p>\n<p>Ky \u00ebsht\u00eb zgjidhja m\u00eb e re nga ato t\u00eb shqyrtuara n\u00eb k\u00ebt\u00eb artikull: l\u00ebshimi i par\u00eb ndodhi n\u00eb gusht 2018. Megjithat\u00eb, edhe pse kishte nj\u00eb num\u00ebr t\u00eb vog\u00ebl l\u00ebshimesh formale, projekti ka kaluar nj\u00eb rrug\u00eb t\u00eb gjat\u00eb, tashm\u00eb duke e tejkaluar n\u00eb popullaritet zgjidhjen nga Crunchy Data me 1300+ yje n\u00eb GitHub dhe numrin maksimal t\u00eb kontributors (70+).<\/p>\n<p>\u00abN\u00ebn kapak\u00bb ky operator p\u00ebrdor zgjidhje t\u00eb provuara me koh\u00eb:<\/p>\n<ul>\n<li> Patroni dhe <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/zalando\/spilo\">Spilo<\/a><\/noindex> p\u00ebr menaxhim,<\/li>\n<li> <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/wal-e\/wal-e\">WAL-E<\/a><\/noindex> \u2014 p\u00ebr backup-e,<\/li>\n<li> <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/pgbouncer\/pgbouncer\">PgBouncer<\/a><\/noindex> \u2014 si nj\u00eb pishin\u00eb lidhjesh.<\/li>\n<\/ul>\n<p>\nJa si paraqitet arkitektura e operatorit nga Zalando:<\/p>\n<p><img decoding=\"async\" alt=\"P\u00ebrmbledhje e shkurt\u00ebr e operator\u00ebve PostgreSQL p\u00ebr Kubernetes, zgjedhja dhe p\u00ebrvoja jon\u00eb\" src=\"\/wp-content\/uploads\/2020\/09\/c66f10c1a818592ecaacd2db4ce5ace5.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\nOperator menaxhohet plot\u00ebsisht p\u00ebrmes Burimeve t\u00eb Personalizuara, krijon automatikisht StatefulSet nga kontejner\u00eb, t\u00eb cil\u00ebt m\u00eb pas mund t\u00eb personalizohen duke shtuar n\u00eb pod ndryshme sidecar. E gjith\u00eb kjo \u00ebsht\u00eb nj\u00eb avantazh i konsideruesh\u00ebm n\u00eb krahasim me operatorin nga Crunchy Data.<\/p>\n<p>Duke qen\u00eb se zgjidhja nga Zalando \u00ebsht\u00eb p\u00ebrzgjedhur nga 3 mund\u00ebsi t\u00eb shqyrtuara, p\u00ebrshkrimi i m\u00ebtejsh\u00ebm i mund\u00ebsive t\u00eb saj do t\u00eb prezantohet m\u00eb posht\u00eb, s\u00eb bashku me praktikat e aplikimit.<\/p>\n<h2>Praktika me Postgres Operator nga Zalando<\/h2>\n<p>\nDeployimi i operatorit ndodh shum\u00eb leht\u00eb: mjafton t\u00eb shkarkoni versionin aktual nga GitHub dhe t\u00eb aplikoni skedar\u00ebt YAML nga direktoria <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/zalando\/postgres-operator\/tree\/master\/manifests\">manifests<\/a><\/noindex>. Si nj\u00eb opsion, mund t\u00eb shfryt\u00ebzoni gjithashtu <noindex><a rel=\"nofollow\" href=\"https:\/\/operatorhub.io\/operator\/postgres-operator\">OperatorHub<\/a><\/noindex>.<\/p>\n<p>Pas instalimit \u00ebsht\u00eb e nevojshme t\u00eb merremi me konfigurimin <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/zalando\/postgres-operator\/blob\/master\/docs\/reference\/operator_parameters.md#aws-or-gcp-interaction\">e vendndodhjeve p\u00ebr logjet dhe backup-et<\/a><\/noindex>. Kjo b\u00ebhet p\u00ebrmes ConfigMap <code>postgres-operator<\/code> n\u00eb hap\u00ebsir\u00ebn e emrave, ku keni instaluar operatorin. Kur vendndodhjet jan\u00eb t\u00eb konfigurara, mund t\u00eb lan\u00e7oni klasterin e par\u00eb PostgreSQL.<\/p>\n<p>P\u00ebr shembull, deployimi standard duket si m\u00eb posht\u00eb:<\/p>\n<pre><code class=\"plaintext\">apiVersion: acid.zalan.do\/v1\nkind: postgresql\nmetadata:\n name: staging-db\nspec:\n numberOfInstances: 3\n patroni:\n   synchronous_mode: true\n postgresql:\n   version: &quot;12&quot;\n resources:\n   limits:\n     cpu: 100m\n     memory: 1Gi\n   requests:\n     cpu: 100m\n     memory: 1Gi\n sidecars:\n - env:\n   - name: DATA_SOURCE_URI\n     value: 127.0.0.1:5432\n   - name: DATA_SOURCE_PASS\n     valueFrom:\n       secretKeyRef:\n         key: password\n         name: postgres.staging-db.credentials\n   - name: DATA_SOURCE_USER\n     value: postgres\n   image: wrouesnel\/postgres_exporter\n   name: prometheus-exporter\n   resources:\n     limits:\n       cpu: 500m\n       memory: 100Mi\n     requests:\n       cpu: 100m\n       memory: 100Mi\n teamId: staging\n volume:\n   size: 2Gi\n<\/code><\/pre>\n<p>\nKy manifest deployon nj\u00eb klaster nga 3 eksemplar\u00eb me sidecar n\u00eb form\u00eb t\u00eb <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/wrouesnel\/postgres_exporter\">postgres_exporter<\/a><\/noindex>, nga i cili ne marrim metrika t\u00eb aplikacionit. Si\u00e7 e shihni, gjith\u00e7ka \u00ebsht\u00eb shum\u00eb e thjesht\u00eb, dhe n\u00ebse d\u00ebshironi, mund t\u00eb krijoni nj\u00eb num\u00ebr t\u00eb pakufizuar klasteresh.<\/p>\n<p>Duhet t\u00eb v\u00ebm\u00eb re gjithashtu <b>panelin web p\u00ebr administrimin<\/b> \u2014 <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/zalando\/postgres-operator\/blob\/master\/docs\/operator-ui.md\">postgres-operator-ui<\/a><\/noindex>. Ai vjen s\u00eb bashku me operatorin dhe lejon krijimin dhe fshirjen e klastereve, si dhe pun\u00ebn me backup-et q\u00eb b\u00ebn operatori.<\/p>\n<p><img decoding=\"async\" alt=\"P\u00ebrmbledhje e shkurt\u00ebr e operator\u00ebve PostgreSQL p\u00ebr Kubernetes, zgjedhja dhe p\u00ebrvoja jon\u00eb\" src=\"\/wp-content\/uploads\/2020\/09\/2e9ae033a9817d101c843ce061aafdb5.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<i>Lista e klastereve PostgreSQL<\/i><\/p>\n<p><img decoding=\"async\" alt=\"P\u00ebrmbledhje e shkurt\u00ebr e operator\u00ebve PostgreSQL p\u00ebr Kubernetes, zgjedhja dhe p\u00ebrvoja jon\u00eb\" src=\"\/wp-content\/uploads\/2020\/09\/74a65f7f301da14a0cb7bea6d5ef84ec.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<i>Menaxhimi i backup-eve<\/i><\/p>\n<p>Nj\u00eb tipar tjet\u00ebr interesant \u00ebsht\u00eb mb\u00ebshtetje p\u00ebr <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/zalando\/postgres-operator\/blob\/master\/docs\/user.md#teams-api-roles\">Teams API<\/a><\/noindex>. Ky mekaniz\u00ebm krijon automatikisht <b>rola n\u00eb PostgreSQL<\/b>, bazuar n\u00eb list\u00ebn e emrave t\u00eb p\u00ebrdoruesve t\u00eb marr\u00eb. Pas k\u00ebsaj, API lejon kthimin e list\u00ebs s\u00eb p\u00ebrdoruesve, p\u00ebr t\u00eb cil\u00ebt krijohen automatikisht rola.<\/p>\n<h3>Problemet dhe zgjidhja e tyre<\/h3>\n<p>\nMegjithat\u00eb, p\u00ebrdorimi i operatorit shp\u00ebrtheu disa disavantazhe t\u00eb r\u00ebnd\u00ebsishme:<\/p>\n<ol>\n<li> mungesa e mb\u00ebshtetjes p\u00ebr nodeSelector;<\/li>\n<li> pamund\u00ebsia p\u00ebr t\u00eb \u00e7aktivizuar backup-et;<\/li>\n<li> kur p\u00ebrdoret funksioni i krijimit t\u00eb bazave, privilegjet e paracaktuara nuk shfaqen;<\/li>\n<li> her\u00eb pas here mungon dokumentacioni ose ai \u00ebsht\u00eb n\u00eb nj\u00eb gjendje t\u00eb pabesueshme.<\/li>\n<\/ol>\n<p>\nFatmir\u00ebsisht, shum\u00eb prej tyre mund t\u00eb zgjidhen. Le t\u00eb fillojm\u00eb me fundin - problemet me <strong>dokumentacionin<\/strong>. <\/p>\n<p>Mund\u00ebsisht do t\u00eb p\u00ebrballeni me faktin se nuk \u00ebsht\u00eb gjithmon\u00eb e qart\u00eb si t\u00eb shkruani backup dhe si ta lidhni bucket-in e backup-it n\u00eb Operator UI. Kjo p\u00ebrmendet shkurt n\u00eb dokumentacion, nd\u00ebrsa p\u00ebrshkrimi i plot\u00eb gjendet n\u00eb <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/zalando\/postgres-operator\/pull\/481\">PR<\/a><\/noindex>:<\/p>\n<ol>\n<li>duhet t\u00eb krijoni nj\u00eb sekret;<\/li>\n<li>ta p\u00ebrcillni atij operatori si parametrin <code>pod_environment_secret_name<\/code> n\u00eb CRD me konfigurimet e operatorit ose n\u00eb ConfigMap (varet nga si e keni vendosur t\u00eb instaloni operatorin).<\/li>\n<\/ol>\n<p>\nMegjithat\u00eb, si\u00e7 rezulton, aktualisht kjo \u00ebsht\u00eb e pamundur. P\u00ebr k\u00ebt\u00eb arsye, ne grumbulluam <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/flant\/postgres-operator\">versionin ton\u00eb t\u00eb operatorit<\/a><\/noindex> me disa zhvillime shtes\u00eb nga pal\u00eb t\u00eb treta. M\u00eb shum\u00eb p\u00ebr t\u00eb - shih m\u00eb posht\u00eb.<\/p>\n<p>N\u00ebse i d\u00ebrgoni operatorit parametrat p\u00ebr backup, sidomos - <code>wal_s3_bucket<\/code> dhe \u00e7el\u00ebsat e aksesit n\u00eb AWS S3, at\u00ebher\u00eb ai <strong>do t\u00eb b\u00ebj\u00eb backup t\u00eb gjith\u00e7kaje<\/strong>: jo vet\u00ebm bazat n\u00eb prodhim, por edhe staging. Kjo nuk na p\u00ebrshtatet.<\/p>\n<p>N\u00eb p\u00ebrshkrimin e parametrave p\u00ebr Spilo, q\u00eb \u00ebsht\u00eb mb\u00ebshtjell\u00ebsi baz\u00eb Docker p\u00ebr PgSQL kur p\u00ebrdoret operatori, doli se: mund t\u00eb d\u00ebrgohet parametrin <code>WAL_S3_BUCKET<\/code> i zbraz\u00ebt, duke \u00e7aktivizuar k\u00ebshtu backup-et. P\u00ebr m\u00eb tep\u00ebr, p\u00ebr g\u00ebzimin e madh u gjet dhe <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/zalando\/postgres-operator\/pull\/908\">nj\u00eb PR i gatsh\u00ebm<\/a><\/noindex>, t\u00eb cilin e pranuam menj\u00ebher\u00eb n\u00eb fork-un ton\u00eb. Tani mjafton t\u00eb shtoni <code>enableWALArchiving: false<\/code> n\u00eb burimin e klasterit PostgreSQL.<\/p>\n<p>Po, kishte mund\u00ebsi t\u00eb veprohej ndryshe, duke aktivizuar 2 operator\u00eb: nj\u00eb p\u00ebr staging (pa backup-e), dhe nj\u00eb tjet\u00ebr - p\u00ebr prodhim. Por k\u00ebshtu arrit\u00ebm ta menaxhojm\u00eb me nj\u00eb.<\/p>\n<p>Mir\u00eb, m\u00ebsuam t\u00eb d\u00ebrgojm\u00eb akses n\u00eb bazat p\u00ebr S3 dhe backup-et filluan t\u00eb kalojn\u00eb n\u00eb shkarkim. Si ta b\u00ebjm\u00eb q\u00eb faqet e backup-eve n\u00eb Operator UI t\u00eb funksionojn\u00eb?<\/p>\n<p><img decoding=\"async\" alt=\"P\u00ebrmbledhje e shkurt\u00ebr e operator\u00ebve PostgreSQL p\u00ebr Kubernetes, zgjedhja dhe p\u00ebrvoja jon\u00eb\" src=\"\/wp-content\/uploads\/2020\/09\/46169b53707b0bbb686798c655022f40.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\nN\u00eb Operator UI do t\u00eb nevojitet t\u00eb shtoni 3 variabla:<\/p>\n<ul>\n<li> <code>SPILO_S3_BACKUP_BUCKET<\/code><\/li>\n<li> <code>AWS_ACCESS_KEY_ID<\/code><\/li>\n<li> <code>AWS_SECRET_ACCESS_KEY<\/code><\/li>\n<\/ul>\n<p>\nPas k\u00ebsaj, menaxhimi i backup-eve do t\u00eb b\u00ebhet i aksesuesh\u00ebm, gj\u00eb q\u00eb n\u00eb rastin ton\u00eb do t\u00eb thjesht\u00ebsoj\u00eb pun\u00ebn me staging, duke lejuar dor\u00ebzimin e kopjeve nga prodhimi pa skript t\u00eb tjer\u00eb.<\/p>\n<p>Si nj\u00eb avantazh tjet\u00ebr u p\u00ebrmend puna me Teams API dhe mund\u00ebsit\u00eb e gjera p\u00ebr krijimin e bazave dhe rolit p\u00ebrmes operatorit. Megjithat\u00eb, rolet e krijuara <strong>nuk kishin privilegje t\u00eb paracaktuara.<\/strong>Si p\u00ebrfundim, p\u00ebrdoruesi me t\u00eb drejtat e leximit nuk mund t\u00eb lexonte tabelat e reja.<\/p>\n<p>Pse k\u00ebshtu? Pavar\u00ebsisht se n\u00eb kod <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/zalando\/postgres-operator\/blob\/master\/pkg\/cluster\/database.go#L42\">\u00ebsht\u00eb<\/a><\/noindex> nevojitet <code>GRANT<\/code>, nuk nuk aplikohen gjithmon\u00eb. Ka dy metoda: <code>syncPreparedDatabases<\/code> dhe <code>syncDatabases<\/code>. N\u00eb <code>syncPreparedDatabases<\/code> \u2014 pavar\u00ebsisht se n\u00eb seksionin <code>preparedDatabases<\/code> <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/zalando\/postgres-operator\/blob\/master\/manifests\/complete-postgres-manifest.yaml#L26\">\u00ebsht\u00eb<\/a><\/noindex> ka nj\u00eb kusht <code>defaultRoles<\/code> dhe <code>defaultUsers<\/code> p\u00ebr krijimin e roleve, \u2014 t\u00eb drejtat e paracaktuara nuk aplikohen. Ne jemi n\u00eb procesin e p\u00ebrgatitjes s\u00eb nj\u00eb patch p\u00ebr t\u2019i aplikuar automatikisht k\u00ebto t\u00eb drejta.<\/p>\n<p>Dhe momenti i fundit n\u00eb p\u00ebrmir\u00ebsimet e r\u00ebnd\u00ebsishme p\u00ebr ne \u2014 <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/zalando\/postgres-operator\/pull\/975\">patch<\/a><\/noindex>, duke shtuar Node Affinity n\u00eb StatefulSet e krijuar. Klient\u00ebt tan\u00eb shpesh preferojn\u00eb t\u00eb reduktojn\u00eb shpenzimet duke p\u00ebrdorur instancat spot dhe n\u00eb to nuk duhet t\u00eb vendosen sh\u00ebrbime DB. Ky problem mund t\u00eb zgjidhej edhe p\u00ebrmes tolerations, por prania e Node Affinity ofron m\u00eb shum\u00eb siguri.<\/p>\n<h3>\u00c7far\u00eb arrit\u00ebm?<\/h3>\n<p>\nPas zgjidhjes s\u00eb problemeve t\u00eb p\u00ebrmendura, ne fork-uam Postgres Operator nga Zalando n\u00eb <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/flant\/postgres-operator\">repozitore ton\u00eb<\/a><\/noindex>, ku mbledh me patch-e kaq t\u00eb dobishme. Dhe p\u00ebr nj\u00eb leht\u00ebsi t\u00eb shtuar, p\u00ebrmbledh\u00ebm dhe <noindex><a rel=\"nofollow\" href=\"https:\/\/hub.docker.com\/r\/flant\/postgres-operator\">imazh Docker<\/a><\/noindex>.<\/p>\n<p>Lista e PR-ve, t\u00eb pranuara n\u00eb fork:<\/p>\n<ul>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/zalando\/postgres-operator\/pull\/1066\">nd\u00ebrtimi i nj\u00eb imazhi t\u00eb leht\u00eb dhe t\u00eb sigurt Docker p\u00ebr operatorin<\/a><\/noindex>;<\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/zalando\/postgres-operator\/pull\/908\">\u00e7aktivizimi i kopjeve rezerv\u00eb<\/a><\/noindex>;<\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/zalando\/postgres-operator\/pull\/1121\">p\u00ebrdit\u00ebsimi i versioneve t\u00eb burimeve p\u00ebr versionet e tanishme t\u00eb k8s<\/a><\/noindex>;<\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/zalando\/postgres-operator\/pull\/975\">implementimi i Node Affinity<\/a><\/noindex>.<\/li>\n<\/ul>\n<p>\nDo t\u00eb ishte e shk\u00eblqyer n\u00ebse komuniteti do ta mb\u00ebshtes\u00eb k\u00ebto PR, n\u00eb m\u00ebnyr\u00eb q\u00eb ato t\u00eb shkojn\u00eb n\u00eb upstream me versionin e ardhsh\u00ebm t\u00eb operatorit (1.6).<\/p>\n<h2>Bonus! Historia e suksesit me migrimin e prodhimit<\/h2>\n<p>\nN\u00ebse p\u00ebrdorni Patroni, mund t\u00eb migroni prodhimin aktiv n\u00eb operator me nj\u00eb nd\u00ebrprerje minimale.<\/p>\n<p>Spilo lejon krijimin e klaster\u00ebve standby p\u00ebrmes kujtimeve S3 me <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/wal-e\/wal-e\">Wal-E<\/a><\/noindex>, kur logu binar PgSQL e ruan fillimisht n\u00eb S3 dhe m\u00eb pas shkarkohet nga replika. Por \u00e7far\u00eb t\u00eb b\u00ebni n\u00ebse <i>jo<\/i> p\u00ebrdoret Wal-E n\u00eb infrastruktur\u00ebn e vjet\u00ebr? Zgjidhja p\u00ebr k\u00ebt\u00eb problem tashm\u00eb <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/true_engineering\/blog\/437318\/\">\u00ebsht\u00eb propozuar<\/a><\/noindex> n\u00eb Habr\u00e9.<\/p>\n<p>Vjen n\u00eb ndihm\u00eb replikimi logjik i PostgreSQL. Megjithat\u00eb, nuk do t\u00eb thellohemi n\u00eb detaje, se si t\u00eb krijojm\u00eb botimet dhe abonimet, sepse\u2026 plani yn\u00eb d\u00ebshtoi.<\/p>\n<p>Problemi \u00ebsht\u00eb q\u00eb n\u00eb DB kishte disa tabela t\u00eb ngarkuara me miliona rreshta, t\u00eb cilat gjithashtu, vazhdimisht plotsoseshin dhe fshiheshin. <noindex><a rel=\"nofollow\" href=\"https:\/\/postgrespro.ru\/docs\/postgrespro\/12\/sql-createsubscription\">Abonimi i thjesht\u00eb<\/a><\/noindex> me <code>copy_data<\/code>, kur nj\u00eb replik\u00eb e re kopjon t\u00eb gjith\u00eb p\u00ebrmbajtjen nga masteri, thjesht nuk arrinte t\u00eb zhvillohej me masterin. Kopjimi i p\u00ebrmbajtjes funksionoi p\u00ebr nj\u00eb jav\u00eb, por nuk e arriti kurr\u00eb masterin. N\u00eb fund, p\u00ebr t\u00eb zgjidhur problemin ndihmoi <noindex><a rel=\"nofollow\" href=\"https:\/\/medium.com\/avitotech\/recovery-use-cases-for-logical-replication-in-postgresql-10-a1e6bab03072\">artikulli<\/a><\/noindex> koleget nga Avito: mund t\u00eb transferohen t\u00eb dh\u00ebnat, duke p\u00ebrdorur <code>pg_dump<\/code>. Do ta p\u00ebrshkruaj versionin ton\u00eb (pak t\u00eb p\u00ebrmir\u00ebsuar) t\u00eb k\u00ebtij algoritmi.<\/p>\n<p>Ideja \u00ebsht\u00eb q\u00eb mund t\u00eb krijoni nj\u00eb regjistrim t\u00eb ndalur t\u00eb lidhur me nj\u00eb slot t\u00eb caktuar replikimi dhe pastaj t\u00eb korrigjoni numrin e transaksionit. Kishin qen\u00eb replika t\u00eb gatshme p\u00ebr pun\u00ebn e production-it. Kjo \u00ebsht\u00eb e r\u00ebnd\u00ebsishme, sepse replika do t\u00eb ndihmoj\u00eb n\u00eb krijimin e nj\u00eb dump t\u00eb konsistent dhe do t\u00eb vazhdoj\u00eb t\u00eb marr\u00eb ndryshime nga masteri.<\/p>\n<p>N\u00eb komandat e m\u00ebpasshme, q\u00eb p\u00ebrshkruajn\u00eb procesin e migrimit, do t\u00eb p\u00ebrdoren t\u00eb \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0445\u043e\u0441\u0442\u043e\u0432:<\/p>\n<ol>\n<li><i>master<\/i> \u2014 serveri origjinal;<\/li>\n<li><i>replica1<\/i> \u2014 replika stream n\u00eb production-in e vjet\u00ebr;<\/li>\n<li><i>replica2<\/i> \u2014 replika logjike e re.<\/li>\n<\/ol>\n<p><\/p>\n<h3>Plani i migrimit<\/h3>\n<p>\n1. T\u00eb krijojm\u00eb n\u00eb master regjistrimin p\u00ebr t\u00eb gjitha tabelat n\u00eb skem\u00ebn <code>public<\/code> t\u00eb baz\u00ebs <code>dbname<\/code>:<\/p>\n<pre><code class=\"bash\">psql -h master -d dbname -c \"CREATE PUBLICATION dbname FOR ALL TABLES;\"\n<\/code><\/pre>\n<p>\n2. T\u00eb krijojm\u00eb nj\u00eb slot replikimi n\u00eb master:<\/p>\n<pre><code class=\"bash\">psql -h master -c \"select pg_create_logical_replication_slot('repl', 'pgoutput');\"\n<\/code><\/pre>\n<p>\n3. T\u00eb ndalojm\u00eb replikimin n\u00eb replik\u00ebn e vjet\u00ebr:<\/p>\n<pre><code class=\"bash\">psql -h replica1 -c \"select pg_wal_replay_pause();\"\n<\/code><\/pre>\n<p>\n4. T\u00eb marrim numrin e transaksionit nga masteri:<\/p>\n<pre><code class=\"bash\">psql -h master -c \"select replay_lsn from pg_stat_replication where client_addr = 'replica1';\"\n<\/code><\/pre>\n<p>\n5. T\u00eb shkarkojm\u00eb nj\u00eb dump nga replika e vjet\u00ebr. Do ta b\u00ebjm\u00eb k\u00ebt\u00eb n\u00eb disa rrug\u00eb, \u00e7ka do t\u00eb ndihmoj\u00eb p\u00ebrshpejtimin e procesit:<\/p>\n<pre><code class=\"bash\">pg_dump -h replica1 --no-publications --no-subscriptions -O -C -F d -j 8 -f dump\/ dbname\n<\/code><\/pre>\n<p>\n6. T\u00eb ngarkojm\u00eb dump-in n\u00eb serverin e ri:<\/p>\n<pre><code class=\"bash\">pg_restore -h replica2 -F d -j 8 -d dbname dump\/\n<\/code><\/pre>\n<p>\n7. Pas ngarkimit t\u00eb dump-it mund t\u00eb fillojm\u00eb replikimin n\u00eb replik\u00ebn stream:<\/p>\n<pre><code class=\"bash\">psql -h replica1 -c \"select pg_wal_replay_resume();\"\n<\/code><\/pre>\n<p>\n7. T\u00eb krijojm\u00eb nj\u00eb regjistrim n\u00eb replik\u00ebn logjike t\u00eb re:<\/p>\n<pre><code class=\"bash\">psql -h replica2 -c \"create subscription oldprod connection 'host=replica1 port=5432 user=postgres password=secret dbname=dbname' publication dbname with (enabled = false, create_slot = false, copy_data = false, slot_name='repl');\"\n<\/code><\/pre>\n<p>\n8. T\u00eb marrim <code>oid<\/code> regjistrimin:<\/p>\n<pre><code class=\"bash\">psql -h replica2 -d dbname -c \"select oid, * from pg_subscription;\"\n<\/code><\/pre>\n<p>\n9. Le t\u00eb supozojm\u00eb se \u00ebsht\u00eb marr\u00eb <code>oid=1000<\/code>. T\u00eb aplikojm\u00eb numrin e transaksionit n\u00eb regjistrim:<\/p>\n<pre><code class=\"bash\">psql -h replica2 -d dbname -c \"select pg_replication_origin_advance('pg_1000', 'AA\/AAAAAAAA');\"\n<\/code><\/pre>\n<p>\n10. T\u00eb fillojm\u00eb replikimin:<\/p>\n<pre><code class=\"bash\">psql -h replica2 -d dbname -c \"alter subscription oldprod enable;\"\n<\/code><\/pre>\n<p>\n11. T\u00eb kontrollojm\u00eb statusin e regjistrimit, replikimi duhet t\u00eb funksionoj\u00eb:<\/p>\n<pre><code class=\"bash\">psql -h replica2 -d dbname -c \"select * from pg_replication_origin_status;\" psql -h master -d dbname -c \"select slot_name, restart_lsn, confirmed_flush_lsn from pg_replication_slots;\"\n<\/code><\/pre>\n<p>\n12. Pas fillimit t\u00eb replikimit dhe sinkronizimit t\u00eb bazave, mund t\u00eb kryen kalimi.<\/p>\n<p>13. Pas nd\u00ebrprerjes s\u00eb replikimit, duhet t\u00eb korrigjojm\u00eb sekuencat. Kjo \u00ebsht\u00eb e p\u00ebrshkruar mir\u00eb <noindex><a rel=\"nofollow\" href=\"https:\/\/wiki.postgresql.org\/wiki\/Fixing_Sequences\">n\u00eb artikullin n\u00eb wiki.postgresql.org<\/a><\/noindex>.<\/p>\n<p>Fal\u00eb k\u00ebtij plani, kalimi ka ndodhur me vonesa minimale.<\/p>\n<h2>P\u00ebrfundim<\/h2>\n<p>\nOperator\u00ebt e Kubernetes lejojn\u00eb thjeshtimin e veprimeve t\u00eb ndryshme duke i reduktuar n\u00eb krijimin e burimeve K8s. Megjithat\u00eb, pas arritjes s\u00eb nj\u00eb automatizimi t\u00eb shk\u00eblqyer me ndihm\u00ebn e tyre, \u00ebsht\u00eb e r\u00ebnd\u00ebsishme t\u00eb mbani mend se kjo mund t\u00eb sjell\u00eb edhe disa nuanca t\u00eb papritura, prandaj zgjidhni operator\u00ebt me kujdes.<\/p>\n<p>Pasi shqyrtuam tre operator\u00ebt m\u00eb t\u00eb njohur t\u00eb Kubernetes p\u00ebr PostgreSQL, zgjodh\u00ebm projektin nga Zalando. E kemi pasur t\u00eb nevojshme t\u00eb p\u00ebrballojm\u00eb disa v\u00ebshtir\u00ebsi, por rezultati na g\u00ebzoi v\u00ebrtet, ndaj planifikojm\u00eb t\u00eb zgjerojm\u00eb k\u00ebt\u00eb p\u00ebrvoj\u00eb edhe n\u00eb disa instalime t\u00eb tjera PgSQL. N\u00ebse keni p\u00ebrvoj\u00eb n\u00eb p\u00ebrdorimin e zgjidhjeve t\u00eb ngjashme \u2014 do t\u00eb na p\u00eblqente t\u00eb shihnim detajet n\u00eb komentet!<\/p>\n<h2>P.S.<\/h2>\n<p>\nLexoni gjithashtu n\u00eb blogun ton\u00eb:<\/p>\n<ul>\n<li> \u00ab<noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/flant\/blog\/431500\/\">Baza t\u00eb dh\u00ebnash dhe Kubernetes (p\u00ebrmbledhje dhe video e referatit)<\/a><\/noindex>\u00bb;<\/li>\n<li> \u00ab<noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/flant\/blog\/479438\/\">Postgres-e mart\u00eb nr. 5: PostgreSQL dhe Kubernetes. CI\/CD. Automatizimi i testimit.<\/a><\/noindex>\u00bb;<\/li>\n<li> \u00ab<noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/flant\/blog\/480722\/\">Nj\u00eb histori me operatorin Redis n\u00eb K8s dhe nj\u00eb mini-p\u00ebrmbledhje e mjeteve p\u00ebr analiz\u00ebn e t\u00eb dh\u00ebnave t\u00eb k\u00ebsaj DB.<\/a><\/noindex>\u00bb.<\/li>\n<\/ul>\n<p>Burimi: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/flant\/blog\/520616\/\">habr.com<\/a> <\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u0412\u0441\u0451 \u0447\u0430\u0449\u0435 \u043e\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0442 \u0442\u0430\u043a\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b: \u00ab\u0425\u043e\u0442\u0438\u043c \u043a\u0430\u043a Amazon RDS, \u043d\u043e \u0434\u0435\u0448\u0435\u0432\u043b\u0435\u00bb; \u00ab\u0425\u043e\u0442\u0438\u043c \u043a\u0430\u043a RDS, \u043d\u043e \u0432\u0435\u0437\u0434\u0435, \u0432 \u043b\u044e\u0431\u043e\u0439 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435\u00bb. \u0427\u0442\u043e\u0431\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 managed-\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 Kubernetes, \u043c\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u0434\u043b\u044f PostgreSQL (Stolon, \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u043e\u0442 Crunchy Data \u0438 Zalando) \u0438 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0441\u0432\u043e\u0439 \u0432\u044b\u0431\u043e\u0440. \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u2014 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043d\u0430\u043c\u0438 \u043e\u043f\u044b\u0442 \u0438 [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":95323,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-95322","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.2 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u0412\u0441\u0451 \u0447\u0430\u0449\u0435 \u043e\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/kratkij-obzor-operatorov-postgresql-dlya-kubernetes-nash-vybor-i-opyt\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.2\" \/>\n\t\t<meta property=\"og:locale\" content=\"sq_AL\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u043e\u0431\u0437\u043e\u0440 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 PostgreSQL \u0434\u043b\u044f Kubernetes, \u043d\u0430\u0448 \u0432\u044b\u0431\u043e\u0440 \u0438 \u043e\u043f\u044b\u0442 | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u0412\u0441\u0451 \u0447\u0430\u0449\u0435 \u043e\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/kratkij-obzor-operatorov-postgresql-dlya-kubernetes-nash-vybor-i-opyt\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2020-09-28T05:42:39+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2020-09-28T05:42:39+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47P\u00ebrmbledhje e shkurt\u00ebr e operator\u00ebve PostgreSQL p\u00ebr Kubernetes, zgjedhja dhe p\u00ebrvoja jon\u00eb | ProHoster","description":"Po gjithnj\u00eb e m\u00eb tep\u00ebr nga klient\u00ebt.","canonical_url":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/kratkij-obzor-operatorov-postgresql-dlya-kubernetes-nash-vybor-i-opyt","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"sq_AL","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u043e\u0431\u0437\u043e\u0440 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 PostgreSQL \u0434\u043b\u044f Kubernetes, \u043d\u0430\u0448 \u0432\u044b\u0431\u043e\u0440 \u0438 \u043e\u043f\u044b\u0442 | ProHoster","og:description":"\u0412\u0441\u0451 \u0447\u0430\u0449\u0435 \u043e\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432.","og:url":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/kratkij-obzor-operatorov-postgresql-dlya-kubernetes-nash-vybor-i-opyt","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2020-09-28T05:42:39+00:00","article:modified_time":"2020-09-28T05:42:39+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"95322","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":null,"breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-02-28 11:08:22","updated":"2022-09-30 21:12:08","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/95322","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/comments?post=95322"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/95322\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/media\/95323"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/media?parent=95322"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/categories?post=95322"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/tags?post=95322"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}