-
Notifications
You must be signed in to change notification settings - Fork 6
Installation
Install deps
sudo apt-get update
sudo apt-get install g++ cmake libbz2-dev libaio-dev bison \
zlib1g-dev libsnappy-dev
sudo apt-get install libgflags-dev libreadline6-dev libncurses5-dev \
libssl-dev liblz4-dev gdb git
git clone https://github.com/Terark/terarksql
cd terarksql
git submodule init
git submodule update
cd mysql-5.6
git submodule init
git submodule update
Download TerarkDB package and unpack:
(assume you downloaded terark-zip-rocksdb-Linux-x86_64-g++-4.8-bmi2-0.tgz
)
cd /download/dir # where terark-zip-rocksdb-Linux-x86_64-g++-4.8-bmi2-0.tgz lies in
tar xzf terark-zip-rocksdb-Linux-x86_64-g++-4.8-bmi2-0.tgz
export WITH_TERARKDB=/download/dir/terark-zip-rocksdb-Linux-x86_64-g++-4.8-bmi2-0
TODO: now downloaded terark-zip-rocksdb
is not needed during compiling MyRocks
to export WITH_TERARKDB to enviroment variables in order to add terark library when compile.
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_SSL=system \
-DWITH_ZLIB=bundled -DMYSQL_MAINTAINER_MODE=0 \
-DENABLED_LOCAL_INFILE=1 -DENABLE_DTRACE=0 \
-DCMAKE_CXX_FLAGS="-march=native" \
-DCMAKE_INSTALL_PREFIX=/usr/local/terarksql
make
sudo make install
Create mysql user and user group if there not exist in the os:
groupadd mysql
useradd -g mysql mysql
To enable RocksDB storage engine, you need to set at least the following parameters in /usr/local/terarksql/my.cnf
.
[mysqld]
rocksdb
default-storage-engine=rocksdb
skip-innodb
default-tmp-storage-engine=MyISAM
collation-server=latin1_bin #(or utf8_bin, binary)
log-bin
binlog-format=ROW
and there a example of my.cnf
:
[mysqld]
rocksdb
default-storage-engine=rocksdb
skip-innodb
default-tmp-storage-engine=MyISAM
collation-server=latin1_bin
user = mysql
bind-address = 0.0.0.0
back_log = 600
max_connections = 6000
datadir = /usr/local/terarksql/data
log-bin = /usr/local/terarksql/data/mysql
binlog-format=ROW
secure_file_priv=""
cd /usr/local/terarksql
sudo env \
LD_LIBRARY_PATH=/path/to/terark-zip-rocksdb-package/lib:$LD_LIBRARY_PATH \
scripts/mysql_install_db --defaults-file=path/to/my.cnf
To enable Terark algorithms, you need to set the environment variables. Only TerarkZipTable_localTempDir
are required, the rest of them could be left as default, it shall works good in most cases:
mkdir terark-tempdir
sudo chown -R mysql:mysql terark-tempdir
sudo env \
LD_LIBRARY_PATH=/path/to/terark-zip-rocksdb-package/lib:$LD_LIBRARY_PATH \
TerarkZipTable_localTempDir=$PWD/terark-tempdir \
support-files/mysql.server start
More options can be found here.
mysql -uroot -h0.0.0.0 -e\
"select * from information_schema.ROCKSDB_CF_OPTIONS
where OPTION_TYPE='TABLE_FACTORY_NAME';"
If the output is:
+------------+--------------------+----------------+
| CF_NAME | OPTION_TYPE | VALUE |
+------------+--------------------+----------------+
| __system__ | TABLE_FACTORY_NAME | TerarkZipTable |
| default | TABLE_FACTORY_NAME | TerarkZipTable |
+------------+--------------------+----------------+
it means TerarkDB works.
And you can run
select * from information_schema.ROCKSDB_TF_OPTIONS;
in mysql client commandline to check the TerarkZipTable options you set before.