1. 验证系统是否符合安装条件
    ClickHouse可以在任何具有x86_64,AArch64或PowerPC64LE CPU架构的Linux,FreeBSD或Mac OS X上运行。虽然预构建的二进制文件通常是为x86 _64编译并利用SSE 4.2指令集,但除非另有说明,否则使用支持它的CPU将成为额外的系统要求。这是检查当前CPU是否支持SSE 4.2的命令:

grep -q sse4_2 /proc/cpuinfo && echo “SSE 4.2 supported” || echo “SSE 4.2 not supported”
SSE 4.2 supported

  1. 官网安装指南(在线)
    https://clickhouse.tech/#quick-start 很清晰。

sudo yum install yum-utils
sudo rpm —import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG
sudo yum-config-manager —add-repo https://repo.clickhouse.tech/rpm/clickhouse.repo
sudo yum install clickhouse-server clickhouse-client

sudo /etc/init.d/clickhouse-server start
clickhouse-client

  1. 报错问题处理
    3.1 启动 clickhouse-client 报错
    [root@tcloud ~]# clickhouse-client
    ClickHouse client version 21.6.6.51 (official build).
    Connecting to localhost:9000 as user default.
    Code: 210. DB::NetException: Connection refused (localhost:9000)

在网络上寻求帮助,修改配置文件:

vim /etc/clickhouse-server/config.xml

listen_host 只留这个配置

::

启动依然报错。

3.2 启动 clickhouse-server 报错
反复查询 Code: 210. DB::NetException: Connection refused (localhost:9000) 问题,几乎都是改上述配置文件,我就查询了一下 clickhouse-server 的状态,果不其然是 server 都没启动起来。

[root@tcloud ~]# service clickhouse-server status
Now there is no clickhouse-server process.
Usage: /etc/init.d/clickhouse-server {start|stop|status|restart|forcestop|forcerestart|reload|condstart|condstop|condrestart|condreload|initdb}

然后启动 server 居然也报错:

[root@tcloud ~]# service clickhouse-server start
Init script is already running

求助无私程序员,解决:原文链接 https://www.gbase8.cn/5233 ,主要问题是在REdhat 7和之后的操作系统,需要用systemctl启动才可以。

[root@tcloud ~]# systemctl start clickhouse-server.service
[root@tcloud ~]# systemctl status clickhouse-server.service
● clickhouse-server.service - ClickHouse Server (analytic DBMS for big data)
Loaded: loaded (/etc/systemd/system/clickhouse-server.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2021-07-07 09:57:34 CST; 25s ago
Main PID: 6223 (clckhouse-watch)
CGroup: /system.slice/clickhouse-server.service
├─6223 clickhouse-watchdog —config=/etc/clickhouse-server/config.xml —pid-file=/run/clickhouse-server/clickhouse-server.pid
└─6224 /usr/bin/clickhouse-server —config=/etc/clickhouse-server/config.xml —pid-file=/run/clickhouse-server/clickhouse-server.pid

服务端启动后再次启动 clickhouse-client 并测试 OK

[root@tcloud ~]# clickhouse-client
ClickHouse client version 21.6.6.51 (official build).
Connecting to localhost:9000 as user default.
Connected to ClickHouse server version 21.6.6 revision 54448.

tcloud :) show databases;
SHOW DATABASES
Query id: b6c83d01-93e0-4688-bc42-857de4dab0ce
┌─name────┐
│ default │
│ system │
└─────────┘
2 rows in set. Elapsed: 0.004 sec.