Skip to main content

Compiling WeSQL From Source Code

Compiling WeSQL From Source Code​

You should install the WeSQL binary on each of the three servers. This can be done by compiling it from the source code.

Source Compilation Prerequisites​

  • Amazonlinux2(x86_64)
note

Amazon linux 2 AMI Kernel 5.10

Install basic tools.

yum install -y \
sudo \
yum-utils \
wget \
git \
curl \
tar

Install GCC.

yum-config-manager --add-repo https://vault.centos.org/centos/7/sclo/x86_64/rh/
yum install -y devtoolset-11-gcc \
devtoolset-11-gcc-c++ \
devtoolset-11-gdb \
devtoolset-11-libstdc++-devel \
devtoolset-11-make --nogpgcheck
yum update -y

echo "source /opt/rh/devtoolset-11/enable" >> ~/.bashrc && source ~/.bashrc

Install build dependencies.

yum install -y \
cmake3 \
automake \
openssl-devel \
ncurses-devel \
bison \
libaio-devel \
libcurl-devel \
libev-devel \
numactl \
numactl-devel \
zlib-devel \
cyrus-sasl-devel \
openldap-devel \
perl-JSON \
libudev-devel \
libtirpc-devel
  • Amazonlinux2(arm64)

Install basic tools.

yum install -y \
sudo \
yum-utils \
wget \
git \
curl \
tar

Install GCC.

yum-config-manager --add-repo http://vault.centos.org/altarch/7/sclo/aarch64/rh/
yum update -y

yum install -y devtoolset-10-gcc \
devtoolset-10-gcc-c++ \
devtoolset-10-gdb \
devtoolset-10-libstdc++-devel \
devtoolset-10-make --nogpgcheck

echo "source /opt/rh/devtoolset-10/enable" >> ~/.bashrc && source ~/.bashrc

Install build dependencies.

yum install -y \
cmake3 \
openssl-devel \
ncurses-devel \
bison \
libzstd-devel \
libaio-devel \
libcurl-devel \
numactl-devel \
zlib-devel \
cyrus-sasl-devel \
openldap-devel \
perl-JSON \
libudev-devel \
libtirpc-devel
  • Oraclelinux8
rpmkeys --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
yum install -y scl-utils oracle-epel-release-el8
yum update -y

Install GCC.

yum install -y \
gcc-toolset-12-gcc \
gcc-toolset-12-gcc-c++ \
gcc-toolset-12-binutils \
gcc-toolset-12-annobin-annocheck \
gcc-toolset-12-annobin-plugin-gcc

echo "source /opt/rh/gcc-toolset-12/enable" >> ~/.bashrc && source ~/.bashrc

Install basic tools.

yum install -y \
gdb \
cmake3 \
git \
sudo \
wget \
tar

Install build dependencies.

yum install -y openssl-devel \
ncurses-devel \
bison \
libzstd-devel \
libaio-devel \
libcurl-devel \
numactl-devel \
zlib-devel \
cyrus-sasl-devel \
openldap-devel \
perl-JSON \
libudev-devel \
libtirpc-devel

yum --enablerepo=ol8_codeready_builder install -y rpcgen

Get the WeSQL code​

Clone the mysql-server git repository tag:mysql-8.0.35 to local directory.

git clone --branch mysql-8.0.35 --single-branch git@github.com:mysql/mysql-server.git
cd mysql-server
git checkout -b mysql-8.0.35-branch tags/mysql-8.0.35

Checkout the wesql git repository to local mysql-server directory.

git remote add wesql git@github.com:wesql/wesql.git
git fetch wesql
git checkout wesql/8.0 -- .

Apply wesql patches mysql-server-8.0.35.patch to mysql-server code.

git apply patches/mysql-server-8.0.35.patch

Building the WeSQL from source​

mkdir build && cd build
cmake3 ../ -B ./ \
-DCMAKE_INSTALL_PREFIX="/usr/local/mysql" \
-DWITH_SSL="system" \
-DCMAKE_BUILD_TYPE="DEBUG" \
-DWITH_ROUTER=OFF \
-DWITH_CLONE=1 \
-DWITH_FAIL_POINT=ON \
-DWITH_WESQL_TEST=1 \
-DDOWNLOAD_BOOST=1 -DWITH_BOOST="../extra/"

make
make install
echo "export PATH=/usr/local/mysql/bin:$PATH" >> ~/.bashrc && source ~/.bashrc
echo "export LD_LIBRARY_PATH=/usr/local/mysql/lib:$LD_LIBRARY_PATH" >> ~/.bashrc && source ~/.bashrc

Create default user

groupadd -r mysql 
useradd -g mysql mysql -p ''
usermod -aG wheel mysql

Copy Binaries to All Servers​

Compress the binary installation directory into a package, distribute it to other nodes, and then extract it for installation.

tar -czf mysql.tar.gz --absolute-names --transform 's|^/u01/||' /usr/local/mysql
scp mysql.tar.gz root@192.168.0.2/home/
ssh 192.168.0.2
cd /home/
tar -xzvf mysql.tar.gz -C /usr/local/