当前位置:网站首页>2022-07-04 mysql的高性能数据库引擎stonedb在centos7.9编译及运行

2022-07-04 mysql的高性能数据库引擎stonedb在centos7.9编译及运行

2022-07-06 14:28:00 帝尊悟世

目录

摘要:

编译stonedb:

环境:

仓库地址:

改动的代码:

安装第三方依赖:

基本依赖:

cmake:

marisa

rocksdb

boost_1_66_0

gcc 7.3.0

编译:

编译脚本:

编译结果:

启动stonedb:

一. 创建用户及相关目录:

二. 启动mysql服务:

三. 进入stonedb


摘要:

记录stonedb编译及运行, 以快速实现对逻辑的追踪。

编译stonedb:

环境:

  1. centos7.9:  http://mirrors.aliyun.com/centos/7.9.2009/isos/x86_64/CentOS-7-x86_64-Minimal-2009.isohttp://mirrors.aliyun.com/centos/7.9.2009/isos/x86_64/CentOS-7-x86_64-Minimal-2009.iso

仓库地址:

github地址:  https://github.com/stoneatom/stonedb

快照备份: 数据库stonedb.7z-C++文档类资源-CSDN文库

注意:

  1. 此仓库的代码当前存在一些未清除干净的代码, 如果出现错误直接采取注释掉对应代码的办法
  2. 存在第三方依赖,需要额外注意

改动的代码:

 

安装第三方依赖:

基本依赖:

yum install -y tree
yum install -y gcc
yum install -y gcc-c++
yum install -y libzstd-devel
yum install -y make
yum install -y ncurses
yum install -y ncurses-devel
yum install -y bison
yum install -y libaio
yum install -y perl
yum install -y perl-DBI
yum install -y perl-DBD-MySQL
yum install -y perl-Time-HiRes
yum install -y readline-devel
yum install -y numactl
yum install -y zlib
yum install -y zlib-devel
yum install -y curldevel
yum install -y openssl
yum install -y openssl-devel
yum install -y redhat-lsb-core
yum install -y git
yum install -y autoconf
yum install -y automake
yum install -y libtool
yum install -y lrzsz
yum install -y lz4
yum install -y lz4-devel
yum install -y snappy
yum install -y snappy-devel
yum install -y bzip2
yum install -y bzip2-devel
yum install -y zstd

cmake:

wget https://cmake.org/files/v3.7/cmake-3.7.2.tar.gz
tar -zxvf cmake-3.7.2.tar.gz
cd cmake-3.7.2
./bootstrap && make && make install
/usr/local/bin/cmake --version
apt remove cmake -y
ln -s /usr/local/bin/cmake /usr/bin/

marisa

git clone https://github.com/s-yata/marisa-trie.git
cd marisa-trie
autoreconf -i
./configure --enable-native-code --prefix=/usr/local/stonedb-marisa
make && make install 

rocksdb


wget https://github.com/facebook/rocksdb/archive/refs/tags/v7.3.1.tar.gz
tar -zxvf v7.3.1.tar.gz
cd rocksdb-7.3.1
make shared_lib
make install-shared INSTALL_PATH=/usr/local/stonedb-gcc-rocksdb
make static_lib
make install-static INSTALL_PATH=/usr/local/stonedb-gcc-rocksdb

boost_1_66_0


wget https://nchc.dl.sourceforge.net/project/boost/boost/1.66.0/boost_1_66_0.tar.gz
 
tar -xzvf boost_1_66_0.tar.gz
 
cd boost_1_66_0
 
./bootstrap.sh
 
./b2 install --prefix=/usr/local/stonedb-boost
 
ldconfig -v

gcc 7.3.0

yum install centos-release-scl scl-utils-build -y
yum install devtoolset-7-gcc.x86_64 devtoolset-7-gcc-c++.x86_64 devtoolset-7-gcc-gdb-plugin.x86_64 -y

切换到7.3.0版本

scl enable devtoolset-7 bash

