installation.md 3.4 KB
Newer Older
Q
qinzuoyan 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
Installing Pegasus
===========

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

## Prerequisites and Requirements

### Hardware

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 differrent hosts. For distributed mode, more than one hosts are need:

* One or more hosts to run zookeeper. We need zookeeper to make the cluster meta data persistence. For a fault tolerant zookeeper cluster, at least 3 are necessary.
* 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:

* Compiler: the gcc version must >= 4.8. If you use other compilers, please make sure that C++14 is supported.
* CMake: must >= 2.8.12
* boost: must >= 1.58

#### Install the dependencies

For Ubuntu:

```
sudo apt-get install build-essential cmake libboost-all-dev libaio-dev libsnappy-dev libbz2-dev libreadline-dev libgflags-dev
```

For CentOS:
```
yum -y install cmake boost-devel libaio-devel snappy-devel bzip2-devel readline-devel
```

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 已提交
55
   cd pegasus && ./run.sh build
Q
qinzuoyan 已提交
56 57 58 59
   ```
   if Boost is installed at some custom path , please tell the build script the install path of Boost:

   ```
W
WeijieSun 已提交
60
   ./run.sh build -b /your/boost/installation/path
Q
qinzuoyan 已提交
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 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
   ```

## 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.