未验证 提交 fde56c8a 编写于 作者: N Nliver 提交者: GitHub

docs(Compiling Methods): update the latest docs(#476) (#480)

* docs(release-notes): update the docs

* docs(Compiling Methods): update the docs
Co-authored-by: Nmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
上级 50865ef7
---
id: compile-using-centos7
sidebar_position: 5.12
id: compile-using-centos7-foe-56
sidebar_position: 5.12.1
---
# Compile StoneDB on CentOS 7
# Compile StoneDB for MySQL5.6 on CentOS 7
This topic describes how to compile StoneDB on CentOS 7.
## Precautions
Ensure that the tools and third-party libraries used in your environment meet the following version requirements:
......@@ -15,9 +16,9 @@ Ensure that the tools and third-party libraries used in your environment meet th
- marisa 0.77
- RocksDB 6.12.6
- Boost 1.66
- gtest
## Procedure
### Step 1. Install the dependencies
```shell
yum install -y tree
......@@ -60,9 +61,7 @@ yum install -y libicu-devel
yum install -y jemalloc-devel
```
### Step 2. Install GCC 9.3.0
Before performing the follow-up steps, you must ensure the GCC version is 9.3.0.
You can run the following command to check the GCC version.
Before performing the follow-up steps, you must ensure the GCC version is 9.3.0.<br />You can run the following command to check the GCC version.
```shell
gcc --version
```
......@@ -164,29 +163,10 @@ cd boost_1_66_0
```
The installation directory of Boost in the example is **/usr/local/stonedb-boost**. You can change it based on your actual conditions.
6. Install gtest.
The operations next are following [Build Google Gtest Instructions](https://github.com/google/googletest/tree/main/googletest#build-with-cmake).
```
$ sudo git clone https://github.com/google/googletest.git -b release-1.12.0
$ cd googletest
$ sudo mkdir build
$ cd build
$ sudo cmake .. -DBUILD_GMOCK=OFF
$ sudo make
$ sudo make install
```
Install in /usr/local/ by default.
```
$ ls /usr/local/include/
gtest
$ ls /usr/local/lib/
cmake libgtest.a libgtest_main.a pkgconfig python3.8
```
:::info
During the compilation, the occurrences of keywords **warning** and** failed** are normal, unless **error** is displayed and the CLI is automatically closed.<br />It takes about 25 minutes to install Boost.
:::
### Step 4. Compile StoneDB
Currently, StoneDB has two branches: StoneDB-5.6 (for MySQL 5.6) and StoneDB-5.7 (for MySQL 5.7). The link provided in this topic is to the source code package of StoneDB-5.7. In the following example,the source code package is saved to the root directory and is switched to StoneDB-5.6 for compilation.
```shell
......@@ -198,7 +178,7 @@ git checkout remotes/origin/stonedb-5.6
Before compilation, modify the compilation script as follows:
1. Change the installation directory of StoneDB based on your actual conditions. In the example, **/stonedb56/install** is used.
2. Change the installation directories of marisa, RocksDB, and Boost based on your actual conditions.
1. Change the installation directories of marisa, RocksDB, and Boost based on your actual conditions.
```shell
### Modify the compilation script.
cd /stonedb/scripts
......@@ -215,7 +195,7 @@ install_target=/stonedb56/install
### Execute the compilation script.
sh stonedb_build.sh
```
If your OS is CentOS or RHEL, you must comment out **os_dis** and **os_dist_release**, and modify the setting of **build_tag** to exclude the **os_dist** and **os_dist_release** parts. This is because the the values of **Distributor**, **Release**, and **Codename** output of the **lsb_release -a** command are **n/a**. Commenting out **os_dist** and **os_dist_release** only affects the names of the log file and the TAR package and has no impact on the compilation results.
If your OS is CentOS or RHEL, you must comment out **os_dis** and **os_dist_release**, and modify the setting of **build_tag** to exclude the **os_dist** and **os_dist_release** parts. This is because the the values of **Distributor**, **Release**, and **Codename **output of the **lsb_release -a** command are **n/a**. Commenting out **os_dist** and **os_dist_release** only affects the names of the log file and the TAR package and has no impact on the compilation results.
## **Step 5. Start StoneDB**
Users can start StoneDB in two ways: manual installation and automatic installation.
......@@ -228,7 +208,7 @@ passwd mysql
2. Manually install StoneDB.
If the installation directory after compilation is not **/stonedb56**, files **reinstall.sh**, **install.sh**, and **my.cnf** will not automatically generated. You need to manually create directories, and then initialize and start StoneDB. You also need to configure parameters in file **my.cnf**, including the installation directories and port.
If the installation directory after compilation is not **/stonedb56**, files **reinstall.sh**, **install.sh**, and **my.cnf **will not automatically generated. You need to manually create directories, and then initialize and start StoneDB. You also need to configure parameters in file **my.cnf**, including the installation directories and port.
```shell
### Create directories.
mkdir -p /data/stonedb56/install/data/innodb
......@@ -266,7 +246,7 @@ cd /stonedb56/install
Differences between **reinstall.sh** and **install.sh**:
- **reinstall.sh** is the script for automatic installation. When the script is being executed, directories are created, and StoneDB is initialized and started. Therefore, do not execute the script unless for the initial startup of StoneDB. Otherwise, all directories will be deleted and StoneDB will be initialized again.
- **install.sh** is the script for manual installation. You can specify the installation directories based on your needs and then execute the script. Same as **reinstall.sh**, when the script is being executed, directories are created, and StoneDB is initialized and started. Therefore, do not execute the script unless for the initial startup. Otherwise, all directories will be deleted and StoneDB will be initialized again.
- **install.sh **is the script for manual installation. You can specify the installation directories based on your needs and then execute the script. Same as **reinstall.sh**, when the script is being executed, directories are created, and StoneDB is initialized and started. Therefore, do not execute the script unless for the initial startup. Otherwise, all directories will be deleted and StoneDB will be initialized again.
:::
4. Log in to StoneDB.
......@@ -293,4 +273,4 @@ mysql> show databases;
| test |
+--------------------+
7 rows in set (0.00 sec)
```
```
\ No newline at end of file
---
id: compile-using-centos7-for-57
sidebar_position: 5.12.2
---
# Compile StoneDB for MySQL5.7 on CentOS 7
This topic describes how to compile StoneDB on CentOS 7.
## Precautions
Ensure that the tools and third-party libraries used in your environment meet the following version requirements:
- GCC 9.3.0
- Make 3.82 or later
- CMake 3.7.2 or later
- marisa 0.77
- RocksDB 6.12.6
- Boost 1.66
## Procedure
### Step 1. Install the dependencies
```shell
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 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
yum install -y libedit
yum install -y libedit-devel
yum install -y libaio-devel
yum install -y libicu
yum install -y libicu-devel
yum install -y jemalloc-devel
```
### Step 2. Install GCC 9.3.0
Before performing the follow-up steps, you must ensure the GCC version is 9.3.0.<br />You can run the following command to check the GCC version.
```shell
gcc --version
```
If the version is earlier than 9.3.0, perform the following steps to upgrade GCC.
1. Install the SCL utility.
```shell
yum install centos-release-scl scl-utils-build -y
```
2. Install GCC, GCC-C++, or GDB of version 9.3.0.
```shell
yum install devtoolset-9-gcc.x86_64 devtoolset-9-gcc-c++.x86_64 devtoolset-9-gcc-gdb-plugin.x86_64 -y
```
3. Switch the version to 9.3.0.
```shell
scl enable devtoolset-9 bash
```
4. Check that the version is switched to 9.3.0.
```shell
gcc --version
```
### Step 3. Install third-party libraries
Ensure that the CMake version in your environment is 3.7.2 or later and the Make version is 3.82 or later. Otherwise, install CMake, Make, or both of them of the correct versions.
:::info
StoneDB is dependent on marisa, RocksDB, and Boost. You are advised to specify paths for saving the these libraries when you install them, instead of using the default paths.
:::
1. Install CMake.
```shell
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
rm -rf /usr/bin/cmake
ln -s /usr/local/bin/cmake /usr/bin/
cmake --version
```
2. Install Make.
```shell
wget http://mirrors.ustc.edu.cn/gnu/make/make-3.82.tar.gz
tar -zxvf make-3.82.tar.gz
cd make-3.82
./configure --prefix=/usr/local/make
make && make install
rm -rf /usr/local/bin/make
ln -s /usr/local/make/bin/make /usr/local/bin/make
make --version
```
3. Install marisa.
```shell
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
```
The installation directory of marisa in the example is **/usr/local/stonedb-marisa**. You can change it based on your actual conditions.
4. Install RocksDB.
```shell
wget https://github.com/facebook/rocksdb/archive/refs/tags/v6.12.6.tar.gz
tar -zxvf v6.12.6.tar.gz
cd rocksdb-6.12.6
cmake ./ \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local/stonedb-gcc-rocksdb \
-DCMAKE_INSTALL_LIBDIR=/usr/local/stonedb-gcc-rocksdb \
-DWITH_JEMALLOC=ON \
-DWITH_SNAPPY=ON \
-DWITH_LZ4=ON \
-DWITH_ZLIB=ON \
-DWITH_ZSTD=ON \
-DUSE_RTTI=ON \
-DROCKSDB_BUILD_SHARED=ON \
-DWITH_GFLAGS=OFF \
-DWITH_TOOLS=OFF \
-DWITH_BENCHMARK_TOOLS=OFF \
-DWITH_CORE_TOOLS=OFF
make -j`nproc`
make install -j`nproc`
```
The installation directory of RocksDB in the example is **/usr/local/stonedb-gcc-rocksdb**. You can change it based on your actual conditions.
5. Install Boost.
```shell
wget https://sourceforge.net/projects/boost/files/boost/1.66.0/boost_1_66_0.tar.gz
tar -zxvf boost_1_66_0.tar.gz
cd boost_1_66_0
./bootstrap.sh --prefix=/usr/local/stonedb-boost
./b2 install --with=all
```
The installation directory of Boost in the example is **/usr/local/stonedb-boost**. You can change it based on your actual conditions.
:::info
During the compilation, the occurrences of keywords **warning** and** failed** are normal, unless **error** is displayed and the CLI is automatically closed.<br />It takes about 25 minutes to install Boost.
:::
6. Install Gtest.
```shell
git clone https://github.com/google/googletest.git -b release-1.12.0
cd googletest
mkdir build
cd build
cmake .. -DBUILD_GMOCK=OFF
make
make install
```
Install in /usr/local/ by default.
```shell
ls /usr/local/include/
...... gtest
ls /usr/local/lib/
...... cmake libgtest.a libgtest_main.a
```
### Step 4. Compile StoneDB
Currently, StoneDB has two branches: StoneDB-5.6 (for MySQL 5.6) and StoneDB-5.7 (for MySQL 5.7). The link provided in this topic is to the source code package of StoneDB-5.7. In the following example,the source code package is saved to the root directory.
```shell
cd /
git clone https://github.com/stoneatom/stonedb.git
```
Before compilation, modify the compilation script as follows:
1. Change the installation directory of StoneDB based on your actual conditions. In the example, **/stonedb57/install** is used.
1. Change the installation directories of marisa, RocksDB, and Boost based on your actual conditions.
```shell
### Modify the compilation script.
cd /stonedb/scripts
vim stonedb_build.sh
...
install_target=/stonedb57/install
...
-DDOWNLOAD_BOOST=0 \
-DWITH_BOOST=/usr/local/stonedb-boost/ \
-DWITH_MARISA=/usr/local/stonedb-marisa \
-DWITH_ROCKSDB=/usr/local/stonedb-gcc-rocksdb \
2>&1 | tee -a ${build_log}
### Execute the compilation script.
sh stonedb_build.sh
```
If your OS is CentOS or RHEL, you must comment out **os_dis** and **os_dist_release**, and modify the setting of **build_tag** to exclude the **os_dist** and **os_dist_release** parts. This is because the the values of **Distributor**, **Release**, and **Codename **output of the **lsb_release -a** command are **n/a**. Commenting out **os_dist** and **os_dist_release** only affects the names of the log file and the TAR package and has no impact on the compilation results.
## **Step 5. Start StoneDB**
Users can start StoneDB in two ways: manual installation and automatic installation.
1. Create an account.
```shell
groupadd mysql
useradd -g mysql mysql
passwd mysql
```
2. Manually install StoneDB.
You need to manually create directories, and then initialize and start StoneDB. You also need to configure parameters in file **my.cnf**, including the installation directories and port.
```shell
### Create directories.
mkdir -p /stonedb57/install/data
mkdir -p /stonedb57/install/binlog
mkdir -p /stonedb57/install/log
mkdir -p /stonedb57/install/tmp
mkdir -p /stonedb57/install/redolog
mkdir -p /stonedb57/install/undolog
chown -R mysql:mysql /stonedb57
### Configure parameters in my.cnf.
mv my.cnf my.cnf.bak
vim /stonedb57/install/my.cnf
[mysqld]
port = 3306
socket = /stonedb57/install/tmp/mysql.sock
basedir = /stonedb57/install
datadir = /stonedb57/install/data
pid_file = /stonedb57/install/data/mysqld.pid
log_error = /stonedb57/install/log/mysqld.log
innodb_log_group_home_dir = /stonedb57/install/redolog/
innodb_undo_directory = /stonedb57/install/undolog/
chown -R mysql:mysql /stonedb57/install/my.cnf
### Initialize StoneDB.
/stonedb57/install/bin/mysqld --defaults-file=/stonedb57/install/my.cnf --initialize --user=mysql
### Start StoneDB.
/stonedb57/install/bin/mysqld_safe --defaults-file=/stonedb57/install/my.cnf --user=mysql &
```
3. Execute reinstall.sh to automatically install StoneDB.
```shell
cd /stonedb57/install
./reinstall.sh
```
:::info
Differences between **reinstall.sh** and **install.sh**:
- **reinstall.sh** is the script for automatic installation. When the script is being executed, directories are created, and StoneDB is initialized and started. Therefore, do not execute the script unless for the initial startup of StoneDB. Otherwise, all directories will be deleted and StoneDB will be initialized again.
- **install.sh **is the script for manual installation. You can specify the installation directories based on your needs and then execute the script. Same as **reinstall.sh**, when the script is being executed, directories are created, and StoneDB is initialized and started. Therefore, do not execute the script unless for the initial startup. Otherwise, all directories will be deleted and StoneDB will be initialized again.
:::
4. Log in to StoneDB.
```shell
cat /stonedb57/install/log/mysqld.log |grep passwd
[Note] A temporary password is generated for root@localhost: ceMuEuj6l4+!
/stonedb57/install/bin/mysql -uroot -p -S /stonedb57/install/tmp/mysql.sock
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.36-StoneDB-debug-log build-
Copyright (c) 2021, 2022 StoneAtom Group Holding Limited
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> alter user 'root'@'localhost' identified by 'stonedb123';
```
:::info
The temporary password of user root is recorded in mysqld.log. Upon your first login, you must change the temporary password.
:::
---
id: compile-using-redhat7
sidebar_position: 5.13
id: compile-using-redhat7-for-56
sidebar_position: 5.13.1
---
# Compile StoneDB on RHEL 7
# Compile StoneDB for MySQL5.6 on RHEL 7
This topic describes how to compile StoneDB on Red Hat Enterprise Linux (RHEL) 7.
## Precautions
......@@ -15,8 +15,6 @@ Ensure that the tools and third-party libraries used in your environment meet th
- marisa 0.77
- RocksDB 6.12.6
- Boost 1.66
- gtest
## Procedure
### Step 1. Install the dependencies
```shell
......@@ -60,9 +58,7 @@ yum install -y libicu-devel
yum install -y jemalloc-devel
```
### Step 2. Install GCC 9.3.0
Before performing the follow-up steps, you must ensure the GCC version is 9.3.0.
You can run the following command to check the GCC version.
Before performing the follow-up steps, you must ensure the GCC version is 9.3.0.<br />You can run the following command to check the GCC version.
```shell
gcc --version
```
......@@ -163,31 +159,9 @@ cd boost_1_66_0
./b2 install --with=all
```
The installation directory of Boost in the example is **/usr/local/stonedb-boost**. You can change it based on your actual conditions.
6. Install gtest.
The operations next are following [Build Google Gtest Instructions](https://github.com/google/googletest/tree/main/googletest#build-with-cmake).
```
$ sudo git clone https://github.com/google/googletest.git -b release-1.12.0
$ cd googletest
$ sudo mkdir build
$ cd build
$ sudo cmake .. -DBUILD_GMOCK=OFF
$ sudo make
$ sudo make install
```
Install in /usr/local/ by default.
```
$ ls /usr/local/include/
gtest
$ ls /usr/local/lib/
cmake libgtest.a libgtest_main.a pkgconfig python3.8
```
:::info
During the compilation, the occurrences of keywords **warning** and** failed** are normal, unless **error** is displayed and the CLI is automatically closed.<br />It takes about 25 minutes to install Boost.
:::
### Step 4. Compile StoneDB
Currently, StoneDB has two branches: StoneDB-5.6 (for MySQL 5.6) and StoneDB-5.7 (for MySQL 5.7). The link provided in this topic is to the source code package of StoneDB-5.7. In the following example, the source code package is saved to the root directory and is switched to StoneDB-5.6 for compilation.
```shell
......@@ -216,8 +190,9 @@ install_target=/stonedb56/install
### Execute the compilation script.
sh stonedb_build.sh
```
If your OS is CentOS or RHEL, you must comment out **os_dis** and **os_dist_release**, and modify the setting of **build_tag** to exclude the **os_dist** and **os_dist_release** parts. This is because the the values of **Distributor**, **Release**, and **Codename** output of the **lsb_release -a** command are **n/a**. Commenting out **os_dist** and **os_dist_release** only affects the names of the log file and the TAR package and has no impact on the compilation results.
## **Step 5. Start StoneDB**
If your OS is CentOS or RHEL, you must comment out **os_dis** and **os_dist_release**, and modify the setting of **build_tag** to exclude the **os_dist** and **os_dist_release** parts. This is because the the values of **Distributor**, **Release**, and **Codename **output of the **lsb_release -a** command are **n/a**. Commenting out **os_dist** and **os_dist_release** only affects the names of the log file and the TAR package and has no impact on the compilation results.
### Step 5. Start StoneDB
Users can start StoneDB in two ways: manual installation and automatic installation.
1. Create an account.
......@@ -229,7 +204,7 @@ passwd mysql
2. Manually install StoneDB.
If the installation directory after compilation is not **/stonedb56**, files **reinstall.sh**, **install.sh**, and **my.cnf** will not automatically generated. You need to manually create directories, and then initialize and start StoneDB. You also need to configure parameters in file **my.cnf**, including the installation directories and port.
If the installation directory after compilation is not **/stonedb56**, files **reinstall.sh**, **install.sh**, and **my.cnf **will not automatically generated. You need to manually create directories, and then initialize and start StoneDB. You also need to configure parameters in file **my.cnf**, including the installation directories and port.
```shell
### Create directories.
mkdir -p /data/stonedb56/install/data/innodb
......@@ -267,7 +242,7 @@ cd /stonedb56/install
Differences between **reinstall.sh** and **install.sh**:
- **reinstall.sh** is the script for automatic installation. When the script is being executed, directories are created, and StoneDB is initialized and started. Therefore, do not execute the script unless for the initial startup of StoneDB. Otherwise, all directories will be deleted and StoneDB will be initialized again.
- **install.sh** is the script for manual installation. You can specify the installation directories based on your needs and then execute the script. Same as **reinstall.sh**, when the script is being executed, directories are created, and StoneDB is initialized and started. Therefore, do not execute the script unless for the initial startup. Otherwise, all directories will be deleted and StoneDB will be initialized again.
- **install.sh **is the script for manual installation. You can specify the installation directories based on your needs and then execute the script. Same as **reinstall.sh**, when the script is being executed, directories are created, and StoneDB is initialized and started. Therefore, do not execute the script unless for the initial startup. Otherwise, all directories will be deleted and StoneDB will be initialized again.
:::
4. Log in to StoneDB.
......@@ -294,4 +269,4 @@ mysql> show databases;
| test |
+--------------------+
7 rows in set (0.00 sec)
```
```
\ No newline at end of file
---
id: compile-using-redhat7-for-57
sidebar_position: 5.13.2
---
# Compile StoneDB for MySQL5.7 on RHEL 7
This topic describes how to compile StoneDB on Red Hat Enterprise Linux (RHEL) 7.
## Precautions
Ensure that the tools and third-party libraries used in your environment meet the following version requirements:
- GCC 9.3.0
- Make 3.82 or later
- CMake 3.7.2 or later
- marisa 0.77
- RocksDB 6.12.6
- Boost 1.66
## Procedure
### Step 1. Install the dependencies
```shell
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 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
yum install -y libedit
yum install -y libedit-devel
yum install -y libaio-devel
yum install -y libicu
yum install -y libicu-devel
yum install -y jemalloc-devel
```
### Step 2. Install GCC 9.3.0
Before performing the follow-up steps, you must ensure the GCC version is 9.3.0.<br />You can run the following command to check the GCC version.
```shell
gcc --version
```
If the version is earlier than 9.3.0, perform the following steps to upgrade GCC.
1. Install the SCL utility.
```shell
yum install centos-release-scl scl-utils-build -y
```
2. Install GCC, GCC-C++, or GDB of version 9.3.0.
```shell
yum install devtoolset-9-gcc.x86_64 devtoolset-9-gcc-c++.x86_64 devtoolset-9-gcc-gdb-plugin.x86_64 -y
```
3. Switch the version to 9.3.0.
```shell
scl enable devtoolset-9 bash
```
4. Check that the version is switched to 9.3.0.
```shell
gcc --version
```
### Step 3. Install third-party libraries
Ensure that the CMake version in your environment is 3.7.2 or later and the Make version is 3.82 or later. Otherwise, install CMake, Make, or both of them of the correct versions.
:::info
StoneDB is dependent on marisa, RocksDB, and Boost. You are advised to specify paths for saving the these libraries when you install them, instead of using the default paths.
:::
1. Install CMake.
```shell
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
rm -rf /usr/bin/cmake
ln -s /usr/local/bin/cmake /usr/bin/
cmake --version
```
2. Install Make.
```shell
wget http://mirrors.ustc.edu.cn/gnu/make/make-3.82.tar.gz
tar -zxvf make-3.82.tar.gz
cd make-3.82
./configure --prefix=/usr/local/make
make && make install
rm -rf /usr/local/bin/make
ln -s /usr/local/make/bin/make /usr/local/bin/make
make --version
```
3. Install marisa.
```shell
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
```
The installation directory of marisa in the example is **/usr/local/stonedb-marisa**. You can change it based on your actual conditions.
4. Install RocksDB.
```shell
wget https://github.com/facebook/rocksdb/archive/refs/tags/v6.12.6.tar.gz
tar -zxvf v6.12.6.tar.gz
cd rocksdb-6.12.6
cmake ./ \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local/stonedb-gcc-rocksdb \
-DCMAKE_INSTALL_LIBDIR=/usr/local/stonedb-gcc-rocksdb \
-DWITH_JEMALLOC=ON \
-DWITH_SNAPPY=ON \
-DWITH_LZ4=ON \
-DWITH_ZLIB=ON \
-DWITH_ZSTD=ON \
-DUSE_RTTI=ON \
-DROCKSDB_BUILD_SHARED=ON \
-DWITH_GFLAGS=OFF \
-DWITH_TOOLS=OFF \
-DWITH_BENCHMARK_TOOLS=OFF \
-DWITH_CORE_TOOLS=OFF
make -j`nproc`
make install -j`nproc`
```
The installation directory of RocksDB in the example is **/usr/local/stonedb-gcc-rocksdb**. You can change it based on your actual conditions.
5. Install Boost.
```shell
wget https://sourceforge.net/projects/boost/files/boost/1.66.0/boost_1_66_0.tar.gz
tar -zxvf boost_1_66_0.tar.gz
cd boost_1_66_0
./bootstrap.sh --prefix=/usr/local/stonedb-boost
./b2 install --with=all
```
The installation directory of Boost in the example is **/usr/local/stonedb-boost**. You can change it based on your actual conditions.
:::info
During the compilation, the occurrences of keywords **warning** and** failed** are normal, unless **error** is displayed and the CLI is automatically closed.<br />It takes about 25 minutes to install Boost.
:::
6. Install Gtest.
```shell
git clone https://github.com/google/googletest.git -b release-1.12.0
cd googletest
mkdir build
cd build
cmake .. -DBUILD_GMOCK=OFF
make
make install
```
Install in /usr/local/ by default.
```shell
ls /usr/local/include/
...... gtest
ls /usr/local/lib/
...... cmake libgtest.a libgtest_main.a
```
### Step 4. Compile StoneDB
Currently, StoneDB has two branches: StoneDB-5.6 (for MySQL 5.6) and StoneDB-5.7 (for MySQL 5.7). The link provided in this topic is to the source code package of StoneDB-5.7. In the following example, the source code package is saved to the root directory.
```shell
cd /
git clone https://github.com/stoneatom/stonedb.git
```
Before compilation, modify the compilation script as follows:
1. Change the installation directory of StoneDB based on your actual conditions. In the example, **/stonedb57/install** is used.
1. Change the installation directories of marisa, RocksDB, and Boost based on your actual conditions.
```shell
### Modify the compilation script.
cd /stonedb/scripts
vim stonedb_build.sh
...
install_target=/stonedb57/install
...
-DDOWNLOAD_BOOST=0 \
-DWITH_BOOST=/usr/local/stonedb-boost/ \
-DWITH_MARISA=/usr/local/stonedb-marisa \
-DWITH_ROCKSDB=/usr/local/stonedb-gcc-rocksdb \
2>&1 | tee -a ${build_log}
### Execute the compilation script.
sh stonedb_build.sh
```
If your OS is CentOS or RHEL, you must comment out **os_dis** and **os_dist_release**, and modify the setting of **build_tag** to exclude the **os_dist** and **os_dist_release** parts. This is because the the values of **Distributor**, **Release**, and **Codename** output of the **lsb_release -a** command are **n/a**. Commenting out **os_dist** and **os_dist_release** only affects the names of the log file and the TAR package and has no impact on the compilation results.
### Step 5. Start StoneDB
Users can start StoneDB in two ways: manual installation and automatic installation.
1. Create an account.
```shell
groupadd mysql
useradd -g mysql mysql
passwd mysql
```
2. Manually install StoneDB.
You need to manually create directories, and then initialize and start StoneDB. You also need to configure parameters in file **my.cnf**, including the installation directories and port.
```shell
### Create directories.
mkdir -p /stonedb57/install/data
mkdir -p /stonedb57/install/binlog
mkdir -p /stonedb57/install/log
mkdir -p /stonedb57/install/tmp
mkdir -p /stonedb57/install/redolog
mkdir -p /stonedb57/install/undolog
chown -R mysql:mysql /stonedb57
### Configure parameters in my.cnf.
mv my.cnf my.cnf.bak
vim /stonedb57/install/my.cnf
[mysqld]
port = 3306
socket = /stonedb57/install/tmp/mysql.sock
basedir = /stonedb57/install
datadir = /stonedb57/install/data
pid_file = /stonedb57/install/data/mysqld.pid
log_error = /stonedb57/install/log/mysqld.log
innodb_log_group_home_dir = /stonedb57/install/redolog/
innodb_undo_directory = /stonedb57/install/undolog/
chown -R mysql:mysql /stonedb57/install/my.cnf
### Initialize StoneDB.
/stonedb57/install/bin/mysqld --defaults-file=/stonedb57/install/my.cnf --initialize --user=mysql
### Start StoneDB.
/stonedb57/install/bin/mysqld_safe --defaults-file=/stonedb57/install/my.cnf --user=mysql &
```
3. Execute **reinstall.sh** to automatically install StoneDB.
```shell
cd /stonedb57/install
./reinstall.sh
```
:::info
Differences between **reinstall.sh** and **install.sh**:
- **reinstall.sh** is the script for automatic installation. When the script is being executed, directories are created, and StoneDB is initialized and started. Therefore, do not execute the script unless for the initial startup of StoneDB. Otherwise, all directories will be deleted and StoneDB will be initialized again.
- **install.sh** is the script for manual installation. You can specify the installation directories based on your needs and then execute the script. Same as **reinstall.sh**, when the script is being executed, directories are created, and StoneDB is initialized and started. Therefore, do not execute the script unless for the initial startup. Otherwise, all directories will be deleted and StoneDB will be initialized again.
:::
4. Log in to StoneDB.
```shell
cat /stonedb57/install/log/mysqld.log |grep passwd
[Note] A temporary password is generated for root@localhost: ceMuEuj6l4+!
/stonedb57/install/bin/mysql -uroot -p -S /stonedb57/install/tmp/mysql.sock
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.36-StoneDB-debug-log build-
Copyright (c) 2021, 2022 StoneAtom Group Holding Limited
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> alter user 'root'@'localhost' identified by 'stonedb123';
```
:::info
The temporary password of user root is recorded in mysqld.log. Upon your first login, you must change the temporary password.
:::
---
id: compile-using-ubuntu20.04
sidebar_position: 5.14
id: compile-using-ubuntu20.04-for-56
sidebar_position: 5.14.1
---
# Compile StoneDB on Ubuntu 20.04
# Compile StoneDB for MySQL5.6 on Ubuntu 20.04
This topic describes how to compile StoneDB on Ubuntu 20.04.
This topic describes how to compile StoneDB for MySQL5.6 on Ubuntu 20.04.
## Precautions
Ensure that the tools and third-party libraries used in your environment meet the following version requirements:
......@@ -15,8 +15,6 @@ Ensure that the tools and third-party libraries used in your environment meet th
- marisa 0.77
- RocksDB 6.12.6
- Boost 1.66
- gtest
## Procedure
### Step 1. Install the dependencies
```shell
......@@ -102,10 +100,9 @@ autoreconf -i
sudo make && make install
```
The installation directory of marisa in the example is** /usr/local/stonedb-marisa**. You can change it based on your actual conditions. In this step, the following directories and files are generated in **/usr/local/stonedb-marisa/lib**.
![](./5.6-marisa.png)
![](./marisa.png)
4. Install RocksDB.
1. Install RocksDB.
```shell
wget https://github.com/facebook/rocksdb/archive/refs/tags/v6.12.6.tar.gz
tar -zxvf v6.12.6.tar.gz
......@@ -132,9 +129,9 @@ sudo make install -j`nproc`
```
The installation directory of RocksDB in the example is **/usr/local/stonedb-gcc-rocksdb**. You can change it based on your actual conditions. In this step, the following directories and files are generated in **/usr/local/stonedb-gcc-rocksdb**.
![](./rocksdb.png)
![](./5.6-rocksdb.png)
5. Install Boost.
1. Install Boost.
```shell
wget https://sourceforge.net/projects/boost/files/boost/1.66.0/boost_1_66_0.tar.gz
tar -zxvf boost_1_66_0.tar.gz
......@@ -144,27 +141,7 @@ cd boost_1_66_0
```
The installation directory of Boost in the example is **/usr/local/stonedb-boost**. You can change it based on your actual conditions. In this step, the following directories and files are generated in **/usr/local/stonedb-boost/lib**.
![image.png](./boost.png)
6. Install gtest.
The operations next are following [Build Google Gtest Instructions](https://github.com/google/googletest/tree/main/googletest#build-with-cmake).
```
$ sudo git clone https://github.com/google/googletest.git -b release-1.12.0
$ cd googletest
$ sudo mkdir build
$ cd build
$ sudo cmake .. -DBUILD_GMOCK=OFF
$ sudo make
$ sudo make install
```
Install in /usr/local/ by default.
```
$ ls /usr/local/include/
gtest
$ ls /usr/local/lib/
cmake libgtest.a libgtest_main.a pkgconfig python3.8
```
![image.png](./5.6-boost.png)
:::info
During the compilation, the occurrences of keywords **warning** and** failed** are normal, unless **error** is displayed and the CLI is automatically closed.<br />It takes about 25 minutes to install Boost.
......@@ -180,7 +157,7 @@ git checkout remotes/origin/stonedb-5.6
Before compilation, modify the compilation script as follows:
1. Change the installation directory of StoneDB based on your actual conditions. In the example, **/stonedb56/install** is used.
2. Change the installation directories of marisa, RocksDB, and Boost based on your actual conditions.
1. Change the installation directories of marisa, RocksDB, and Boost based on your actual conditions.
```shell
### Modify the compilation script.
cd /stonedb/scripts
......@@ -198,7 +175,7 @@ install_target=/stonedb56/install
sh stonedb_build.sh
```
If your OS is CentOS or RHEL, you must comment out **os_dis** and **os_dist_release**, and modify the setting of **build_tag** to exclude the **os_dist** and **os_dist_release** parts. This is because the the values of **Distributor**, **Release**, and **Codename** output of the `lsb_release -a` command are **n/a**. Commenting out **os_dist** and **os_dist_release** only affects the names of the log file and the TAR package and has no impact on the compilation results.
### Step 4. Start StoneDB
## Step 4. Start StoneDB
Users can start StoneDB in two ways: manual installation and automatic installation.
1. Create an account.
......@@ -255,7 +232,7 @@ Differences between **reinstall.sh** and **install.sh**:
```shell
/stonedb56/install/bin/mysql -uroot -p -S /stonedb56/install/tmp/mysql.sock
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.24-StoneDB-debug build-
......@@ -275,4 +252,4 @@ mysql> show databases;
| test |
+--------------------+
7 rows in set (0.00 sec)
```
```
\ No newline at end of file
---
id: compile-using-ubuntu20.04-for-57
sidebar_position: 5.14.2
---
# Compile StoneDB for MySQL5.7 on Ubuntu 20.04
This topic describes how to compile StoneDB for MySQL5.7 on Ubuntu 20.04.
## Precautions
Ensure that the tools and third-party libraries used in your environment meet the following version requirements:
- GCC 9.4.0
- Make 3.82 or later
- CMake 3.7.2 or later
- marisa 0.77
- RocksDB 6.12.6
- Boost 1.66
## Procedure
### Step 1. Install the dependencies
```shell
sudo apt install -y gcc
sudo apt install -y g++
sudo apt install -y make
sudo apt install -y cmake
sudo apt install -y build-essential
sudo apt install -y autoconf
sudo apt install -y tree
sudo apt install -y bison
sudo apt install -y git
sudo apt install -y libtool
sudo apt install -y numactl
sudo apt install -y python3-dev
sudo apt install -y openssl
sudo apt install -y perl
sudo apt install -y binutils
sudo apt install -y libgmp-dev
sudo apt install -y libmpfr-dev
sudo apt install -y libmpc-dev
sudo apt install -y libisl-dev
sudo apt install -y zlib1g-dev
sudo apt install -y liblz4-dev
sudo apt install -y libbz2-dev
sudo apt install -y libzstd-dev
sudo apt install -y zstd
sudo apt install -y lz4
sudo apt install -y ncurses-dev
sudo apt install -y libsnappy-dev
sudo apt install -y libedit-dev
sudo apt install -y libaio-dev
sudo apt install -y libncurses5-dev
sudo apt install -y libreadline-dev
sudo apt install -y libpam0g-dev
sudo apt install -y zlib1g-dev
sudo apt install -y libicu-dev
sudo apt install -y libboost-dev
sudo apt install -y libgflags-dev
sudo apt install -y libjemalloc-dev
sudo apt install -y libssl-dev
sudo apt install -y pkg-config
```
:::info
Ensure that all the dependencies are installed. Otherwise, a large number of errors will be reported.
:::
### Step 2. Install third-party dependencies
Ensure that the CMake version in your environment is 3.7.2 or later and the Make version is 3.82 or later. Otherwise, install CMake, Make, or both of them of the correct versions.
:::info
StoneDB is dependent on marisa, RocksDB, and Boost. You are advised to specify paths for saving the these libraries when you install them, instead of using the default paths.
:::
1. Install CMake.
```shell
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/
cmake --version
```
2. Install Make.
```shell
wget http://mirrors.ustc.edu.cn/gnu/make/make-3.82.tar.gz
tar -zxvf make-3.82.tar.gz
cd make-3.82
./configure --prefix=/usr/local/make
make && make install
rm -rf /usr/local/bin/make
ln -s /usr/local/make/bin/make /usr/local/bin/make
make --version
```
3. Install marisa.
```shell
git clone https://github.com/s-yata/marisa-trie.git
cd marisa-trie
autoreconf -i
./configure --enable-native-code --prefix=/usr/local/stonedb-marisa
sudo make && make install
```
The installation directory of marisa in the example is** /usr/local/stonedb-marisa**. You can change it based on your actual conditions. In this step, the following directories and files are generated in **/usr/local/stonedb-marisa/lib**.
![](./5.7-marisa.png)
1. Install RocksDB.
```shell
wget https://github.com/facebook/rocksdb/archive/refs/tags/v6.12.6.tar.gz
tar -zxvf v6.12.6.tar.gz
cd rocksdb-6.12.6
sudo cmake ./ \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local/stonedb-gcc-rocksdb \
-DCMAKE_INSTALL_LIBDIR=/usr/local/stonedb-gcc-rocksdb \
-DWITH_JEMALLOC=ON \
-DWITH_SNAPPY=ON \
-DWITH_LZ4=ON \
-DWITH_ZLIB=ON \
-DWITH_ZSTD=ON \
-DUSE_RTTI=ON \
-DROCKSDB_BUILD_SHARED=ON \
-DWITH_GFLAGS=OFF \
-DWITH_TOOLS=OFF \
-DWITH_BENCHMARK_TOOLS=OFF \
-DWITH_CORE_TOOLS=OFF
sudo make -j`nproc`
sudo make install -j`nproc`
```
The installation directory of RocksDB in the example is **/usr/local/stonedb-gcc-rocksdb**. You can change it based on your actual conditions. In this step, the following directories and files are generated in **/usr/local/stonedb-gcc-rocksdb**
![](./5.7-rocksdb.png)
1. Install Boost.
```shell
wget https://sourceforge.net/projects/boost/files/boost/1.66.0/boost_1_66_0.tar.gz
tar -zxvf boost_1_66_0.tar.gz
cd boost_1_66_0
./bootstrap.sh --prefix=/usr/local/stonedb-boost
./b2 install --with=all
```
The installation directory of Boost in the example is **/usr/local/stonedb-boost**. You can change it based on your actual conditions. In this step, the following directories and files are generated in **/usr/local/stonedb-boost/lib**.
![image.png](./5.7-boost.png)
:::info
During the compilation, the occurrences of keywords **warning** and** failed** are normal, unless **error** is displayed and the CLI is automatically closed.<br />It takes about 25 minutes to install Boost.
:::
1. Install Gtest.
```shell
sudo git clone https://github.com/google/googletest.git -b release-1.12.0
cd googletest
sudo mkdir build
cd build
sudo cmake .. -DBUILD_GMOCK=OFF
sudo make
sudo make install
```
Install in /usr/local/ by default.
```shell
ls /usr/local/include/
...... gtest
ls /usr/local/lib/
...... cmake libgtest.a libgtest_main.a
```
### Step 3. Compile StoneDB
Currently, StoneDB has two branches: StoneDB-5.6 (for MySQL 5.6) and StoneDB-5.7 (for MySQL 5.7). The link provided in this topic is to the source code package of StoneDB-5.7. In the following example, the source code package is saved to the root directory.
```shell
cd /
git clone https://github.com/stoneatom/stonedb.git
```
Before compilation, modify the compilation script as follows:
1. Change the installation directory of StoneDB based on your actual conditions. In the example, **/stonedb57/install** is used.
1. Change the installation directories of marisa, RocksDB, and Boost based on your actual conditions.
```shell
### Modify the compilation script.
cd /stonedb/scripts
vim stonedb_build.sh
...
install_target=/stonedb57/install
...
-DDOWNLOAD_BOOST=0 \
-DWITH_BOOST=/usr/local/stonedb-boost/ \
-DWITH_MARISA=/usr/local/stonedb-marisa \
-DWITH_ROCKSDB=/usr/local/stonedb-gcc-rocksdb \
2>&1 | tee -a ${build_log}
### Execute the compilation script.
sh stonedb_build.sh
```
If your OS is CentOS or RHEL, you must comment out **os_dis** and **os_dist_release**, and modify the setting of **build_tag** to exclude the **os_dist** and **os_dist_release** parts. This is because the the values of **Distributor**, **Release**, and **Codename** output of the `lsb_release -a` command are **n/a**. Commenting out **os_dist** and **os_dist_release** only affects the names of the log file and the TAR package and has no impact on the compilation results.
### Step 4. Start StoneDB
Users can start StoneDB in two ways: manual installation and automatic installation.
1. Create an account.
```shell
groupadd mysql
useradd -g mysql mysql
passwd mysql
```
2. Manually install StoneDB.
You need to manually create directories, and then initialize and start StoneDB. You also need to configure parameters in file **my.cnf**, including the installation directories and port.
```shell
### Create directories.
mkdir -p /stonedb57/install/data
mkdir -p /stonedb57/install/binlog
mkdir -p /stonedb57/install/log
mkdir -p /stonedb57/install/tmp
mkdir -p /stonedb57/install/redolog
mkdir -p /stonedb57/install/undolog
chown -R mysql:mysql /stonedb57
### Configure parameters in my.cnf.
mv my.cnf my.cnf.bak
vim /stonedb57/install/my.cnf
[mysqld]
port = 3306
socket = /stonedb57/install/tmp/mysql.sock
basedir = /stonedb57/install
datadir = /stonedb57/install/data
pid_file = /stonedb57/install/data/mysqld.pid
log_error = /stonedb57/install/log/mysqld.log
innodb_log_group_home_dir = /stonedb57/install/redolog/
innodb_undo_directory = /stonedb57/install/undolog/
chown -R mysql:mysql /stonedb57/install/my.cnf
### Initialize StoneDB.
/stonedb57/install/bin/mysqld --defaults-file=/stonedb57/install/my.cnf --initialize --user=mysql
### Start StoneDB.
/stonedb57/install/bin/mysqld_safe --defaults-file=/stonedb57/install/my.cnf --user=mysql &
```
3. Execute **reinstall.sh** to automatically install StoneDB.
```shell
cd /stonedb57/install
./reinstall.sh
```
:::info
Differences between **reinstall.sh** and **install.sh**:
- **reinstall.sh** is the script for automatic installation. When the script is being executed, directories are created, and StoneDB is initialized and started. Therefore, do not execute the script unless for the initial startup of StoneDB. Otherwise, all directories will be deleted and StoneDB will be initialized again.
- **install.sh** is the script for manual installation. You can specify the installation directories based on your needs and then execute the script. Same as **reinstall.sh**, when the script is being executed, directories are created, and StoneDB is initialized and started. Therefore, do not execute the script unless for the initial startup. Otherwise, all directories will be deleted and StoneDB will be initialized again.
:::
4. Log in to StoneDB.
```shell
cat /stonedb57/install/log/mysqld.log |grep passwd
[Note] A temporary password is generated for root@localhost: ceMuEuj6l4+!
/stonedb57/install/bin/mysql -uroot -p -S /stonedb57/install/tmp/mysql.sock
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.36-StoneDB-debug-log build-
Copyright (c) 2021, 2022 StoneAtom Group Holding Limited
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> alter user 'root'@'localhost' identified by 'stonedb123';
```
:::info
The temporary password of user root is recorded in mysqld.log. Upon your first login, you must change the temporary password.
:::
\ No newline at end of file
......@@ -5,5 +5,59 @@ sidebar_position: 11.0
# Release Notes
## StoneDB-5.7-V1.0.0
Changes in StoneDB_5.7_v1.0.0 (2022-08-31, General Availability)
- Support for MySQL 5.7
- Functionality Added or Changed
- Compilation Notes
- Configuration Notes
- Document Notes
- Bugs Fixed
Support for MySQL 5.7
- Important Change: The Tianmu engine supports MySQL 5.7,base line edition MySQL 5.7.36. This change applies to the StoneDB database which would be fully compatible with the MySQL 5.7 protocols.
Functionality Added or Changed
- Important Change: The engine name has been changed to tianmu. StoneDB is used as a HTAP database name, it is not suitable for used both as an engine name. As the dissusion result, we choose tianmu as our new eninge name:
```bash
mysql> show engines;
+----------------+---------+--------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+----------------+---------+--------------------------+--------------+------+------------+
| TIANMU | DEFAULT | Tianmu storage engine | YES | NO | NO |
+----------------+---------+--------------------------+--------------+------+------------+
```
- Tianmu: Improved the aggregation capabilities of the decimal data type.
- Tianmu: Improved the readability of code. The code does not spererate logically, or the variables name can not be understooed by the literal meaning. To refactor code make it more readable to anyone who are the first to read that. For example: Changes int DoGetSomething(); to int GetSomethingXXX();, int GetNoNulls() to int GetNumOfNulls().
- Tianmu: The date-related functions (such as DATE_ADD, DATE_SUB) can be queried (DATE_ADD|DATE_SUB) when creating view using the date func.([BUG #342](https://github.com/stoneatom/stonedb/issues/342))
Compilation Notes
- The version of the Boost library for server builds is now 1.66.0.
- The version of the Rocksdb for server builds is now 6.12.6.
Configuration Notes
- Important Change: Changed default config file stonedb.cnf to my.cnf. ([feature #182](https://github.com/stoneatom/stonedb/issues/182))
- Important Change: Use tianmu as the default storage engine. ([feature #255](https://github.com/stoneatom/stonedb/issues/255))
Document Notes
- The manual has been updated as the code was modified. ( [# address](https://stonedb.io/))
Bugs Fixed
- fix mtr case: [BUG #78](https://github.com/stoneatom/stonedb/issues/78), [BUG #73](https://github.com/stoneatom/stonedb/issues/73),[ BUG #170](https://github.com/stoneatom/stonedb/issues/170), [BUG #192](https://github.com/stoneatom/stonedb/issues/192), [BUG #191](https://github.com/stoneatom/stonedb/issues/191), [BUG #227](https://github.com/stoneatom/stonedb/issues/227), [BUG #245](https://github.com/stoneatom/stonedb/issues/245), BUG #263
- fix Tianmu bug: [BUG #338](https://github.com/stoneatom/stonedb/issues/388),[ BUG #327](https://github.com/stoneatom/stonedb/issues/327), [BUG #212](https://github.com/stoneatom/stonedb/issues/212), [BUG #142](https://github.com/stoneatom/stonedb/issues/142)
## StoneDB-5.6-V1.0.0
Release time: June 30, 2022
---
id: compile-using-redhat7
sidebar_position: 5.13
id: compile-using-centos7-56
sidebar_position: 5.12.1
---
# RedHat 7 下编译StoneDB
# CentOS 7 下编译 StoneDB for MySQL5.6
编译工具以及第三方库的版本要求如下。
......@@ -146,7 +146,13 @@ cd boost_1_66_0
./bootstrap.sh --prefix=/usr/local/stonedb-boost
./b2 install --with=all
```
boost 的安装路径可以根据实际情况指定,示例中的安装路径是 /usr/local/stonedb-boost。<br />注:在编译过程中,除非有关键字 "error" 报错自动退出,否则出现关键字 "warning"、"failed"是正常的,安装 boost 大概需要25分钟左右。
boost 的安装路径可以根据实际情况指定,示例中的安装路径是 /usr/local/stonedb-boost。
:::info
在编译过程中,除非有关键字 "error" 报错自动退出,否则出现关键字 "warning"、"failed"是正常的,安装 boost 大概需要25分钟左右。
:::
## 第四步:执行编译
StoneDB 现有 5.6 和 5.7 两个分支,下载的源码包默认是 5.7 分支。下载的源码包存放路径可根据实际情况指定,示例中的源码包存放路径是在根目录下,并且是切换为 5.6 分支的编译安装。
```shell
......@@ -155,11 +161,7 @@ git clone https://github.com/stoneatom/stonedb.git
cd stonedb
git checkout remotes/origin/stonedb-5.6
```
在执行编译脚本前,需要修改编译脚本的两处内容:
1)StoneDB 安装目录,可根据实际情况修改,示例中的安装目录是 /stonedb56/install;
2)marisa、rocksdb、boost 的实际安装路径,必须与上文安装 marisa、rocksdb、boost 的路径保持一致。
在执行编译脚本前,需要修改编译脚本的两处内容:<br />1)StoneDB 安装目录,可根据实际情况修改,示例中的安装目录是 /stonedb56/install;<br />2)marisa、rocksdb、boost 的实际安装路径,必须与上文安装 marisa、rocksdb、boost 的路径保持一致。
```shell
###修改编译脚本
cd /stonedb/scripts
......@@ -176,7 +178,10 @@ install_target=/stonedb56/install
###执行编译脚本
sh stonedb_build.sh
```
注:如果是 CentOS/RedHat ,需要注释 os_dist 和 os_dist_release,并且修改 build_tag ,这是因为 "lsb_release -a" 返回的结果中,Distributor、Release、Codename 显示的是 n/a。注释 os_dist 和 os_dist_release 只会影响产生的日志名和 tar 包名,不会影响编译结果。
:::info
如果是 CentOS/RedHat ,需要注释 os_dist 和 os_dist_release,并且修改 build_tag ,这是因为 "lsb_release -a" 返回的结果中,Distributor、Release、Codename 显示的是 n/a。注释 os_dist 和 os_dist_release 只会影响产生的日志名和 tar 包名,不会影响编译结果。
:::
## 第五步:启动实例
用户可按照手动安装和自动安装两种方式启动 StoneDB。
### 1. 创建用户
......@@ -218,7 +223,10 @@ chown -R mysql:mysql /data/stonedb56/install/my.cnf
cd /stonedb56/install
./reinstall.sh
```
注:reinstall.sh 与 install.sh 的区别?<br />reinstall.sh 是自动化安装脚本,执行脚本的过程是创建目录、初始化实例和启动实例的过程,只在第一次使用,其他任何时候使用都会删除整个目录,重新初始化数据库。install.sh 是手动安装提供的示例脚本,用户可根据自定义的安装目录修改路径,然后执行脚本,执行脚本的过程也是创建目录、初始化实例和启动实例。以上两个脚本都只能在第一次使用。
:::info
reinstall.sh 与 install.sh 的区别?<br />reinstall.sh 是自动化安装脚本,执行脚本的过程是创建目录、初始化实例和启动实例的过程,只在第一次使用,其他任何时候使用都会删除整个目录,重新初始化数据库。install.sh 是手动安装提供的示例脚本,用户可根据自定义的安装目录修改路径,然后执行脚本,执行脚本的过程也是创建目录、初始化实例和启动实例。以上两个脚本都只能在第一次使用。
:::
### 4. 执行登录
```shell
/stonedb56/install/bin/mysql -uroot -p -S /stonedb56/install/tmp/mysql.sock
......
---
id: compile-using-centos7-57
sidebar_position: 5.12.2
---
# CentOS 7 下编译 StoneDB for MySQL5.7
编译工具以及第三方库的版本要求如下。
| 编译工具及第三方库 | 版本要求 |
| --- | --- |
| gcc | 9.3.0 |
| make | 3.82 |
| cmake | 3.7.2 |
| marisa | 0.77 |
| rocksdb | 6.12.6 |
| boost | 1.66 |
## 第一步:安装依赖包
```shell
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 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
yum install -y libedit
yum install -y libedit-devel
yum install -y libaio-devel
yum install -y libicu
yum install -y libicu-devel
yum install -y jemalloc-devel
```
## 第二步:安装 gcc 9.3.0
通过执行以下语句,检查当前 gcc 版本是否符合安装要求。
```shell
gcc --version
```
如果版本不符合要求,按照以下步骤将 gcc 切换为正确版本。
### 1. 安装 scl 源
```shell
yum install centos-release-scl scl-utils-build -y
```
### 2. 安装 9.3.0 版本的 gcc、gcc-c++、gdb
```shell
yum install devtoolset-9-gcc.x86_64 devtoolset-9-gcc-c++.x86_64 devtoolset-9-gcc-gdb-plugin.x86_64 -y
```
### 3. 切换至 9.3.0 版本
```shell
scl enable devtoolset-9 bash
```
### 4. 版本检查
```shell
gcc --version
```
## 第三步:安装第三方库
安装第三库前需要确认 cmake 版本是3.7.2以上,make 版本是3.82以上,如果低于这两个版本,需要进行安装。StoneDB 依赖 marisa、rocksdb、boost,在编译 marisa、rocksdb、boost 时,建议指定安装路径。示例中我们指定了 marisa、rocksdb、boost 的安装路径。
### 1. 安装 cmake
```shell
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
rm -rf /usr/bin/cmake
ln -s /usr/local/bin/cmake /usr/bin/
cmake --version
```
### 2. 安装 make
```shell
wget http://mirrors.ustc.edu.cn/gnu/make/make-3.82.tar.gz
tar -zxvf make-3.82.tar.gz
cd make-3.82
./configure --prefix=/usr/local/make
make && make install
rm -rf /usr/local/bin/make
ln -s /usr/local/make/bin/make /usr/local/bin/make
make --version
```
### 3. 安装 marisa
```shell
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
```
marisa 的安装路径可以根据实际情况指定,示例中的安装路径是 /usr/local/stonedb-marisa。
### 4. 安装 rocksdb
```shell
wget https://github.com/facebook/rocksdb/archive/refs/tags/v6.12.6.tar.gz
tar -zxvf v6.12.6.tar.gz
cd rocksdb-6.12.6
cmake ./ \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local/stonedb-gcc-rocksdb \
-DCMAKE_INSTALL_LIBDIR=/usr/local/stonedb-gcc-rocksdb \
-DWITH_JEMALLOC=ON \
-DWITH_SNAPPY=ON \
-DWITH_LZ4=ON \
-DWITH_ZLIB=ON \
-DWITH_ZSTD=ON \
-DUSE_RTTI=ON \
-DROCKSDB_BUILD_SHARED=ON \
-DWITH_GFLAGS=OFF \
-DWITH_TOOLS=OFF \
-DWITH_BENCHMARK_TOOLS=OFF \
-DWITH_CORE_TOOLS=OFF
make -j`nproc`
make install -j`nproc`
```
rocksdb 的安装路径可以根据实际情况指定,示例中的安装路径是 /usr/local/stonedb-gcc-rocksdb。
### 5. 安装 boost
```shell
wget https://sourceforge.net/projects/boost/files/boost/1.66.0/boost_1_66_0.tar.gz
tar -zxvf boost_1_66_0.tar.gz
cd boost_1_66_0
./bootstrap.sh --prefix=/usr/local/stonedb-boost
./b2 install --with=all
```
boost 的安装路径可以根据实际情况指定,示例中的安装路径是 /usr/local/stonedb-boost。
:::info
注:在编译过程中,除非有关键字 "error" 报错自动退出,否则出现关键字 "warning"、"failed"是正常的,安装 boost 大概需要25分钟左右。
:::
### 6. 安装 gtest
```shell
git clone https://github.com/google/googletest.git -b release-1.12.0
cd googletest
mkdir build
cd build
cmake .. -DBUILD_GMOCK=OFF
make
make install
```
gtest 默认安装在 /usr/local
```shell
ls /usr/local/include/
...... gtest
ls /usr/local/lib/
...... cmake libgtest.a libgtest_main.a
```
## 第四步:执行编译
StoneDB 现有 5.6 和 5.7 两个分支,下载的源码包默认是 5.7 分支。下载的源码包存放路径可根据实际情况指定,示例中的源码包存放路径是在根目录下。
```shell
cd /
git clone https://github.com/stoneatom/stonedb.git
```
在执行编译脚本前,需要修改编译脚本的两处内容:<br />1)StoneDB 安装目录,可根据实际情况修改,示例中的安装目录是 /stonedb57/install,目录需要提前创建;<br />2)marisa、rocksdb、boost 的实际安装路径,必须与上文安装 marisa、rocksdb、boost 的路径保持一致。
```shell
###修改编译脚本
cd /stonedb/scripts
vim stonedb_build.sh
...
install_target=/stonedb57/install
...
-DDOWNLOAD_BOOST=0 \
-DWITH_BOOST=/usr/local/stonedb-boost/ \
-DWITH_MARISA=/usr/local/stonedb-marisa \
-DWITH_ROCKSDB=/usr/local/stonedb-gcc-rocksdb \
2>&1 | tee -a ${build_log}
###执行编译脚本
sh stonedb_build.sh
```
:::info
如果是 CentOS/RedHat ,需要注释 os_dist 和 os_dist_release,并且修改 build_tag ,这是因为 "lsb_release -a" 返回的结果中,Distributor、Release、Codename 显示的是 n/a。注释 os_dist 和 os_dist_release 只会影响产生的日志名和 tar 包名,不会影响编译结果。
:::
## 第五步:启动实例
用户可按照手动安装和自动安装两种方式启动 StoneDB。
### 1. 创建用户
```shell
groupadd mysql
useradd -g mysql mysql
passwd mysql
```
### 2. 手动安装
手动创建目录、初始化和启动实例,还需要配置 my.cnf 文件,如安装目录,端口等参数。
```shell
###创建目录
mkdir -p /stonedb57/install/data
mkdir -p /stonedb57/install/binlog
mkdir -p /stonedb57/install/log
mkdir -p /stonedb57/install/tmp
mkdir -p /stonedb57/install/redolog
mkdir -p /stonedb57/install/undolog
chown -R mysql:mysql /stonedb57
###配置my.cnf
mv my.cnf my.cnf.bak
vim /stonedb57/install/my.cnf
[mysqld]
port = 3306
socket = /stonedb57/install/tmp/mysql.sock
basedir = /stonedb57/install
datadir = /stonedb57/install/data
pid_file = /stonedb57/install/data/mysqld.pid
log_error = /stonedb57/install/log/mysqld.log
innodb_log_group_home_dir = /stonedb57/install/redolog/
innodb_undo_directory = /stonedb57/install/undolog/
chown -R mysql:mysql /stonedb57/install/my.cnf
###初始化实例
/stonedb57/install/bin/mysqld --defaults-file=/stonedb57/install/my.cnf --initialize --user=mysql
###启动实例
/stonedb57/install/bin/mysqld_safe --defaults-file=/stonedb57/install/my.cnf --user=mysql &
```
### 3. 自动安装
编译完成后,在安装目录下会自动生成 reinstall.sh、install.sh 和 my.cnf 文件,执行 reinstall.sh 就是创建目录、初始化实例和启动实例的过程。
```shell
cd /stonedb57/install
./reinstall.sh
```
:::info
reinstall.sh 与 install.sh 的区别?<br />reinstall.sh 是自动化安装脚本,执行脚本的过程是创建目录、初始化实例和启动实例的过程,只在第一次使用,其他任何时候使用都会删除整个目录,重新初始化数据库。install.sh 是手动安装提供的示例脚本,用户可根据自定义的安装目录修改路径,然后执行脚本,执行脚本的过程也是创建目录、初始化实例和启动实例。以上两个脚本都只能在第一次使用。
:::
### 4. 执行登录
```shell
cat /stonedb57/install/log/mysqld.log |grep passwd
[Note] A temporary password is generated for root@localhost: ceMuEuj6l4+!
/stonedb57/install/bin/mysql -uroot -p -S /stonedb57/install/tmp/mysql.sock
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.36-StoneDB-debug-log build-
Copyright (c) 2021, 2022 StoneAtom Group Holding Limited
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> alter user 'root'@'localhost' identified by 'stonedb123';
```
注:管理员用户的临时密码在 mysqld.log 中,第一次登陆后需要修改管理员用户的密码。
---
id: compile-using-centos7
sidebar_position: 5.12
id: compile-using-redhat7-for-56
sidebar_position: 5.13.1
---
# CentOS 7 下编译StoneDB
# RedHat 7 下编译 StoneDB for MySQL5.6
编译工具以及第三方库的版本要求如下。
......@@ -146,7 +146,11 @@ cd boost_1_66_0
./bootstrap.sh --prefix=/usr/local/stonedb-boost
./b2 install --with=all
```
boost 的安装路径可以根据实际情况指定,示例中的安装路径是 /usr/local/stonedb-boost。<br />注:在编译过程中,除非有关键字 "error" 报错自动退出,否则出现关键字 "warning"、"failed"是正常的,安装 boost 大概需要25分钟左右。
boost 的安装路径可以根据实际情况指定,示例中的安装路径是 /usr/local/stonedb-boost。
:::info
注:在编译过程中,除非有关键字 "error" 报错自动退出,否则出现关键字 "warning"、"failed"是正常的,安装 boost 大概需要25分钟左右。
:::
## 第四步:执行编译
StoneDB 现有 5.6 和 5.7 两个分支,下载的源码包默认是 5.7 分支。下载的源码包存放路径可根据实际情况指定,示例中的源码包存放路径是在根目录下,并且是切换为 5.6 分支的编译安装。
```shell
......@@ -176,7 +180,9 @@ install_target=/stonedb56/install
###执行编译脚本
sh stonedb_build.sh
```
注:如果是 CentOS/RedHat ,需要注释 os_dist 和 os_dist_release,并且修改 build_tag ,这是因为 "lsb_release -a" 返回的结果中,Distributor、Release、Codename 显示的是 n/a。注释 os_dist 和 os_dist_release 只会影响产生的日志名和 tar 包名,不会影响编译结果。
:::info
如果是 CentOS/RedHat ,需要注释 os_dist 和 os_dist_release,并且修改 build_tag ,这是因为 "lsb_release -a" 返回的结果中,Distributor、Release、Codename 显示的是 n/a。注释 os_dist 和 os_dist_release 只会影响产生的日志名和 tar 包名,不会影响编译结果。
:::
## 第五步:启动实例
用户可按照手动安装和自动安装两种方式启动 StoneDB。
### 1. 创建用户
......@@ -218,7 +224,9 @@ chown -R mysql:mysql /data/stonedb56/install/my.cnf
cd /stonedb56/install
./reinstall.sh
```
注:reinstall.sh 与 install.sh 的区别?<br />reinstall.sh 是自动化安装脚本,执行脚本的过程是创建目录、初始化实例和启动实例的过程,只在第一次使用,其他任何时候使用都会删除整个目录,重新初始化数据库。install.sh 是手动安装提供的示例脚本,用户可根据自定义的安装目录修改路径,然后执行脚本,执行脚本的过程也是创建目录、初始化实例和启动实例。以上两个脚本都只能在第一次使用。
:::info
reinstall.sh 与 install.sh 的区别?<br />reinstall.sh 是自动化安装脚本,执行脚本的过程是创建目录、初始化实例和启动实例的过程,只在第一次使用,其他任何时候使用都会删除整个目录,重新初始化数据库。install.sh 是手动安装提供的示例脚本,用户可根据自定义的安装目录修改路径,然后执行脚本,执行脚本的过程也是创建目录、初始化实例和启动实例。以上两个脚本都只能在第一次使用。
:::
### 4. 执行登录
```shell
/stonedb56/install/bin/mysql -uroot -p -S /stonedb56/install/tmp/mysql.sock
......@@ -243,4 +251,4 @@ mysql> show databases;
| test |
+--------------------+
7 rows in set (0.00 sec)
```
```
\ No newline at end of file
---
id: compile-using-redhat7-for-56
sidebar_position: 5.13.2
---
# RedHat 7 下编译 StoneDB for MySQL5.7
编译工具以及第三方库的版本要求如下。
| 编译工具及第三方库 | 版本要求 |
| --- | --- |
| gcc | 9.3.0 |
| make | 3.82 |
| cmake | 3.7.2 |
| marisa | 0.77 |
| rocksdb | 6.12.6 |
| boost | 1.66 |
## 第一步:安装依赖包
```shell
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 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
yum install -y libedit
yum install -y libedit-devel
yum install -y libaio-devel
yum install -y libicu
yum install -y libicu-devel
yum install -y jemalloc-devel
```
## 第二步:安装 gcc 9.3.0
通过执行以下语句,检查当前 gcc 版本是否符合安装要求。
```shell
gcc --version
```
如果版本不符合要求,按照以下步骤将 gcc 切换为正确版本。
### 1. 安装 scl 源
```shell
yum install centos-release-scl scl-utils-build -y
```
### 2. 安装 9.3.0 版本的 gcc、gcc-c++、gdb
```shell
yum install devtoolset-9-gcc.x86_64 devtoolset-9-gcc-c++.x86_64 devtoolset-9-gcc-gdb-plugin.x86_64 -y
```
### 3. 切换至 9.3.0 版本
```shell
scl enable devtoolset-9 bash
```
### 4. 版本检查
```shell
gcc --version
```
## 第三步:安装第三方库
安装第三库前需要确认 cmake 版本是3.7.2以上,make 版本是3.82以上,如果低于这两个版本,需要进行安装。StoneDB 依赖 marisa、rocksdb、boost,在编译 marisa、rocksdb、boost 时,建议指定安装路径。示例中我们指定了 marisa、rocksdb、boost 的安装路径。
### 1. 安装 cmake
```shell
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
rm -rf /usr/bin/cmake
ln -s /usr/local/bin/cmake /usr/bin/
cmake --version
```
### 2. 安装 make
```shell
wget http://mirrors.ustc.edu.cn/gnu/make/make-3.82.tar.gz
tar -zxvf make-3.82.tar.gz
cd make-3.82
./configure --prefix=/usr/local/make
make && make install
rm -rf /usr/local/bin/make
ln -s /usr/local/make/bin/make /usr/local/bin/make
make --version
```
### 3. 安装 marisa
```shell
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
```
marisa 的安装路径可以根据实际情况指定,示例中的安装路径是 /usr/local/stonedb-marisa。
### 4. 安装 rocksdb
```shell
wget https://github.com/facebook/rocksdb/archive/refs/tags/v6.12.6.tar.gz
tar -zxvf v6.12.6.tar.gz
cd rocksdb-6.12.6
cmake ./ \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local/stonedb-gcc-rocksdb \
-DCMAKE_INSTALL_LIBDIR=/usr/local/stonedb-gcc-rocksdb \
-DWITH_JEMALLOC=ON \
-DWITH_SNAPPY=ON \
-DWITH_LZ4=ON \
-DWITH_ZLIB=ON \
-DWITH_ZSTD=ON \
-DUSE_RTTI=ON \
-DROCKSDB_BUILD_SHARED=ON \
-DWITH_GFLAGS=OFF \
-DWITH_TOOLS=OFF \
-DWITH_BENCHMARK_TOOLS=OFF \
-DWITH_CORE_TOOLS=OFF
make -j`nproc`
make install -j`nproc`
```
rocksdb 的安装路径可以根据实际情况指定,示例中的安装路径是 /usr/local/stonedb-gcc-rocksdb。
### 5. 安装 boost
```shell
wget https://sourceforge.net/projects/boost/files/boost/1.66.0/boost_1_66_0.tar.gz
tar -zxvf boost_1_66_0.tar.gz
cd boost_1_66_0
./bootstrap.sh --prefix=/usr/local/stonedb-boost
./b2 install --with=all
```
boost 的安装路径可以根据实际情况指定,示例中的安装路径是 /usr/local/stonedb-boost。
:::info
注:在编译过程中,除非有关键字 "error" 报错自动退出,否则出现关键字 "warning"、"failed"是正常的,安装 boost 大概需要25分钟左右。
:::
### 6. 安装 gtest
```shell
git clone https://github.com/google/googletest.git -b release-1.12.0
cd googletest
mkdir build
cd build
cmake .. -DBUILD_GMOCK=OFF
make
make install
```
gtest 默认安装在 /usr/local
```shell
ls /usr/local/include/
...... gtest
ls /usr/local/lib/
...... cmake libgtest.a libgtest_main.a
```
## 第四步:执行编译
StoneDB 现有 5.6 和 5.7 两个分支,下载的源码包默认是 5.7 分支。下载的源码包存放路径可根据实际情况指定,示例中的源码包存放路径是在根目录下。
```shell
cd /
git clone https://github.com/stoneatom/stonedb.git
```
在执行编译脚本前,需要修改编译脚本的两处内容:<br />1)StoneDB 安装目录,可根据实际情况修改,示例中的安装目录是 /stonedb57/install,目录需要提前创建;<br />2)marisa、rocksdb、boost 的实际安装路径,必须与上文安装 marisa、rocksdb、boost 的路径保持一致。
```shell
###修改编译脚本
cd /stonedb/scripts
vim stonedb_build.sh
...
install_target=/stonedb57/install
...
-DDOWNLOAD_BOOST=0 \
-DWITH_BOOST=/usr/local/stonedb-boost/ \
-DWITH_MARISA=/usr/local/stonedb-marisa \
-DWITH_ROCKSDB=/usr/local/stonedb-gcc-rocksdb \
2>&1 | tee -a ${build_log}
###执行编译脚本
sh stonedb_build.sh
```
注:如果是 CentOS/RedHat ,需要注释 os_dist 和 os_dist_release,并且修改 build_tag ,这是因为 "lsb_release -a" 返回的结果中,Distributor、Release、Codename 显示的是 n/a。注释 os_dist 和 os_dist_release 只会影响产生的日志名和 tar 包名,不会影响编译结果。
## 第五步:启动实例
用户可按照手动安装和自动安装两种方式启动 StoneDB。
### 1. 创建用户
```shell
groupadd mysql
useradd -g mysql mysql
passwd mysql
```
### 2. 手动安装
手动创建目录、初始化和启动实例,还需要配置 my.cnf 文件,如安装目录,端口等参数。
```shell
###创建目录
mkdir -p /stonedb57/install/data
mkdir -p /stonedb57/install/binlog
mkdir -p /stonedb57/install/log
mkdir -p /stonedb57/install/tmp
mkdir -p /stonedb57/install/redolog
mkdir -p /stonedb57/install/undolog
chown -R mysql:mysql /stonedb57
###配置my.cnf
mv my.cnf my.cnf.bak
vim /stonedb57/install/my.cnf
[mysqld]
port = 3306
socket = /stonedb57/install/tmp/mysql.sock
basedir = /stonedb57/install
datadir = /stonedb57/install/data
pid_file = /stonedb57/install/data/mysqld.pid
log_error = /stonedb57/install/log/mysqld.log
innodb_log_group_home_dir = /stonedb57/install/redolog/
innodb_undo_directory = /stonedb57/install/undolog/
chown -R mysql:mysql /stonedb57/install/my.cnf
###初始化实例
/stonedb57/install/bin/mysqld --defaults-file=/stonedb57/install/my.cnf --initialize --user=mysql
###启动实例
/stonedb57/install/bin/mysqld_safe --defaults-file=/stonedb57/install/my.cnf --user=mysql &
```
### 3. 自动安装
编译完成后,在安装目录下会自动生成 reinstall.sh、install.sh 和 my.cnf 文件,执行 reinstall.sh 就是创建目录、初始化实例和启动实例的过程。
```shell
cd /stonedb56/install
./reinstall.sh
```
:::info
reinstall.sh 与 install.sh 的区别?<br />reinstall.sh 是自动化安装脚本,执行脚本的过程是创建目录、初始化实例和启动实例的过程,只在第一次使用,其他任何时候使用都会删除整个目录,重新初始化数据库。install.sh 是手动安装提供的示例脚本,用户可根据自定义的安装目录修改路径,然后执行脚本,执行脚本的过程也是创建目录、初始化实例和启动实例。以上两个脚本都只能在第一次使用。
:::
### 4. 执行登录
```shell
cat /stonedb57/install/log/mysqld.log |grep passwd
[Note] A temporary password is generated for root@localhost: ceMuEuj6l4+!
/stonedb57/install/bin/mysql -uroot -p -S /stonedb57/install/tmp/mysql.sock
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.36-StoneDB-debug-log build-
Copyright (c) 2021, 2022 StoneAtom Group Holding Limited
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> alter user 'root'@'localhost' identified by 'stonedb123';
```
注:管理员用户的临时密码在 mysqld.log 中,第一次登陆后需要修改管理员用户的密码。
---
id: compile-using-ubuntu20.04
sidebar_position: 5.14
id: compile-using-ubuntu20.04-for-56
sidebar_position: 5.14.1
---
# Ubuntu 20.04 下编译StoneDB
# Ubuntu 20.04 下编译 StoneDB for MySQL5.6
编译工具以及第三方库的版本要求如下。
......@@ -58,11 +58,11 @@ sudo apt install -y libjemalloc-dev
sudo apt install -y libssl-dev
sudo apt install -y pkg-config
```
:::caution
注:依赖包必须都装上,否则后面有很多报错。
:::
## 第二步:安装第三方库
安装第三库前需要确认 cmake 版本是3.7.2以上,make 版本是3.82以上,如果低于这两个版本,需要进行安装。StoneDB 依赖 marisa、rocksdb、boost,在编译 marisa、rocksdb、boost 时,建议指定安装路径。示例中我们指定了 marisa、rocksdb、boost 的安装路径。
### 1. 安装 cmake
```shell
wget https://cmake.org/files/v3.7/cmake-3.7.2.tar.gz
......@@ -95,7 +95,7 @@ sudo make && make install
```
marisa 的安装路径可以根据实际情况指定,示例中的安装路径是 /usr/local/stonedb-marisa。此步骤会在 /usr/local/stonedb-marisa/lib 下生成如下目录和文件。
![marisa](./libmarisa.png)
![](./5.6-marisa.png)
### 4. 安装 rocksdb
```shell
......@@ -124,7 +124,8 @@ sudo make install -j`nproc`
```
rocksdb 的安装路径可以根据实际情况指定,示例中的安装路径是 /usr/local/stonedb-gcc-rocksdb。此步骤会在 /usr/local/stonedb-gcc-rocksdb 下生成如下目录和文件。
![rocksdb](./librocksdb.png)
![](./5.6-rocksdb.png)
### 5. 安装 boost
```shell
wget https://sourceforge.net/projects/boost/files/boost/1.66.0/boost_1_66_0.tar.gz
......@@ -135,13 +136,12 @@ cd boost_1_66_0
```
boost 的安装路径可以根据实际情况指定,示例中的安装路径是 /usr/local/stonedb-boost。此步骤会在 /usr/local/stonedb-boost/lib 下生成如下目录和文件。
![boost](./libboost.png)
![image.png](./5.6-boost.png)
:::info
在编译过程中,除非有关键字 "error" 报错自动退出,否则出现关键字 "warning"、"failed"是正常的,安装 boost 大概需要25分钟左右。
:::
## 第三步:执行编译
StoneDB 现有 5.6 和 5.7 两个分支,下载的源码包默认是 5.7 分支。下载的源码包存放路径可根据实际情况指定,示例中的源码包存放路径是在根目录下,并且是切换为 5.6 分支的编译安装。
```shell
......@@ -150,11 +150,7 @@ git clone https://github.com/stoneatom/stonedb.git
cd stonedb
git checkout remotes/origin/stonedb-5.6
```
在执行编译脚本前,需要修改编译脚本的两处内容:
1)StoneDB 安装目录,可根据实际情况修改,示例中的安装目录是 /stonedb56/install;
2)marisa、rocksdb、boost 的实际安装路径,必须与上文安装 marisa、rocksdb、boost 的路径保持一致。
在执行编译脚本前,需要修改编译脚本的两处内容:<br />1)StoneDB 安装目录,可根据实际情况修改,示例中的安装目录是 /stonedb56/install;<br />2)marisa、rocksdb、boost 的实际安装路径,必须与上文安装 marisa、rocksdb、boost 的路径保持一致。
```shell
###修改编译脚本
cd /stonedb/scripts
......@@ -171,7 +167,9 @@ install_target=/stonedb56/install
###执行编译脚本
sh stonedb_build.sh
```
注:如果是 CentOS/RedHat ,需要注释 os_dist 和 os_dist_release,并且修改 build_tag ,这是因为 "lsb_release -a" 返回的结果中,Distributor、Release、Codename 显示的是 n/a。注释 os_dist 和 os_dist_release 只会影响产生的日志名和 tar 包名,不会影响编译结果。
:::info
如果是 CentOS/RedHat ,需要注释 os_dist 和 os_dist_release,并且修改 build_tag ,这是因为 "lsb_release -a" 返回的结果中,Distributor、Release、Codename 显示的是 n/a。注释 os_dist 和 os_dist_release 只会影响产生的日志名和 tar 包名,不会影响编译结果。
:::
## 第四步:启动实例
用户可按照手动安装和自动安装两种方式启动 StoneDB。
### 1. 创建用户
......@@ -213,11 +211,8 @@ chown -R mysql:mysql /data/stonedb56/install/my.cnf
cd /stonedb56/install
./reinstall.sh
```
:::note
**注:reinstall.sh 与 install.sh 的区别?**
*reinstall.sh* 是自动化安装脚本,执行脚本的过程是创建目录、初始化实例和启动实例的过程,只在第一次使用,其他任何时候使用都会删除整个目录,重新初始化数据库。install.sh 是手动安装提供的示例脚本,用户可根据自定义的安装目录修改路径,然后执行脚本,执行脚本的过程也是创建目录、初始化实例和启动实例。以上两个脚本都只能在第一次使用。
:::info
reinstall.sh 与 install.sh 的区别?<br />reinstall.sh 是自动化安装脚本,执行脚本的过程是创建目录、初始化实例和启动实例的过程,只在第一次使用,其他任何时候使用都会删除整个目录,重新初始化数据库。install.sh 是手动安装提供的示例脚本,用户可根据自定义的安装目录修改路径,然后执行脚本,执行脚本的过程也是创建目录、初始化实例和启动实例。以上两个脚本都只能在第一次使用。
:::
### 4. 执行登录
```shell
......@@ -243,4 +238,4 @@ mysql> show databases;
| test |
+--------------------+
7 rows in set (0.00 sec)
```
\ No newline at end of file
```
---
id: compile-using-ubuntu20.04-for-56
sidebar_position: 5.14.2
---
# Ubuntu 20.04 下编译 StoneDB for MySQL5.7
编译工具以及第三方库的版本要求如下。
| 编译工具及第三方库 | 版本要求 |
| --- | --- |
| gcc | 9.4.0 |
| make | 3.82 |
| cmake | 3.7.2 |
| marisa | 0.77 |
| rocksdb | 6.12.6 |
| boost | 1.66 |
## 第一步:安装依赖包
```shell
sudo apt install -y gcc
sudo apt install -y g++
sudo apt install -y make
sudo apt install -y cmake
sudo apt install -y build-essential
sudo apt install -y autoconf
sudo apt install -y tree
sudo apt install -y bison
sudo apt install -y git
sudo apt install -y libtool
sudo apt install -y numactl
sudo apt install -y python3-dev
sudo apt install -y openssl
sudo apt install -y perl
sudo apt install -y binutils
sudo apt install -y libgmp-dev
sudo apt install -y libmpfr-dev
sudo apt install -y libmpc-dev
sudo apt install -y libisl-dev
sudo apt install -y zlib1g-dev
sudo apt install -y liblz4-dev
sudo apt install -y libbz2-dev
sudo apt install -y libzstd-dev
sudo apt install -y zstd
sudo apt install -y lz4
sudo apt install -y ncurses-dev
sudo apt install -y libsnappy-dev
sudo apt install -y libedit-dev
sudo apt install -y libaio-dev
sudo apt install -y libncurses5-dev
sudo apt install -y libreadline-dev
sudo apt install -y libpam0g-dev
sudo apt install -y zlib1g-dev
sudo apt install -y libicu-dev
sudo apt install -y libboost-dev
sudo apt install -y libgflags-dev
sudo apt install -y libjemalloc-dev
sudo apt install -y libssl-dev
sudo apt install -y pkg-config
```
注:依赖包必须都装上,否则后面有很多报错。
## 第二步:安装第三方库
安装第三库前需要确认 cmake 版本是3.7.2以上,make 版本是3.82以上,如果低于这两个版本,需要进行安装。StoneDB 依赖 marisa、rocksdb、boost,在编译 marisa、rocksdb、boost 时,建议指定安装路径。示例中我们指定了 marisa、rocksdb、boost 的安装路径。
### 1. 安装 cmake
```shell
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/
cmake --version
```
### 2. 安装 make
```shell
wget http://mirrors.ustc.edu.cn/gnu/make/make-3.82.tar.gz
tar -zxvf make-3.82.tar.gz
cd make-3.82
./configure --prefix=/usr/local/make
make && make install
rm -rf /usr/local/bin/make
ln -s /usr/local/make/bin/make /usr/local/bin/make
make --version
```
### 3. 安装 marisa
```shell
git clone https://github.com/s-yata/marisa-trie.git
cd marisa-trie
autoreconf -i
./configure --enable-native-code --prefix=/usr/local/stonedb-marisa
sudo make && make install
```
marisa 的安装路径可以根据实际情况指定,示例中的安装路径是 /usr/local/stonedb-marisa。此步骤会在 /usr/local/stonedb-marisa/lib 下生成如下目录和文件。
![](./5.7-marisa.png)
### 4. 安装 rocksdb
```shell
wget https://github.com/facebook/rocksdb/archive/refs/tags/v6.12.6.tar.gz
tar -zxvf v6.12.6.tar.gz
cd rocksdb-6.12.6
sudo cmake ./ \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local/stonedb-gcc-rocksdb \
-DCMAKE_INSTALL_LIBDIR=/usr/local/stonedb-gcc-rocksdb \
-DWITH_JEMALLOC=ON \
-DWITH_SNAPPY=ON \
-DWITH_LZ4=ON \
-DWITH_ZLIB=ON \
-DWITH_ZSTD=ON \
-DUSE_RTTI=ON \
-DROCKSDB_BUILD_SHARED=ON \
-DWITH_GFLAGS=OFF \
-DWITH_TOOLS=OFF \
-DWITH_BENCHMARK_TOOLS=OFF \
-DWITH_CORE_TOOLS=OFF
sudo make -j`nproc`
sudo make install -j`nproc`
```
rocksdb 的安装路径可以根据实际情况指定,示例中的安装路径是 /usr/local/stonedb-gcc-rocksdb。此步骤会在 /usr/local/stonedb-gcc-rocksdb 下生成如下目录和文件。
![](./5.7-rocksdb.png)
### 5. 安装 boost
```shell
wget https://sourceforge.net/projects/boost/files/boost/1.66.0/boost_1_66_0.tar.gz
tar -zxvf boost_1_66_0.tar.gz
cd boost_1_66_0
./bootstrap.sh --prefix=/usr/local/stonedb-boost
./b2 install --with=all
```
boost 的安装路径可以根据实际情况指定,示例中的安装路径是 /usr/local/stonedb-boost。此步骤会在 /usr/local/stonedb-boost/lib 下生成如下目录和文件。
![image.png](./5.7-boost.png)
:::info
在编译过程中,除非有关键字 "error" 报错自动退出,否则出现关键字 "warning"、"failed"是正常的,安装 boost 大概需要25分钟左右。
:::
### 6. 安装 gtest
```shell
sudo git clone https://github.com/google/googletest.git -b release-1.12.0
cd googletest
sudo mkdir build
cd build
sudo cmake .. -DBUILD_GMOCK=OFF
sudo make
sudo make install
```
gtest 默认安装在 /usr/local
```shell
ls /usr/local/include/
...... gtest
ls /usr/local/lib/
...... cmake libgtest.a libgtest_main.a
```
## 第三步:执行编译
StoneDB 现有 5.6 和 5.7 两个分支,下载的源码包默认是 5.7 分支。下载的源码包存放路径可根据实际情况指定,示例中的源码包存放路径是在根目录下。
```shell
cd /
git clone https://github.com/stoneatom/stonedb.git
```
在执行编译脚本前,需要修改编译脚本的两处内容:<br />1)StoneDB 安装目录,可根据实际情况修改,示例中的安装目录是 /stonedb57/install,目录需要提前创建;<br />2)marisa、rocksdb、boost 的实际安装路径,必须与上文安装 marisa、rocksdb、boost 的路径保持一致。
```shell
###修改编译脚本
cd /stonedb/scripts
vim stonedb_build.sh
...
install_target=/stonedb57/install
...
-DDOWNLOAD_BOOST=0 \
-DWITH_BOOST=/usr/local/stonedb-boost/ \
-DWITH_MARISA=/usr/local/stonedb-marisa \
-DWITH_ROCKSDB=/usr/local/stonedb-gcc-rocksdb \
2>&1 | tee -a ${build_log}
###执行编译脚本
sh stonedb_build.sh
```
:::info
如果是 CentOS/RedHat ,需要注释 os_dist 和 os_dist_release,并且修改 build_tag ,这是因为 "lsb_release -a" 返回的结果中,Distributor、Release、Codename 显示的是 n/a。注释 os_dist 和 os_dist_release 只会影响产生的日志名和 tar 包名,不会影响编译结果。
:::
## 第四步:启动实例
用户可按照手动安装和自动安装两种方式启动 StoneDB。
### 1. 创建用户
```shell
groupadd mysql
useradd -g mysql mysql
passwd mysql
```
### 2. 手动安装
手动创建目录、初始化和启动实例,还需要配置 my.cnf 文件,如安装目录,端口等参数。
```shell
###创建目录
mkdir -p /stonedb57/install/data
mkdir -p /stonedb57/install/binlog
mkdir -p /stonedb57/install/log
mkdir -p /stonedb57/install/tmp
mkdir -p /stonedb57/install/redolog
mkdir -p /stonedb57/install/undolog
chown -R mysql:mysql /stonedb57
###配置my.cnf
mv my.cnf my.cnf.bak
vim /stonedb57/install/my.cnf
[mysqld]
port = 3306
socket = /stonedb57/install/tmp/mysql.sock
basedir = /stonedb57/install
datadir = /stonedb57/install/data
pid_file = /stonedb57/install/data/mysqld.pid
log_error = /stonedb57/install/log/mysqld.log
innodb_log_group_home_dir = /stonedb57/install/redolog/
innodb_undo_directory = /stonedb57/install/undolog/
chown -R mysql:mysql /stonedb57/install/my.cnf
###初始化实例
/stonedb57/install/bin/mysqld --defaults-file=/stonedb57/install/my.cnf --initialize --user=mysql
###启动实例
/stonedb57/install/bin/mysqld_safe --defaults-file=/stonedb57/install/my.cnf --user=mysql &
```
### 3. 自动安装
编译完成后,在安装目录下会自动生成 reinstall.sh、install.sh 和 my.cnf 文件,执行 reinstall.sh 就是创建目录、初始化实例和启动实例的过程。
```shell
cd /stonedb56/install
./reinstall.sh
```
:::info
reinstall.sh 与 install.sh 的区别?<br />reinstall.sh 是自动化安装脚本,执行脚本的过程是创建目录、初始化实例和启动实例的过程,只在第一次使用,其他任何时候使用都会删除整个目录,重新初始化数据库。install.sh 是手动安装提供的示例脚本,用户可根据自定义的安装目录修改路径,然后执行脚本,执行脚本的过程也是创建目录、初始化实例和启动实例。以上两个脚本都只能在第一次使用。
:::
### 4. 执行登录
```shell
cat /stonedb57/install/log/mysqld.log |grep passwd
[Note] A temporary password is generated for root@localhost: ceMuEuj6l4+!
/stonedb57/install/bin/mysql -uroot -p -S /stonedb57/install/tmp/mysql.sock
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.36-StoneDB-debug-log build-
Copyright (c) 2021, 2022 StoneAtom Group Holding Limited
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> alter user 'root'@'localhost' identified by 'stonedb123';
```
注:管理员用户的临时密码在 mysqld.log 中,第一次登陆后需要修改管理员用户的密码。
---
id: release-notes
sidebar_position: 11.0
---
# 发版日志
## StoneDB_5.7_v1.0.0的发行日志 (2022-08-31, 发行版)
- 支持MySQL 5.7
- 功能添加或改变
- 编译相关改动
- 配置相关改动
- 文档变更
- BUG修复
## 支持MySQL 5.7
- **关键项:** StoneDB 数据库支持MySQL 5.7 协议,基线版本:MySQL 5.7.36
## 功能添加或改变
- **关键项:** StoneDB 数据库的列式存储引擎从 StoneDB 变更为 Tianmu
```bash
mysql> show engines;
+----------------+---------+--------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+----------------+---------+--------------------------+--------------+------+------------+
| TIANMU | DEFAULT | Tianmu storage engine | YES | NO | NO |
+----------------+---------+--------------------------+--------------+------+------------+
```
- **Tianmu:** 提升了 Tianmu 引擎对 decimal 数据类型的聚合能力;
- **Tianmu: **提高了代码的可读性。有些代码在逻辑上没有分开或者变量名称不能体现真实含义。例如:修改 int DoGetSomething(); to int GetSomethingXXX();, int GetNoNulls() to int GetNumOfNulls()。
- **Tianmu: **优化了视图对日期函数的调用能力,日期函数能够被视图正常调用使用 (例如:DATE_ADD, DATE_SUB等函数) ;([BUG #342](https://github.com/stoneatom/stonedb/issues/342))
## 编译相关改动
- Boost 依赖库的版本变更为 1.66.0;
- Rocksdb 满足 StoneDB 数据库构建的版本变更为 6.12.6;
## 配置相关改动
- **关键项:**StoneDB 数据库默认配置文件从 stonedb.cnf 变更为 my.cnf;([feature #182](https://github.com/stoneatom/stonedb/issues/182))
- **关键项:**StoneDB 数据库的默认存储引擎从 Innodb 变更为 Tianmu。([feature #255](https://github.com/stoneatom/stonedb/issues/255))
## 文档变更
- 用户手册、编译手册等相关文档发生了变更. ( [# address](https://stonedb.io/))
## BUG修复
- **修复 mtr 用例: **[BUG #78](https://github.com/stoneatom/stonedb/issues/78), [BUG #73](https://github.com/stoneatom/stonedb/issues/73),[ BUG #170](https://github.com/stoneatom/stonedb/issues/170), [BUG #192](https://github.com/stoneatom/stonedb/issues/192), [BUG #191](https://github.com/stoneatom/stonedb/issues/191), [BUG #227](https://github.com/stoneatom/stonedb/issues/227), [BUG #245](https://github.com/stoneatom/stonedb/issues/245), [BUG #263](https://github.com/stoneatom/stonedb/issues/263)
- **修复 Tianmu 缺陷: **[BUG #338](https://github.com/stoneatom/stonedb/issues/388),[ BUG #327](https://github.com/stoneatom/stonedb/issues/327), [BUG #212](https://github.com/stoneatom/stonedb/issues/212), [BUG #142](https://github.com/stoneatom/stonedb/issues/142)
## StoneDB-5.6-V1.0.0
发布时间: 2022 年 6 月 30 号,
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册