代码改变世界

ubuntu 16.04编译 myrocks

2018-04-15 16:09  alkfbb  阅读(614)  评论(0编辑  收藏  举报

下载源码


1 git clone https://github.com/facebook/mysql-5.6.git
2 cd mysql-5.6
3 git submodule inita
4 git submodule update

 

安装依赖


 
主要是参考
https://github.com/facebook/mysql-5.6/wiki/Build-Steps



使用这个源:        
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse



sudo apt-get update
sudo apt-get -y install g++ cmake libbz2-dev libaio-dev bison \
zlib1g-dev libsnappy-dev libboost-all-dev
sudo apt-get -y install libgflags-dev libreadline6-dev libncurses5-dev \
libssl-dev liblz4-dev gdb git libzstd-dev libzstd0


sudo ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/libz.so

sudo apt-get install -y python python-mysqldb
sudo apt-get install -y libdbd-mysql libdbi-perl libdbd-mysql-perl



mkdir bu
cd bu
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWITH_SSL=system \
-DWITH_ZLIB=bundled -DMYSQL_MAINTAINER_MODE=1 -DENABLE_DTRACE=0 -DCMAKE_INSTALL_PREFIX=/home/zyn/rocksinstall -DHAVE_WERROR_FLAG=""

编译错误 Cannot find system zstd libraries.,修改一下
cmame/zstd.cmake第二行
  FIND_PATH(PATH_TO_ZSTD NAMES zstd.h)

make -j8

里面遇到几个编译错误,直接修改代码。


运行


 


init the database
cd /home/zyn/rocksinstall/scripts

./mysql_install_db --defaults-file=/home/zyn/rocksdata/my.cnf --basedir=/home/zyn/rocksinstall
start the server
/home/zyn/rocksinstall/bin/mysqld_safe --defaults-file=/home/zyn/rocksdata/my.cnf


config file
my.cnf
[mysqld]
rocksdb
default-storage-engine=rocksdb
skip-innodb
default-tmp-storage-engine=MyISAM
collation-server=latin1_bin
datadir=/home/zyn/rocksdata
log-bin
binlog-format=ROW

socket=/home/zyn/rocksdata/s.socket


connect client
cd /home/zyn/rocksinstall/bin

./mysql -u root --socket=/home/zyn/rocksdata/s.socket