# Building MyRocks in MariaDB

This page describes how to get [MyRocks in MariaDB](/docs/server/server-usage/storage-engines/myrocks.md) when compiling MariaDB from source. (See [Build-Steps](https://github.com/facebook/mysql-5.6/wiki/Build-Steps) for instructions how to build the upstream.)

## Build Process and Requirements

MariaDB compile process will compile [MyRocks](/docs/server/server-usage/storage-engines/myrocks.md) into `ha_rocksdb.so` by default if the platform supports it (That is, no WITH\_ROCKSDB switch is necessary).

Platform requirements:

* A 64-bit platform (due to some 32 bit compilers having difficulties with RocksDB)
* git installed (or git submodules fetched somehow)
* A sufficiently recent compiler:
  * gcc >= 4.8, or
  * clang >= 3.3, or
  * MS Visual Studio 2015 or newer

## Building on Ubuntu 16.04

The steps were checked on a fresh install of Ubuntu 16.04.2 LTS Xenial.

```bash
sudo apt-get update
sudo apt-get -y install g++ cmake libbz2-dev libaio-dev bison zlib1g-dev libsnappy-dev 
sudo apt-get -y install libgflags-dev libreadline6-dev libncurses5-dev libssl-dev liblz4-dev gdb git
;
```

```bash
git clone https://github.com/MariaDB/server.git mariadb-10.2
cd mariadb-10.2
git checkout 10.2
git submodule init
git submodule update
cmake .
make -j10
```

This should produce `storage/rocksdb/ha_rocksdb.so` which is MyRocks storage engine in the loadable form.

## Starting MyRocks

MyRocks does not require any special way to initialize the data directory.\
Minimal my.cnf flle:

```bash
cat > ~/my1.cnf <<EOF
[mysqld]

datadir=../mysql-test/var/install.db
plugin-dir=../storage/rocksdb
language=./share/english
socket=/tmp/mysql.sock
port=3307

plugin-load=ha_rocksdb
default-storage-engine=rocksdb
EOF
```

Run the server like this

```bash
(cd mysql-test; ./mtr alias)
cp -r mysql-test/var/install.db ~/data1
cd ../sql
./mysqld --defaults-file=~/my1.cnf
```

Compression libraries.\
Supported compression libraries are listed in [rocksdb\_supported\_compression\_types](/docs/server/server-usage/storage-engines/myrocks/myrocks-system-variables.md#rocksdb_supported_compression_types). Compiling like the above, I get:

```
Snappy,Zlib,LZ4,LZ4HC
```

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/server-usage/storage-engines/myrocks/building-myrocks-in-mariadb.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
