源码编译 Clickhosue-v20.1.6.30

环境、系统、硬件 

强制要求:Linux x86_64 内核大于 3.2.0 UTF-8 字符集,CPU 支持 SSE 4.2 指令集。 
检查是否支持 SSE 4.2 指令集
grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported"

编译要求

GCC 9
cmake 3.12 以上版本
yum install -y epel-release centos-release-scl
yum-config-manager --enable rhel-server-rhscl-7-rpms
yum install -y devtoolset-9-gcc devtoolset-9-gcc-c++ cmake3

测试环境

OS: CentOS 7.0
CPU: 4 Core
Mem: 8 GB
ClickHouse version: v20.1.6.30-stable

编译依赖

yum install -y librdkafka-devel zlib-devel openssl-devel libicu-devel libtool-ltdl-devel unixODBC-devel readline-devel git

克隆源码

# 克隆Clickhouse源码,包括依赖库
git clone --recursive https://github.com/ClickHouse/ClickHouse.git
cd Clickhouse
git checkout
v20.1.6.30-stable

 编译

# 设置GCC变量
export CC=/opt/rh/devtoolset-9/root/usr/bin/gcc
export CXX=/opt/rh/devtoolset-9/root/usr/bin/g++
# cmake
cmake3 . -DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local/clickhouse \
-DOPENSSL_SSL_LIBRARY=/usr/lib64/libssl.so \
-DOPENSSL_CRYPTO_LIBRARY=/usr/lib64/libcrypto.so \
-DOPENSSL_INCLUDE_DIR=/usr/include/openssl \
-DHAVE_THREE_PARAM_SCHED_SETAFFINITY=1 \
-DNO_WERROR=1
# make
make -j4 && make install

运行依赖

yum install -y zlib openssl libicu libtool-ltdl unixODBC readline

配置文件检查
clickhouse-extract-from-config 是用来获取配置项的,检查配置只是附带的

/usr/local/clickhouse/bin/clickhouse-extract-from-config --config-file=/usr/local/clickhouse/etc/clickhouse-server/config.xml --key=path

 

运行

/usr/local/clickhouse/bin/clickhouse-server --daemon --config-file=/usr/local/clickhouse/etc/clickhouse-server/config.xml --pid-file=/var/run/clickhouse-server/clickhouse-server.pid

 

  





posted @ 2020-04-24 11:34  LiuDarren  阅读(434)  评论(0)    收藏  举报