创建目录
mkdir /opt/clickhouse
将文件复制到目录
cp /opt/clickhouse-*.rpm /opt/module/clickhouse/
在/clickhouse目录下解压安装文件
rpm2cpio clickhouse-client-21.7.3.14-2.noarch.rpm | cpio -idmv
rpm2cpio clickhouse-common-static-21.7.3.14-2.x86_64.rpm | cpio -idmv
rpm2cpio clickhouse-common-static-dbg-21.7.3.14-2.x86_64.rpm | cpio -idmv
rpm2cpio clickhouse-server-21.7.3.14-2.noarch.rpm | cpio -idmv
执行启动各个相关脚本
执行启动命令
# 启动clickhouse-server
/opt/module/clickhouse/usr/bin/clickhouse-server --daemon
# 启动clickhouse-client
/opt/module/clickhouse/usr/bin/clickhouse-client
# 查看clickhouse-server日志
tail -n 15 /var/log/clickhouse-server/clickhouse-server.log
编辑ClickHouse的配置文件设置远程访问和移除默认监听文件
vim /opt/clickhouse/etc/clickhouse-server/config.xml
找到<listen_host>
标签删除注释(大概155行),将其中的IP地址改为允许远程访问的IP地址
<listen_host>::</listen_host>
由于9000端口被Hadoop占用,将ClickHouse的端口更改为9001(大概82行)
<tcp_port>9001</tcp_port>
重新启动clickhouse
/opt/module/clickhouse/usr/bin/clickhouse-server stop
/opt/module/clickhouse/usr/bin/clickhouse-server --daemon
检查 ClickHouse 的运行状态
/opt/module/clickhouse/usr/bin/clickhouse-client --query "SELECT 1"