README.md 5.5 KB
Newer Older
1 2
[![Build Status](https://travis-ci.org/XiaoMi/pegasus.svg?branch=master)](https://travis-ci.org/XiaoMi/pegasus)

Q
qinzuoyan 已提交
3 4
![docs/media-img/pegasus-logo.png](docs/media-img/pegasus-logo.png)

W
WeijieSun 已提交
5
[**中文Wiki**](https://github.com/xiaomi/pegasus/wiki), [**微信交流群**](https://github.com/XiaoMi/pegasus/wiki/%E5%85%B3%E4%BA%8E%E6%88%91%E4%BB%AC), [**slack channel**](https://join.slack.com/t/pegasus-kv/shared_invite/enQtMjcyMjQzOTk4Njk1LWVkMjlkMGE5Mzg1Y2M3MDc0NGYyYzQ5YzYyMGE0ZjlhMDMyNjU1ZGViYzdjZmUwNjVmNGE0ZDdkMWJiN2Q1MDY)
Q
qinzuoyan 已提交
6 7

## What is Pegasus?
Q
qinzuoyan 已提交
8 9 10 11

Pegasus is a distributed key-value storage system developed and maintained by Xiaomi Cloud Storage Team, with targets of
high availability, high performance, strong consistency and ease of use. The original motivation of this project is to replace
[Apache HBase](https://hbase.apache.org/) for users who only need simple key-value schema but require low latency and high availability.
Q
QinZuoyan 已提交
12 13
It is based on the modified [rDSN](https://github.com/XiaoMi/rdsn)(original [Microsoft/rDSN](https://github.com/Microsoft/rDSN)) framework,
and uses modified [RocksDB](https://github.com/xiaomi/pegasus-rocksdb)(original [facebook/RocksDB](https://github.com/facebook/rocksdb)) as underlying storage engine.
Q
qinzuoyan 已提交
14 15 16 17 18 19 20 21
The consensus algorithm it uses is [PacificA](https://www.microsoft.com/en-us/research/publication/pacifica-replication-in-log-based-distributed-storage-systems/).

## Features

* High performance

  Here are several key aspects that make Pegasus a high performance storage system: 
     - Implemented in C++
Z
Zero King 已提交
22
     - [Staged event-driven architecture](https://en.wikipedia.org/wiki/Staged_event-driven_architecture), a distinguished architecture that Nginx adopts.
Q
qinzuoyan 已提交
23 24
     - High performance storage-engine with [RocksDB](https://github.com/facebook/rocksdb), though slight change is made to support fast learning.

0
0xflotus 已提交
25
* High availability
Q
qinzuoyan 已提交
26

Z
Zero King 已提交
27
  Unlike Bigtable/HBase, a non-layered replication architecture is adopted in Pegasus in which an external DFS like GFS/HDFS isn't the dependency of the persistent data, which benefits the availability a lot. Meanwhile, availability problems in HBase which result from Java GC are totally eliminated for the use of C++.
Q
qinzuoyan 已提交
28 29 30 31 32 33 34 35 36 37 38 39 40

* Strong consistency

  We adopt the [PacificA](https://www.microsoft.com/en-us/research/publication/pacifica-replication-in-log-based-distributed-storage-systems/#) consensus algorithm to make Pegasus a strong consistency system.

* Easily scaling out

  Load can be balanced dynamically to newly added data nodes with a global load balancer.

* Easy to use

  We provided C++ and Java client with simple interfaces to make it easy to use.

Z
Zero King 已提交
41
## Architecture overview
Q
qinzuoyan 已提交
42

Z
Zero King 已提交
43
The following diagram shows the architecture of Pegasus:
Q
qinzuoyan 已提交
44

Z
Zero King 已提交
45
![docs/media-img/pegasus-architecture-overview.png](docs/media-img/pegasus-architecture-overview.png)
Q
qinzuoyan 已提交
46

Z
Zero King 已提交
47
Here is a brief explanation on the concepts and terms in the diagram:
Q
qinzuoyan 已提交
48 49 50 51

* MetaServer: a component in Pegasus to do the whole cluster management. The meta-server is something like "HMaster" in HBase.
* Zookeeper: the external dependency of Pegasus. We use zookeeper to store the meta state of the cluster and do meta-server's fault tolerance.
* ReplicaServer: a component in Pegasus to serve client's read/write request. The replica-server is also the container for replicas.
Z
Zero King 已提交
52
* Partition/replica: the whole key space is split into several partitions, and each partition has several replicas for fault tolerance. You may want to refer to the [PacificA](https://www.microsoft.com/en-us/research/publication/pacifica-replication-in-log-based-distributed-storage-systems/#) algorithm for more details.
Q
qinzuoyan 已提交
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69

For more details about design and implementation, please refer to PPTs under [`docs/ppt/`](docs/ppt/).

## Data model & API overview

The data model in Pegasus is (hashkey + sortkey) -> value, in which:
* Hashkey is used for partitioning. Values with different hash keys may stored in different partitions.
* Sortkey is used for sorting within a hashkey. Values with the **same** hashkey but **different** sortkeys are in the **same partition**, and ordered by the sort key. If you use scan API to scan a single hashkey, you will get the values by the lexicographical order of sortkeys.

The following diagram shows the data model of Pegasus:

![docs/media-img/pegasus-data-model.png](docs/media-img/pegasus-data-model.png)

## Quick Start

You may want to refer to the [installation guide](docs/installation.md).

Q
qinzuoyan 已提交
70 71
## Related Projects

Q
QinZuoyan 已提交
72 73 74 75
Submodules:
* [rDSN](https://github.com/xiaomi/rdsn)
* [RocksDB](https://github.com/xiaomi/pegasus-rocksdb)

Q
qinzuoyan 已提交
76
Client libs:
Q
QinZuoyan 已提交
77 78 79 80 81
* [Java client](https://github.com/xiaomi/pegasus-java-client)
* [Python Client](https://github.com/xiaomi/pegasus-python-client)
* [Go Client](https://github.com/xiaomi/pegasus-go-client)
* [Node.js Client](https://github.com/xiaomi/pegasus-nodejs-client)
* [Scala Client](https://github.com/xiaomi/pegasus-scala-client)
Q
qinzuoyan 已提交
82 83

Test tools:
Q
QinZuoyan 已提交
84 85 86 87 88
* [Java YCSB](https://github.com/xiaomi/pegasus-YCSB)
* [Go YCSB](https://github.com/xiaomi/pegasus-YCSB-go)

Data import/export tools:
* [DataX](https://github.com/xiaomi/pegasus-datax)
Q
qinzuoyan 已提交
89

0
0xflotus 已提交
90
## How to contribute
Q
qinzuoyan 已提交
91

92
We open sourced this project because we know that it is far from mature and needs lots of
Q
qinzuoyan 已提交
93 94
improvement. So we are looking forward to your [contribution](docs/contribution.md).

W
WeijieSun 已提交
95
If you have more questions, please join our [slack channel](https://join.slack.com/t/pegasus-kv/shared_invite/enQtMjcyMjQzOTk4Njk1LWVkMjlkMGE5Mzg1Y2M3MDc0NGYyYzQ5YzYyMGE0ZjlhMDMyNjU1ZGViYzdjZmUwNjVmNGE0ZDdkMWJiN2Q1MDY).
W
WeijieSun 已提交
96

Q
qinzuoyan 已提交
97 98
## License

99
Copyright 2015-2018 Xiaomi, Inc. Licensed under the Apache License, Version 2.0:
Q
qinzuoyan 已提交
100 101
http://www.apache.org/licenses/LICENSE-2.0