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


    目录

    摘要:

    编译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. 存在第三方依赖,需要额外注意

    改动的代码:

     

    安装第三方依赖:

    基本依赖:

    1. yum install -y tree
    2. yum install -y gcc
    3. yum install -y gcc-c++
    4. yum install -y libzstd-devel
    5. yum install -y make
    6. yum install -y ncurses
    7. yum install -y ncurses-devel
    8. yum install -y bison
    9. yum install -y libaio
    10. yum install -y perl
    11. yum install -y perl-DBI
    12. yum install -y perl-DBD-MySQL
    13. yum install -y perl-Time-HiRes
    14. yum install -y readline-devel
    15. yum install -y numactl
    16. yum install -y zlib
    17. yum install -y zlib-devel
    18. yum install -y curldevel
    19. yum install -y openssl
    20. yum install -y openssl-devel
    21. yum install -y redhat-lsb-core
    22. yum install -y git
    23. yum install -y autoconf
    24. yum install -y automake
    25. yum install -y libtool
    26. yum install -y lrzsz
    27. yum install -y lz4
    28. yum install -y lz4-devel
    29. yum install -y snappy
    30. yum install -y snappy-devel
    31. yum install -y bzip2
    32. yum install -y bzip2-devel
    33. yum install -y zstd

    cmake:

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

    marisa

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

    rocksdb

    1. wget https://github.com/facebook/rocksdb/archive/refs/tags/v4.13.tar.gz
    2. tar -zxvf v4.13.tar.gz
    3. cd rocksdb-4.13
    4. make shared_lib
    5. make install-shared INSTALL_PATH=/usr/local/stonedb-gcc-rocksdb
    6. make static_lib
    7. make install-static INSTALL_PATH=/usr/local/stonedb-gcc-rocksdb

    boost_1_66_0

    1. wget https://nchc.dl.sourceforge.net/project/boost/boost/1.66.0/boost_1_66_0.tar.gz
    2. tar -xzvf boost_1_66_0.tar.gz
    3. cd boost_1_66_0
    4. ./bootstrap.sh
    5. ./b2 install --prefix=/usr/local/stonedb-boost
    6. 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

    1. [root@localhost stonedb]# scl enable devtoolset-7 bash
    2. [root@localhost stonedb]#
    3. [root@localhost stonedb]# g++ -v
    4. Using built-in specs.
    5. COLLECT_GCC=g++
    6. COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/lto-wrapper
    7. Target: x86_64-redhat-linux
    8. 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
    9. Thread model: posix
    10. gcc version 7.3.1 20180303 (Red Hat 7.3.1-5) (GCC)

    编译:

    编译脚本:

    1. cd scripts
    2. ./stonedb_build.sh

    编译结果:

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

    启动stonedb:

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

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

    二. 启动mysql服务:

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

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

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

    1. [root@localhost scripts]# chroot --userspec "mysql:mysql" "/" sh -c /stonedb56/install/bin/mysqld --defaults-file=/stonedb56/install/stonedb.cnf --user=mysql
    2. 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).
    3. 2022-07-04 07:26:19 0 [Note] /stonedb56/install/bin/mysqld (mysqld 5.6.24-StoneDB-debug) starting as process 68820 ...
    4. 2022-07-04 07:26:19 68820 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)
    5. 2022-07-04 07:26:19 68820 [Warning] Buffered warning: Changed limits: table_open_cache: 431 (requested 2000)
    6. 2022-07-04 07:26:19 68820 [Note] InnoDB: Using atomics to ref count buffer pool pages
    7. 2022-07-04 07:26:19 7f98a0f27c80 InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!
    8. 2022-07-04 07:26:19 7f98a0f27c80 InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!
    9. 2022-07-04 07:26:19 68820 [Note] InnoDB: The InnoDB memory heap is disabled
    10. 2022-07-04 07:26:19 68820 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
    11. 2022-07-04 07:26:19 68820 [Note] InnoDB: Memory barrier is not used
    12. 2022-07-04 07:26:19 68820 [Note] InnoDB: Compressed tables use zlib 1.2.3
    13. 2022-07-04 07:26:19 68820 [Note] InnoDB: Using CPU crc32 instructions
    14. 2022-07-04 07:26:19 68820 [Note] InnoDB: Initializing buffer pool, size = 128.0M
    15. 2022-07-04 07:26:19 68820 [Note] InnoDB: Completed initialization of buffer pool
    16. 2022-07-04 07:26:19 68820 [Note] InnoDB: Highest supported file format is Barracuda.
    17. 2022-07-04 07:26:20 68820 [Note] InnoDB: 128 rollback segment(s) are active.
    18. 2022-07-04 07:26:20 68820 [Note] InnoDB: Waiting for purge to start
    19. 2022-07-04 07:26:20 68820 [Note] InnoDB: 5.6.24 started; log sequence number 1600637
    20. 2022-07-04 07:26:20 68820 [Note] Server hostname (bind-address): '*'; port: 3306
    21. 2022-07-04 07:26:20 68820 [Note] IPv6 is available.
    22. 2022-07-04 07:26:20 68820 [Note] - '::' resolves to '::';
    23. 2022-07-04 07:26:20 68820 [Note] Server socket created on IP: '::'.
    24. 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
    25. 2022-07-04 07:26:20 68820 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
    26. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'cond_instances' has the wrong structure
    27. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_waits_current' has the wrong structure
    28. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_waits_history' has the wrong structure
    29. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_waits_history_long' has the wrong structure
    30. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_host_by_event_name' has the wrong structure
    31. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_instance' has the wrong structure
    32. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_thread_by_event_name' has the wrong structure
    33. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_user_by_event_name' has the wrong structure
    34. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_account_by_event_name' has the wrong structure
    35. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_waits_summary_global_by_event_name' has the wrong structure
    36. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'file_instances' has the wrong structure
    37. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'file_summary_by_event_name' has the wrong structure
    38. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'file_summary_by_instance' has the wrong structure
    39. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'host_cache' has the wrong structure
    40. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'mutex_instances' has the wrong structure
    41. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'objects_summary_global_by_type' has the wrong structure
    42. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'performance_timers' has the wrong structure
    43. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'rwlock_instances' has the wrong structure
    44. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'setup_actors' has the wrong structure
    45. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'setup_consumers' has the wrong structure
    46. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'setup_instruments' has the wrong structure
    47. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'setup_objects' has the wrong structure
    48. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'setup_timers' has the wrong structure
    49. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'table_io_waits_summary_by_index_usage' has the wrong structure
    50. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'table_io_waits_summary_by_table' has the wrong structure
    51. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'table_lock_waits_summary_by_table' has the wrong structure
    52. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'threads' has the wrong structure
    53. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_stages_current' has the wrong structure
    54. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_stages_history' has the wrong structure
    55. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_stages_history_long' has the wrong structure
    56. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_stages_summary_by_thread_by_event_name' has the wrong structure
    57. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_stages_summary_by_account_by_event_name' has the wrong structure
    58. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_stages_summary_by_user_by_event_name' has the wrong structure
    59. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_stages_summary_by_host_by_event_name' has the wrong structure
    60. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_stages_summary_global_by_event_name' has the wrong structure
    61. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_statements_current' has the wrong structure
    62. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_statements_history' has the wrong structure
    63. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_statements_history_long' has the wrong structure
    64. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_thread_by_event_name' has the wrong structure
    65. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_account_by_event_name' has the wrong structure
    66. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_user_by_event_name' has the wrong structure
    67. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_host_by_event_name' has the wrong structure
    68. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_statements_summary_global_by_event_name' has the wrong structure
    69. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_digest' has the wrong structure
    70. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'users' has the wrong structure
    71. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'accounts' has the wrong structure
    72. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'hosts' has the wrong structure
    73. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'socket_instances' has the wrong structure
    74. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'socket_summary_by_instance' has the wrong structure
    75. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'socket_summary_by_event_name' has the wrong structure
    76. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'session_connect_attrs' has the wrong structure
    77. 2022-07-04 07:26:20 68820 [ERROR] Native table 'performance_schema'.'session_account_connect_attrs' has the wrong structure
    78. 2022-07-04 07:26:20 68820 [Note] /stonedb56/install/bin/mysqld: ready for connections.
    79. 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
    1. [root@localhost boost_1_66_0]# /stonedb56/install/bin/mysql -uroot -p -S /stonedb56/install/tmp/mysql.sock
    2. Enter password:
    3. Welcome to the MySQL monitor. Commands end with ; or \g.
    4. Your MySQL connection id is 1
    5. Server version: 5.6.24-StoneDB-debug build-
    6. Copyright (c) 2000, 2022 StoneAtom Group Holding Limited
    7. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    8. mysql>
    9. mysql>
    10. mysql>
    11. mysql>
    12. mysql>
    13. mysql>
    14. mysql>
    15. mysql> show databases;
    16. +--------------------+
    17. | Database |
    18. +--------------------+
    19. | information_schema |
    20. | cache |
    21. | test |
    22. +--------------------+
    23. 3 rows in set (0.00 sec)

  • 相关阅读:
    如何把thinkphp5的项目迁移到阿里云函数计算来应对流量洪峰?
    nios里面打开eclipse遇到Unresolved inclusion: “system.h“等问题
    Unity引擎更新收费模式:从收入分成转向游戏安装量,将会有哪些影响呢
    Gem5 Fullsystem,Spec2017
    sys文件系统
    不用充值的OCR识别工具
    华大单片机KEIL报错_WEAK的解决方案
    线程池的使用、问题排查、源码分析等
    k8s中如何使用gpu、gpu资源讲解、nvidia gpu驱动安装
    常见磁盘调度算法总结
  • 原文地址:https://blog.csdn.net/adofsauron/article/details/125607208