下载对应版本https://github.com/ClickHouse/ClickHouse
分别选择arm64/x86_64 对应的tgz
场景是需要把ck所有文件安装指定目录,使用rpm会散布在各个目录不方便管控
下载client,common-static,server这三个
将相同的目录合并成一个(这里注意需要在linux服务器上解压执行,里面包含了一些软链)
整合好后就需要做相关配置
这里我是使用nebula.ospackage gradle项目来重新打包成一个新的统一目录rpm安装包
(具体方式之前有讲到)
1.创建统一的目录
mkdir -p /path/clickhouse
2.创建日志目录
mkdir -p /path/log/clickhouse-server
3.创建配置目录
mkdir -p /etc/clickhouse-server
4.权限操作
groupadd clickhouse;
useradd -r -g clickhouse -s /sbin/nologin clickhouse
chmod -R 755 /path/clickhouse
chown -R clickhouse:clickhouse /path/clickhouse
touch /path/log/clickhouse-server/clickhouse-server.log
touch /path/log/clickhouse-server/clickhouse-server.err.log
chmod -R 755 /path/log/clickhouse-server
chown -R clickhouse:clickhouse /path/log/clickhouse-server
5.将clickhouse设置成服务
cp -rf /path/clickhouse/etc/init.d/clickhouse-server /etc/init.d/ ---x86/arm都需要
cp -f /path/clickhouse/clickhouse-server.service /etc/systemd/system/
cp -rf /path/clickhouse/etc/cron.d/clickhouse-server /etc/cron.d/ ---x86执行
cp -rf /path/clickhouse/security/limits.d/clickhouse.conf /etc/security/limits.d/ ---x86执行
systemctl daemon-reload
这里服务文件参考
[Unit]
Description=ClickHouse Server (analytic DBMS for big data)
Requires=network-online.target
After=network-online.target
[Service]
Type=simple
User=clickhouse
Group=clickhouse
Restart=always
RestartSec=30
RuntimeDirectory=clickhouse-server
ExecStart=/path/clickhouse/clickhouse-server --config=/etc/clickhouse-server/config.xml --pid-file=/run/clickhouse-server/clickhouse-server.pid
LimitCORE=infinity
LimitNOFILE=500000
CapabilityBoundingSet=CAP_NET_ADMIN CAP_IPC_LOCK CAP_SYS_NICE
[Install]
WantedBy=multi-user.target