[[email protected] stonedb]# scl enable devtoolset-7 bash
[[email protected] stonedb]# 
[[email protected] stonedb]# g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-7/root/usr --mandir=/opt/rh/devtoolset-7/root/usr/share/man --infodir=/opt/rh/devtoolset-7/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --with-default-libstdcxx-abi=gcc4-compatible --with-isl=/builddir/build/BUILD/gcc-7.3.1-20180303/obj-x86_64-redhat-linux/isl-install --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 7.3.1 20180303 (Red Hat 7.3.1-5) (GCC) 

编译:

编译脚本:

cd scripts
./stonedb_build.sh

编译结果:

[[email protected] stonedb]# ll /stonedb56/install/
total 184
drwxr-xr-x.  2 mysql mysql   4096 Jul  4 07:19 bin
-rw-r--r--.  1 mysql mysql  17987 Jul  3 23:20 COPYING
drwxr-xr-x.  5 mysql mysql    164 Jul  4 07:26 data
drwxr-xr-x.  6 mysql mysql    266 Jul  4 07:19 docs
drwxr-xr-x.  3 mysql mysql   4096 Jul  4 07:19 include
-rw-r--r--.  1 mysql mysql 102986 Jul  3 23:20 INSTALL-BINARY
-rwxr-xr-x.  1 mysql mysql    261 Jul  3 23:20 install.sh
drwxr-xr-x.  3 mysql mysql    272 Jul  4 07:19 lib
drwxr-xr-x.  2 mysql mysql     59 Jul  4 07:23 log
drwxr-xr-x.  4 mysql mysql     30 Jul  4 07:19 man
-rw-r--r--.  1 mysql mysql   5544 Jul  3 23:20 my.cnf
-rwxr-xr-x.  1 mysql mysql  12516 Jul  3 23:20 mysql_server
drwxr-xr-x. 10 mysql mysql   4096 Jul  4 07:19 mysql-test
-rw-r--r--.  1 mysql mysql   2615 Jul  3 23:20 README
-rwxr-xr-x.  1 mysql mysql    759 Jul  3 23:20 reinstall.sh
drwxr-xr-x.  2 mysql mysql     57 Jul  4 07:19 scripts
drwxr-xr-x. 28 mysql mysql   4096 Jul  4 07:19 share
drwxr-xr-x.  4 mysql mysql   4096 Jul  4 07:19 sql-bench
-rw-r--r--.  1 mysql mysql     31 Jul  4 07:21 stonedb.cnf
drwxr-xr-x.  2 mysql mysql    136 Jul  4 07:19 support-files
drwxr-xr-x.  2 mysql mysql     24 Jul  4 07:26 tmp

启动stonedb:

一. 创建用户及相关目录:

groupadd mysql
useradd -g mysql mysql
mkdir -p /stonedb56/install/{log/,tmp/,binlog/,data/innodb} && chown -R mysql:mysql /stonedb56

二. 启动mysql服务:

注意相关文件和文件夹需提前创建并设置归属为mysql.

尤其注意stonedb.cnf文件需自行创建



chroot --userspec "mysql:mysql" "/" sh -c /stonedb56/install/bin/mysqld --defaults-file=/stonedb56/install/stonedb.cnf --user=mysql

[[email protected] scripts]# chroot --userspec "mysql:mysql" "/" sh -c /stonedb56/install/bin/mysqld --defaults-file=/stonedb56/install/stonedb.cnf --user=mysql
2022-07-04 07:26:19 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-07-04 07:26:19 0 [Note] /stonedb56/install/bin/mysqld (mysqld 5.6.24-StoneDB-debug) starting as process 68820 ...
2022-07-04 07:26:19 68820 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)

2022-07-04 07:26:19 68820 [Warning] Buffered warning: Changed limits: table_open_cache: 431 (requested 2000)

