Upgrade to Pro — share decks privately, control downloads, hide ads and more …

pgconf.ru - 2019 - patroni vs stolon vs repmgr

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
Avatar for Andy Fefelov Andy Fefelov
February 04, 2019

pgconf.ru - 2019 - patroni vs stolon vs repmgr

Here I briefly summarise how we'd make a choice between patroni, stolon and repmgr for out failover solution built on postgres.

Avatar for Andy Fefelov

Andy Fefelov

February 04, 2019

More Decks by Andy Fefelov

Other Decks in Technology

Transcript

  1. patroni vs stolon vs repmgr Как мы выбирали среди patroni,

    stolon, repmgr для нашего отказоустойчивого Постгреса Андрей Фефелов mastery.pro
  2. Содержание • High Availability применительно к Postgres • Постановка задачи

    • Краткий обзор и сравнение решений • Amazon Aurora/RDS • repmgr • stolon • patroni • Решение задачи в нашем случае • Всего 20 слайдов Andy Fefelov - mastery.pro - https://pgconf.ru/2019 2
  3. High Availability применительно к Postgres •NAS/SAN •DRBD •Logical (trigger based

    old fashion - pgq, pglogical) •WAL shipping Andy Fefelov - mastery.pro - https://pgconf.ru/2019 3
  4. Постановка задачи •Hetzner •3 DC (Nuremberg, Falkenstein, Helsinki) •RTO =

    10min •RPO --> 0 =) •Automatic db failover •Automatic app failover •Fencing Andy Fefelov - mastery.pro - https://pgconf.ru/2019 4
  5. Amazon Aurora/RDS •Aurora - быстро, очень быстро, очень дорого (aurora)

    •Есть почти все extensions, нет pgq (pglogical since Sep 14, 2018) •RDS - медленно (за те же деньги) •Сложности «внешнего» бэкапа Andy Fefelov - mastery.pro - https://pgconf.ru/2019 5
  6. repmgr • 2ndQuadrant, C • Any postgres from 9.3 ->

    11 • Witness server concept • No need for dcs • Things to learn: 2 • No fencing • Workaround https://github.com/2ndQuadrant/repmgr/blob/master/doc/repmgrd-node- fencing.md Andy Fefelov - mastery.pro - https://pgconf.ru/2019 6
  7. stolon •Sorintlab, go •Using DCS •k8s ready •Sync/async replication •Custom

    init Andy Fefelov - mastery.pro - https://pgconf.ru/2019 8
  8. stolon •Standby cluster •RW+RO -> master only •One way switchover

    •pg_rewind •Things to learn: 4 Andy Fefelov - mastery.pro - https://pgconf.ru/2019 9
  9. patroni + consul + wal-g + s3 + docker •Zalando,

    python •Use DCS •k8s ready •Sync/async replication Andy Fefelov - mastery.pro - https://pgconf.ru/2019 11
  10. patroni + consul + wal-g + s3 + docker •Custom

    init •Standby cluster •pg_rewind •Hooks •Things to learn: 2 Andy Fefelov - mastery.pro - https://pgconf.ru/2019 12
  11. patroni + consul + wal-g + s3 + docker •UI

    •dns •service checks •patroni умеет анонсировать master/replica ❤❤❤❤❤❤ Andy Fefelov - mastery.pro - https://pgconf.ru/2019 13
  12. patroni + consul+ wal-g + s3 + docker •fast (parallelized)

    •compression •quite simple •production ready Andy Fefelov - mastery.pro - https://pgconf.ru/2019 14
  13. patroni + consul+ wal-g + s3 + docker we just

    use them Andy Fefelov - mastery.pro - https://pgconf.ru/2019 15
  14. patroni + consul+ wal-g + s3 + docker host (h2)

    pg-h2 host (h1) pg-h1 host (h0) pg-h0 postgres patroni consul* postgres* patroni consul postgres patroni consul S3 wal-g wal-g wal-g Andy Fefelov - mastery.pro - https://pgconf.ru/2019 16
  15. patroni + consul+ wal-g + s3 + docker •Pros: •Simple

    setup •Fast master init •Consistent backup from any node (thanks to REST API) •Failover works •Hooks, one love! Andy Fefelov - mastery.pro - https://pgconf.ru/2019 17
  16. patroni + consul+ wal-g + s3 + docker Cons: •DNS

    could be a problem •Slow slave init (our fault) •Application should be ready to loose database •You need to review your orchestration Andy Fefelov - mastery.pro - https://pgconf.ru/2019 18
  17. thanks to, links and questions please -Александр Кукушкин (patroni) -Андрей

    Бородин (wal-g) -patroni.readthedocs.io/ -github.com/wal-g/wal-g -github.com/afefelov/patroni-class Andy Fefelov - mastery.pro - https://pgconf.ru/2019 19
  18. github insights stars: 2280>1851>993 opened prs: 3<21>0 issues: 68<37>35 PR

    on service for consul: 4d vs 150+d Andy Fefelov - mastery.pro - https://pgconf.ru/2019 20
  19. host (h2) pg-h2 host (h1) pg-h1 host (h0) pg-h0 alternative:

    haproxy+keepalived postgres patroni consul* postgres* patroni consul postgres patroni consul wal-g wal-g wal-g haproxy haproxy haproxy keepalived (vrrp/carp) Andy Fefelov - mastery.pro - http://pgconf.ru/2019 21