installation.md 4.7 KB
Newer Older
Q
qinzuoyan 已提交
1 2 3 4 5 6 7 8 9
Installing Pegasus
===========

Currently Pegasus can only be installed from source. Binary package and docker image is coming soon.

## Prerequisites and Requirements

### Hardware

Z
Zero King 已提交
10
Pegasus can be deployed in standalone mode which runs all the pegasus jobs as different processes on a single host, or in distributed mode which runs different jobs on different hosts. For distributed mode, more than one hosts are need:
Q
qinzuoyan 已提交
11

Z
Zero King 已提交
12
* One or more hosts to run zookeeper. We need zookeeper to make the cluster metadata persistence. For a fault tolerant zookeeper cluster, at least 3 are necessary.
Q
qinzuoyan 已提交
13 14 15 16 17 18 19 20 21 22 23 24 25
* One or more hosts to run Pegasus meta-server. At least 2 are needed for fault tolerance. You may share hosts between meta-server and zookeeper.
* At least 3 hosts to run Pegasus replica-server.

### Operating System requirements

* Linux: CentOS 7, Ubuntu 14.04(Trusty)
* macOS: not supported
* Microsoft Windows: not supported

## Build Pegasus from source

Please notice that Pegasus can not be built until the following packages meet the version requirements:

26
* Compiler: the gcc version must >= 4.8 && < 8. If you use other compilers, please make sure that C++14 is supported.
27 28
* CMake: must >= 3.5.2
* Boost: must >= 1.58
Q
qinzuoyan 已提交
29 30 31 32 33 34

#### Install the dependencies

For Ubuntu:

```
35 36 37 38 39
sudo apt-get install build-essential cmake libboost-all-dev libaio-dev libsnappy-dev libbz2-dev libtool libgflags-dev zlib1g zlib1g.dev patch unzip automake libssl-dev liblz4-dev libzstd-dev
```
To start onebox:
```
sudo apt-get install default-jre netcat
Q
qinzuoyan 已提交
40 41 42
```
For CentOS:
```
43
yum -y install cmake boost-devel libaio-devel snappy-devel bzip2-devel zlib-devel lz4-devel automake libtool patch unzip openssl-devel python-devel libzstd-devel
44 45 46 47 48 49 50 51
```
Zstd may not available in the default EPEL. To install the EPEL repository on CentOS-7/6, simply type:
```
yum install epel-release
```
To start onebox:
```
yum install java-1.8.0-openjdk nmap-ncat.x86_64
Q
qinzuoyan 已提交
52 53 54 55 56 57 58 59 60 61 62 63 64 65
```

Please make sure you install the proper version of GCC, CMake and Boost.

#### Build

1. clone Pegasus and its all subprojects:

   ```
   git clone https://github.com/xiaomi/pegasus.git --recursive
   ```
2. build

   ```
W
WeijieSun 已提交
66
   cd pegasus && ./run.sh build
Q
qinzuoyan 已提交
67 68 69 70
   ```
   if Boost is installed at some custom path , please tell the build script the install path of Boost:

   ```
W
WeijieSun 已提交
71
   ./run.sh build -b /your/boost/installation/path
Q
qinzuoyan 已提交
72 73
   ```

74 75 76 77 78 79 80 81 82
Generally, the build process of Pegasus consists of 4 parts:

1. Download the thirdparty dependencies to "rdsn/thirdparty" and build them, and the output headers/libraries/binaries are installed in "rdsn/thirdparty/output".
2. build the rdsn project, which is a dependency of our KV storage. The output headers/libraries/binaries are installed in "rdsn/builder/output". The build script will create a symbolic link "DSN_ROOT" in the pegasus project root.
3. build rocksdb in "rocksdb" dir, which is modified from [facebook/rocksdb](https://github.com/facebook/rocksdb)
4. build pegasus's KV-layer in "src".

**Please make sure the thirdparty are successfully downloaded and built before subsequent parts**.

83 84 85 86 87 88 89
####  Common Build Problems
* fatal error: <some_thirdparty_header_files>.h: No such file or directory

This means that Third Party Building did not complete correctly and did not generate the header files.

Rerun `./run.sh build` with `--clear_thirdparty`.

Q
qinzuoyan 已提交
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
## Run in standalone mode

You can play with pegasus with a **onebox** cluster:

```
./run.sh start_onebox
```

When running onebox cluster, all pegasus jobs are running in local host: 

* zookeeper: start a zookeeper process with port 22181
* meta-server: start several meta-server processes
* replica-server: start several replica-server processes

You can also check the state of onebox cluster:

```
./run.sh list_onebox
```

Stop the onebox cluster:

```
./run.sh stop_onebox
```

Clean the onebox cluster:

```
./run.sh clear_onebox
```

## Interactive shell

Pegasus provides a shell tool to interact with the cluster. To start the shell, run:
```
./run.sh shell
```

or specify different cluster meta-server address list:
```
./run.sh shell --cluster 127.0.0.1:34601,127.0.0.1:34602
```

Using the shell, you can do lots of things including:

* get cluster information and statistics
* create/drop/list tables (we name it app)
* get/set/del/scan data
* migrate replicas from node to node
* send remote commands to server
* dump mutation log and sstable files

## Running test

Run the unit test by:
```
./run.sh test
```

or run the killing test by:
```
./run.sh start_kill_test
```

## Benchmark

You can start a benchmark client quickly (needs onebox cluster already started):
```
./run.sh bench
```

or start a series of benchmark tests:
```
./scripts/pegasus_bench_run.sh
```

Attention: this bench tool depends on gflags, so it would not work if gflags library
is not installed when building Pegasus.