2022-07-04 07:26:19 68820 [Note] InnoDB: Using atomics to ref count buffer pool pages
2022-07-04 07:26:19 7f98a0f27c80 InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!
2022-07-04 07:26:19 7f98a0f27c80 InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!
2022-07-04 07:26:19 68820 [Note] InnoDB: The InnoDB memory heap is disabled
2022-07-04 07:26:19 68820 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2022-07-04 07:26:19 68820 [Note] InnoDB: Memory barrier is not used
2022-07-04 07:26:19 68820 [Note] InnoDB: Compressed tables use zlib 1.2.3
2022-07-04 07:26:19 68820 [Note] InnoDB: Using CPU crc32 instructions
2022-07-04 07:26:19 68820 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2022-07-04 07:26:19 68820 [Note] InnoDB: Completed initialization of buffer pool
2022-07-04 07:26:19 68820 [Note] InnoDB: Highest supported file format is Barracuda.
2022-07-04 07:26:20 68820 [Note] InnoDB: 128 rollback segment(s) are active.
2022-07-04 07:26:20 68820 [Note] InnoDB: Waiting for purge to start
2022-07-04 07:26:20 68820 [Note] InnoDB: 5.6.24 started; log sequence number 1600637
2022-07-04 07:26:20 68820 [Note] Server hostname (bind-address): '*'; port: 3306
2022-07-04 07:26:20 68820 [Note] IPv6 is available.
2022-07-04 07:26:20 68820 [Note]   - '::' resolves to '::';
2022-07-04 07:26:20 68820 [Note] Server socket created on IP: '::'.
2022-07-04 07:26:20 68820 [Warning] Can't open and lock time zone table: Table 'mysql.time_zone_leap_second' doesn't exist trying to live without them
2022-07-04 07:26:20 68820 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'cond_instances' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_waits_current' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_waits_history' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_waits_history_long' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_host_by_event_name' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_instance' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_thread_by_event_name' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_user_by_event_name' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_account_by_event_name' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_waits_summary_global_by_event_name' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'file_instances' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'file_summary_by_event_name' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'file_summary_by_instance' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'host_cache' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'mutex_instances' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'objects_summary_global_by_type' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'performance_timers' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'rwlock_instances' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'setup_actors' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'setup_consumers' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'setup_instruments' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'setup_objects' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'setup_timers' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'table_io_waits_summary_by_index_usage' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'table_io_waits_summary_by_table' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'table_lock_waits_summary_by_table' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'threads' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_stages_current' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_stages_history' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_stages_history_long' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_stages_summary_by_thread_by_event_name' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_stages_summary_by_account_by_event_name' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_stages_summary_by_user_by_event_name' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_stages_summary_by_host_by_event_name' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_stages_summary_global_by_event_name' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_statements_current' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_statements_history' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_statements_history_long' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_thread_by_event_name' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_account_by_event_name' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_user_by_event_name' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_host_by_event_name' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_statements_summary_global_by_event_name' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_digest' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'users' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'accounts' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'hosts' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'socket_instances' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'socket_summary_by_instance' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'socket_summary_by_event_name' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'session_connect_attrs' has the wrong structure
2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'session_account_connect_attrs' has the wrong structure
2022-07-04 07:26:20 68820 [Note] /stonedb56/install/bin/mysqld: ready for connections.
Version: '5.6.24-StoneDB-debug'  socket: '/stonedb56/install/tmp/mysql.sock'  port: 3306  build-

三. 进入stonedb

/stonedb56/install/bin/mysql -uroot -p -S /stonedb56/install/tmp/mysql.sock
[[email protected] boost_1_66_0]# /stonedb56/install/bin/mysql -uroot -p -S /stonedb56/install/tmp/mysql.sock
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.24-StoneDB-debug build-

Copyright (c) 2000, 2022 StoneAtom Group Holding Limited
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
mysql> 
mysql> 
mysql> 
mysql> 
mysql> 
mysql> 
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| cache              |
| test               |
+--------------------+
3 rows in set (0.00 sec)

原网站

版权声明
本文为[帝尊悟世]所创,转载请带上原文链接,感谢
https://blog.csdn.net/adofsauron/article/details/125607208