SlideShare a Scribd company logo
1 of 40
Download to read offline
Координация в распределенных
 системах с помощью Apache
         Zookeeper




                   Маирбек Хадиков
Координация


В распределенных системах
      не обойтись без
       координации
Координация


Система координации
    должна быть
  отказоустойчивой
Координация

      Реализовать
    синхронизацию в
распределенных системах
        сложно
Zookeeper
Распределенный


Маштабируемый


 Fault Tolerant


 Open Source
Задачи

Synchronization   Configuration
                  Maintenance




    Groups            Naming
Структура
ZNode
                  File




Watches                         Directory



     Optimistic           Atomic
      Locking            Operations
Флаги

Sequential


             Ephemeral
Sequential
 some-znode-00000001


 some-znode-00000002


 some-znode-00000003


         ...
Ephemeral


Время жизни ограниченно
    временем сессии
Гарантии
                   Sequential
                  Consistency


Single System                        Atomicity
    Image




      Timelines                 Reliability
API

create            get data



delete           get children



set data            sync
Cluster mode
Cluster mode
 Данные сохраняются в
памяти на всех серверах
Cluster mode
Лидер выбирается при старте
Cluster mode
Клиенты подключенны к
      follower'ам
Cluster mode
Все изменения проходят
     через лидера
Cluster mode
Commit после обновления
 данных на большинстве
       серверов
Group Membership
Group Membership
Группе соответствует определенный
              znode

       /


              ...


                    group
Group Membership
 Члены группы создают ephemeral
      znode внутри группы
    /


          ...


                group


                        member
Group Membership
  Если клиент недоступен znode
     автоматически удалится
   /


          ...


                group


                        member
Barier
Barier
Клиент вызывает exists+watcher


       /


             ...


                   barier
Barier
Если znode отсутствует барьер
          отпущен

      /


            ...


                  barier
Barier
Если znode существует, то ожидаем
   оповещение о его удалении

         /


              ...


                    barier
Leader Election
Leader Election

 /


     ...


           election
Leader Election
       Каждый желающий создает
       ephemeral|sequential znode

election


           node_00000001

           node_00000002

           node_00000003
Leader Election
Клиент у которого znode с наименьшим
          номером -- leader

election


           node_00000001

           node_00000002

           node_00000003
Leader Election
Остальные клиенты ставят watch и следят за
                 leader

   election


              node_00000001

              node_00000002

              node_00000003
Leader Election
 Если leader недоступен -- следующий
доступный клиент избирается лидером

election


           node_00000001

           node_00000004

           node_00000007
Lock
Lock
Для общего ресурса создается znode


    /


          ...


                 resource
Lock
       Каждый процесс создает
      ephemeral|sequential znode

resource


           lock_00000001

           lock_00000002

           lock_00000003
Lock
Процесс с наименьшим znode удерживает
                 lock

  resource


             lock_00000001

             lock_00000002

             lock_00000003
Lock
Остальные процессы ждут удаления
       предыдущей znode

resource


           lock_00000001

           lock_00000002

           lock_00000003
Lock
Для освобождения lock процессом удаляется
                 znode

    resource


               lock_00000001

               lock_00000002

               lock_00000003
Спасибо

     @mairbek

mkhadikov@gmail.com

 github.com/mairbek

More Related Content

Featured

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
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
Kurio // The Social Media Age(ncy)
 

Featured (20)

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
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
 

Zookeeper presentation