| <!DOCTYPE html> |
| <html> |
| <head> |
| <meta charset="utf-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1"> |
| <title>Pegasus | Architecture</title> |
| <link rel="stylesheet" href="/zh/assets/css/app.css"> |
| <link rel="shortcut icon" href="/zh/assets/images/favicon.ico"> |
| <link rel="stylesheet" href="/zh/assets/css/utilities.min.css"> |
| <link rel="stylesheet" href="/zh/assets/css/docsearch.v3.css"> |
| <script src="/assets/js/jquery.min.js"></script> |
| <script src="/assets/js/all.min.js"></script> |
| <script src="/assets/js/docsearch.v3.js"></script> |
| <!-- Begin Jekyll SEO tag v2.8.0 --> |
| <title>Architecture | Pegasus</title> |
| <meta name="generator" content="Jekyll v4.3.3" /> |
| <meta property="og:title" content="Architecture" /> |
| <meta property="og:locale" content="en_US" /> |
| <meta name="description" content="整体架构" /> |
| <meta property="og:description" content="整体架构" /> |
| <meta property="og:site_name" content="Pegasus" /> |
| <meta property="og:type" content="article" /> |
| <meta property="article:published_time" content="2024-04-22T06:39:52+00:00" /> |
| <meta name="twitter:card" content="summary" /> |
| <meta property="twitter:title" content="Architecture" /> |
| <script type="application/ld+json"> |
| {"@context":"https://schema.org","@type":"BlogPosting","dateModified":"2024-04-22T06:39:52+00:00","datePublished":"2024-04-22T06:39:52+00:00","description":"整体架构","headline":"Architecture","mainEntityOfPage":{"@type":"WebPage","@id":"/overview/architecture"},"url":"/overview/architecture"}</script> |
| <!-- End Jekyll SEO tag --> |
| </head> |
| |
| <body> |
| |
| |
| |
| |
| <nav class="navbar is-primary"> |
| <div class="container"> |
| <!--container will be unwrapped when it's in docs--> |
| <div class="navbar-brand"> |
| <a href="/zh/" class="navbar-item "> |
| <!-- Pegasus Icon --> |
| <img src="/assets/images/pegasus.svg"> |
| </a> |
| <div class="navbar-item"> |
| <a href="/zh/docs" class="button is-primary is-outlined is-inverted"> |
| <span class="icon"><i class="fas fa-book"></i></span> |
| <span>Docs</span> |
| </a> |
| </div> |
| <div class="navbar-item is-hidden-desktop"> |
| |
| |
| <!--A simple language switch button that only supports zh and en.--> |
| <!--IF its language is zh, then switches to en.--> |
| |
| <!--If you don't want a url to be relativized, you can add a space explicitly into the href to |
| prevents a url from being relativized by polyglot.--> |
| <a class="button is-primary is-outlined is-inverted" href=" /overview/architecture"><strong>En</strong></a> |
| |
| </div> |
| <a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false" data-target="navMenu"> |
| <!-- Appears in mobile mode only --> |
| <span aria-hidden="true"></span> |
| <span aria-hidden="true"></span> |
| <span aria-hidden="true"></span> |
| </a> |
| </div> |
| <div class="navbar-menu" id="navMenu"> |
| <div class="navbar-end"> |
| |
| <!--dropdown--> |
| <div class="navbar-item has-dropdown is-hoverable "> |
| <a href="" |
| class="navbar-link "> |
| |
| <span class="icon" style="margin-right: .25em"> |
| <i class="fas fa-users"></i> |
| </span> |
| |
| <span> |
| ASF |
| </span> |
| </a> |
| <div class="navbar-dropdown"> |
| |
| <a href="https://www.apache.org/" |
| class="navbar-item "> |
| Foundation |
| </a> |
| |
| <a href="https://www.apache.org/licenses/" |
| class="navbar-item "> |
| License |
| </a> |
| |
| <a href="https://www.apache.org/events/current-event.html" |
| class="navbar-item "> |
| Events |
| </a> |
| |
| <a href="https://www.apache.org/foundation/sponsorship.html" |
| class="navbar-item "> |
| Sponsorship |
| </a> |
| |
| <a href="https://www.apache.org/security/" |
| class="navbar-item "> |
| Security |
| </a> |
| |
| <a href="https://privacy.apache.org/policies/privacy-policy-public.html" |
| class="navbar-item "> |
| Privacy |
| </a> |
| |
| <a href="https://www.apache.org/foundation/thanks.html" |
| class="navbar-item "> |
| Thanks |
| </a> |
| |
| </div> |
| </div> |
| |
| |
| <!--dropdown--> |
| <div class="navbar-item has-dropdown is-hoverable "> |
| <a href="/zh/community" |
| class="navbar-link "> |
| |
| <span class="icon" style="margin-right: .25em"> |
| <i class="fas fa-user-plus"></i> |
| </span> |
| |
| <span> |
| 开源社区 |
| </span> |
| </a> |
| <div class="navbar-dropdown"> |
| |
| <a href="/zh/community/#contact-us" |
| class="navbar-item "> |
| 联系我们 |
| </a> |
| |
| <a href="/zh/community/#contribution" |
| class="navbar-item "> |
| 参与贡献 |
| </a> |
| |
| <a href="https://cwiki.apache.org/confluence/display/PEGASUS/Coding+guides" |
| class="navbar-item "> |
| 编码指引 |
| </a> |
| |
| <a href="https://github.com/apache/incubator-pegasus/issues?q=is%3Aissue+is%3Aopen+label%3Atype%2Fbug" |
| class="navbar-item "> |
| Bug 追踪 |
| </a> |
| |
| <a href="https://cwiki.apache.org/confluence/display/INCUBATOR/PegasusProposal" |
| class="navbar-item "> |
| Apache 提案 |
| </a> |
| |
| </div> |
| </div> |
| |
| |
| |
| <a href="/zh/blogs" |
| class="navbar-item "> |
| |
| <span class="icon" style="margin-right: .25em"> |
| <i class="fas fa-rss"></i> |
| </span> |
| |
| <span>Blog</span> |
| </a> |
| |
| |
| |
| <a href="/zh/docs/downloads" |
| class="navbar-item "> |
| |
| <span class="icon" style="margin-right: .25em"> |
| <i class="fas fa-fire"></i> |
| </span> |
| |
| <span>版本发布</span> |
| </a> |
| |
| |
| </div> |
| <div class="navbar-item is-hidden-mobile"> |
| |
| |
| <!--A simple language switch button that only supports zh and en.--> |
| <!--IF its language is zh, then switches to en.--> |
| |
| <!--If you don't want a url to be relativized, you can add a space explicitly into the href to |
| prevents a url from being relativized by polyglot.--> |
| <a class="button is-primary is-outlined is-inverted" href=" /overview/architecture"><strong>En</strong></a> |
| |
| </div> |
| </div> |
| </div> |
| </nav> |
| |
| <section class="section"> |
| <div class="container"> |
| <div class="columns is-multiline"> |
| <div class="column is-one-fourth"> |
| |
| |
| |
| <aside class="menu"> |
| |
| <p class="menu-label"></p> |
| <ul class="menu-list"> |
| |
| <li> |
| <a href="/zh/overview" |
| class=""> |
| 概览 |
| </a> |
| </li> |
| |
| <li> |
| <a href="/zh/overview/background" |
| class=""> |
| 项目背景 |
| </a> |
| </li> |
| |
| <li> |
| <a href="/zh/overview/architecture" |
| class="is-active"> |
| 系统架构 |
| </a> |
| </li> |
| |
| <li> |
| <a href="/zh/overview/data-model" |
| class=""> |
| 数据模型 |
| </a> |
| </li> |
| |
| <li> |
| <a href="/zh/overview/benchmark" |
| class=""> |
| 性能测试 |
| </a> |
| </li> |
| |
| <li> |
| <a href="/zh/docs/build/compile-by-docker" |
| class=""> |
| 安装构建 |
| </a> |
| </li> |
| |
| <li> |
| <a href="/zh/overview/onebox" |
| class=""> |
| 体验 Onebox 集群 |
| </a> |
| </li> |
| |
| </ul> |
| |
| </aside> |
| |
| </div> |
| <div class="column is-half"> |
| |
| |
| |
| <div class="content"> |
| <h1 id="系统架构">系统架构</h1> |
| <h2 id="整体架构">整体架构</h2> |
| |
| <p>Pegasus系统的整体架构如下图所示,一共分为四个部分:</p> |
| |
| <ul> |
| <li>Client Lib:封装数据到存储服务器的映射规则,以及和存储服务器(Replica Server)的通信细节,而提供一套简洁的Key-Value存取接口供用户使用</li> |
| <li>Replica Server:负责数据存储,响应Client Lib的数据存取请求</li> |
| <li>Meta Server:负责Replica Server的存活检测、数据分片(replica)管理、负载均衡等,通常采用一主多备的部署模式</li> |
| <li>Zookeeper:负责对Meta Server进行选主,以实现leader节点的高可用,并存储系统的各种元数据</li> |
| </ul> |
| |
| <p><img src="/assets/images/pegasus-architecture-components.png" alt="pegasus-architecture-components" class="img-responsive" /></p> |
| |
| <h2 id="replica-server">Replica Server</h2> |
| |
| <p>Replica Server主要负责数据存储和存取,以replica为管理单元提供服务:</p> |
| |
| <ul> |
| <li>服务的replica角色既可能是主(primary)副本,也可能是从(secondary)副本</li> |
| <li>底层使用RocksDB来存储数据</li> |
| <li>管理commit log,并实现数据复制协议,提供数据一致性保证</li> |
| </ul> |
| |
| <h2 id="meta-server">Meta Server</h2> |
| |
| <p>Meta Server通常采用一主多备的部署模式,所有的状态都会持久化到Zookeeper上,同时通过Zookeeper进行选主。当leader故障后,另一台backup立即抢到锁,然后从Zookeeper上恢复状态,成为新的leader。Meta Server负责的功能包括:</p> |
| |
| <ul> |
| <li>集群初始化</li> |
| <li>Replica Server的管理</li> |
| <li>Replica的分配、管理和负载均衡调度</li> |
| <li>Table的创建与删除</li> |
| <li>响应Client请求,对Client提供最新的路由表(partition configuration)</li> |
| </ul> |
| |
| <h2 id="apache-zookeeper">Apache Zookeeper</h2> |
| |
| <p>在Pegasus中,Zookeeper主要有两个功能:</p> |
| |
| <ul> |
| <li>集群元信息存储</li> |
| <li>Meta Server选主</li> |
| </ul> |
| |
| <h2 id="client-lib">Client Lib</h2> |
| |
| <p>Client Lib对用户提供数据存取接口,其特点包括:</p> |
| |
| <ul> |
| <li>接口简洁:对用户提供简单的接口,将数据寻址和容错等细节封装在内部</li> |
| <li>配置简单:用户只需通过配置文件指定Meta Server地址列表,就可以访问Pegasus集群</li> |
| <li>尽量直接与Replica Server进行交互,尽量少地访问Meta Server的频率以避免单点问题,不依赖Zookeeper</li> |
| </ul> |
| |
| </div> |
| </div> |
| <div class="column is-one-fourth is-hidden-mobile" style="padding-left: 3rem"> |
| |
| <p class="menu-label"> |
| <span class="icon"> |
| <i class="fa fa-bars" aria-hidden="true"></i> |
| </span> |
| 本页导航 |
| </p> |
| <ul class="menu-list"> |
| <li><a href="#系统架构">系统架构</a> |
| <ul> |
| <li><a href="#整体架构">整体架构</a></li> |
| <li><a href="#replica-server">Replica Server</a></li> |
| <li><a href="#meta-server">Meta Server</a></li> |
| <li><a href="#apache-zookeeper">Apache Zookeeper</a></li> |
| <li><a href="#client-lib">Client Lib</a></li> |
| </ul> |
| </li> |
| </ul> |
| |
| |
| </div> |
| </div> |
| </div> |
| </section> |
| <footer class="footer"> |
| <div class="container"> |
| <div class="content is-small has-text-centered"> |
| <div style="margin-bottom: 20px;"> |
| <a href="http://incubator.apache.org"> |
| <img src="/assets/images/egg-logo.png" |
| width="15%" |
| alt="Apache Incubator"/> |
| </a> |
| </div> |
| Copyright © 2023 <a href="http://www.apache.org">The Apache Software Foundation</a>. |
| Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version |
| 2.0</a>. |
| <br><br> |
| |
| Apache Pegasus is an effort undergoing incubation at The Apache Software Foundation (ASF), |
| sponsored by the Apache Incubator. Incubation is required of all newly accepted projects |
| until a further review indicates that the infrastructure, communications, and decision making process |
| have stabilized in a manner consistent with other successful ASF projects. While incubation status is |
| not necessarily a reflection of the completeness or stability of the code, it does indicate that the |
| project has yet to be fully endorsed by the ASF. |
| |
| <br><br> |
| Apache Pegasus, Pegasus, Apache, the Apache feather logo, and the Apache Pegasus project logo are either |
| registered trademarks or trademarks of The Apache Software Foundation in the United States and other |
| countries. |
| </div> |
| </div> |
| </footer> |
| <script src="/assets/js/app.js" type="text/javascript"></script> |
| </body> |
| </html> |