SlideShare uma empresa Scribd logo
1 de 33
Baixar para ler offline
www.postgrespro.ru
Танцующий кластер
практическое руководство дрессировщика
PostgreSQL
Алексей Чижков, Михаил Кулагин
Вызов: Кластер PostgreSQL
Мнение заказчика
● обеспечивает высокую доступность (HA)
● отказоустойчив (FT)
● распределяет нагрузку (LB)
● масштабируется на ходу
● живуч и надежен, как (...)
Через тернии в кластер
С точки зрения разработчика решения для
кластера Postgres, все кластерные стеки
одинаковы:
- внешние для Postgres
- любви к Postgres нет в коробке
Потоковая репликация
(Streaming Replication)
позволяет узлам кластера Postgres
выполнять три роли:
- мастер (1)
- синхронная реплика (1)
- асинхронная реплика ( )∞
Поддержка ролей
Порядок подхвата ролей узлов, вышедших
из строя в кластере Postgres
A→S→M
M — Мастер
S – Синхронная реплика
А – Асинхронная реплика
Кластерные стеки
Одинаково хорошо подходят для
PostgresSQL если:
- поддерживают роли узлов
- исключают split-brain
Кластер в датацентре
Split-brain в кластере
Split-brain для синих
С точки зрения красных
Чем опасен split-brain?
Вызывает безусловное умножение
количества узлов с уникальными
ключевыми ролями (М,S), что создает:
● Недоступность обоих сплитов для
клиентов
● Потерю консистентности набора данных
● Невероятную сложность восстановления
M – Master
S – Sync
A – Async
X – Failed
Кворум – злейший враг Split-brain
● expected votes = 4
quorum = 3
green wins
M – Master
S – Sync
A – Async
X – Failed
Smoker cluster started
● expected votes = 4
quorum = 3
M – Master
S – Sync
A – Async
X – Failed
Async replica failed
● expected votes = 4
quorum = 3
quorate
M – Master
S – Sync
A – Async
X – Failed
Master failed
● expected votes = 4
quorum = 3
inquorate
M – Master
S – Sync
A – Async
X – Failed
Smoker cluster stopped
● expected votes = 4
quorum = 3
inquorate
Что можно исправить?
● Улучшить отказоустойчивость без
увеличения стоимости
● Создать перевес голосов в пользу мастера
и лучшего кандидата в мастеры –
синхронной реплики.
Vote Controlling Math
IF N is_odd THEN M = S
IF N is_even THEN M = S+1
M+S >= N/2+1
S > 1
A = 1
голоса
N — все
M – мастера
S – синхронной р.
A – асинх. р.
M – Master
S – Sync
A – Async
X – Failed
Healthy VCM cluster started
● expected votes = 7
quorum = 4
quorate
M – Master
S – Sync
A – Async
X – Failed
Async node failed in VC cluster
● expected votes = 5
quorum = 3
quorate
M – Master
S – Sync
A – Async
X – Failed
Master failed in VC cluster
● expected votes = 4
quorum = 3
quorate
M – Master
S – Sync
A – Async
X – Failed
VC cluster in crisis
● expected votes = 4
quorum = 3
quorate
M – Master
S – Sync
A – Async
X – Failed
+1 healty node added to VC
● expected votes = 5
quorum = 3
quorate
M – Master
S – Sync
A – Async
X – Failed
… another master failure in VC
● expected votes = 5
quorum = 3
quorate
M – Master
S – Sync
A – Async
X – Failed
+2 healthy nodes added in vc
● expected votes = 7
quorum = 4
quorate
Smoker vs. Healthy
Lets go upscale!!!
● expected votes = 7
quorum = 4
quorate
Upscaled to 5 nodes
● expected votes = 9
quorum = 5
quorate
Upscaled to 6 nodes
● expected votes = 10
quorum = 6
quorate
Профит. (демо)
- Демо на стенде Postgres Professional
- Улучшаем PostgreSQL
- Улучшаем кластерные стеки
Патчи в PostgreSQL
pg_rewind
● недостаточно привилегий пользователя
репликации, что затрудняет автоматизацию
возращения мастера к строй
recovery.conf
● Изменение параметров репликации на данный
момент нельзя изменить без рестарта Postgres
Патчи в кластерные стеки
ocf_heartbeat_pgsql
добавление/удаление узлов приводит к
рестарту всех экземпляров PostgreSQL
(решено)
www.postgrespro.ru
Cпасибо за внимание!
Контакты:
a.chizhkoff@postgrespro.ru
m.kulagin@postgrespro.ru

Mais conteúdo relacionado

Destaque

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 

Destaque (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

Dancing cluster