安装包地址
https://repo.clickhouse.tech/rpm/stable/x86_64/
1、准备工作
关闭防火墙 systemctl status firewalld
centos 取消打开文件数限制
2、安装包
[centos@hadoop10 clickhouse]$ ll
总用量 1018772
-rw-r--r--. 1 centos centos 38098 8月 27 23:03 clickhouse-client-22.3.20.29.x86_64.rpm
-rw-r--r--. 1 centos centos 246019423 8月 27 23:04 clickhouse-common-static-22.3.20.29.x86_64.rpm
-rw-r--r--. 1 centos centos 797084137 8月 27 23:05 clickhouse-common-static-dbg-22.3.20.29.x86_64.rpm
-rw-r--r--. 1 centos centos 62103 8月 27 23:03 clickhouse-server-22.3.20.29.x86_64.rpm
3、复制安装包
[centos@hadoop10 clickhouse]$ /data/xsync /data/module/clickhouse/
4、安装
[root@hadoop10 clickhouse]# rpm -ivh *.rpm
[root@hadoop10 clickhouse]# rpm -qa|grep clickhouse
clickhouse-server-22.3.20.29-1.x86_64
clickhouse-common-static-dbg-22.3.20.29-1.x86_64
clickhouse-common-static-22.3.20.29-1.x86_64
clickhouse-client-22.3.20.29-1.x86_64
5、更改配置
[root@hadoop11 clickhouse]# vim /etc/clickhouse-server/config.xml
1)配置允许被外部节点访问
把 :: 的注释打开,这样的话才能让ClickHouse被除本机以外的服务器访问
2)分发配置文件
在这个文件中,有ClickHouse的一些默认路径配置,比较重要的
- 数据文件路径:/var/lib/clickhouse/
- 日志文件路径:/var/log/clickhouse-server/clickhouse-server.log
6、启动clickserver
[root@hadoop11 clickhouse]# systemctl start clickhouse-server.service
[root@hadoop11 clickhouse]# systemctl status clickhouse-server.service
● clickhouse-server.service - ClickHouse Server (analytic DBMS for big data)
Loaded: loaded (/usr/lib/systemd/system/clickhouse-server.service; enabled; vendor preset: disabled)
Active: active (running) since 日 2023-08-27 08:23:05 PDT; 12s ago
Main PID: 50540 (clckhouse-watch)
Tasks: 201
CGroup: /system.slice/clickhouse-server.service
├─50540 clickhouse-watchdog --config=/etc/clickhouse-server/config.xml --pid-file=/run/clickhouse-server/clickhouse-server.pid
└─50549 /usr/bin/clickhouse-server --config=/etc/clickhouse-server/config.xml --pid-file=/run/clickhouse-server/clickhouse-server.pid
8月 27 08:23:05 hadoop11 systemd[1]: Started ClickHouse Server (analytic DBMS for big data).
8月 27 08:23:05 hadoop11 clickhouse-server[50540]: Processing configuration file '/etc/clickhouse-server/config.xml'.
8月 27 08:23:05 hadoop11 clickhouse-server[50540]: Logging trace to /var/log/clickhouse-server/clickhouse-server.log
8月 27 08:23:05 hadoop11 clickhouse-server[50540]: Logging errors to /var/log/clickhouse-server/clickhouse-server.err.log
8月 27 08:23:06 hadoop11 clickhouse-server[50540]: Processing configuration file '/etc/clickhouse-server/config.xml'.
8月 27 08:23:06 hadoop11 clickhouse-server[50540]: Saved preprocessed configuration to '/var/lib/clickhouse/preprocessed_configs/config.xml'.
8月 27 08:23:06 hadoop11 clickhouse-server[50540]: Processing configuration file '/etc/clickhouse-server/users.xml'.
8月 27 08:23:06 hadoop11 clickhouse-server[50540]: Merging configuration file '/etc/clickhouse-server/users.d/default-password.xml'.
8月 27 08:23:06 hadoop11 clickhouse-server[50540]: Saved preprocessed configuration to '/var/lib/clickhouse/preprocessed_configs/users.xml'.
7、关闭服务器
systemctl disable clickhouse-server
8、客户端登录
[root@hadoop11 clickhouse]# clickhouse-client -m
ClickHouse client version 22.3.20.29 (official build).
Connecting to localhost:9000 as user default.
If you have installed ClickHouse and forgot password you can reset it in the configuration file.
The password for default user is typically located at /etc/clickhouse-server/users.d/default-password.xml
and deleting this file will reset the password.
See also /etc/clickhouse-server/users.xml on the server where ClickHouse is installed.
Code: 516. DB::Exception: Received from localhost:9000. DB::Exception: default: Authentication failed: password is incorrect or there is no user with such name. (AUTHENTICATION_FAILED)
密码不正确问题解决:
[root@hadoop11 clickhouse]# clickhouse-client --password
ClickHouse client version 22.3.20.29 (official build).
Password for user (default):
Connecting to localhost:9000 as user default.
Connected to ClickHouse server version 22.3.20 revision 54455.
hadoop11 :) show databases;
SHOW DATABASES
Query id: 558a6717-0b20-4da1-a1a6-c087ba2252a0
┌─name───────────────┐
│ INFORMATION_SCHEMA │
│ default │
│ information_schema │
│ system │
└────────────────────┘
4 rows in set. Elapsed: 0.011 sec.