2 ClickHouse 的安装
防火墙
关闭防火墙
shell
systemctl stop firewalld.service
systemctl disable firewalld.service
关闭selinux
shell
systemctl stop firewalld.service
systemctl disable firewalld.service
下载安装使用
下载:
shell
https://packages.clickhouse.com/tgz/stable/
[root@localhost home]# wget https://packages.clickhouse.com/tgz/stable/clickhouse-common-static-22.9.7.34-amd64.tgz
[root@localhost home]# ll
total 228692
-rw-r--r--. 1 root root 82782 Dec 26 20:34 clickhouse-client-22.9.7.34-amd64.tgz
-rw-r--r--. 1 root root 233982749 Dec 16 04:27 clickhouse-common-static-22.9.7.34-amd64.tgz
-rw-r--r--. 1 root root 105857 Dec 26 20:32 clickhouse-server-22.9.7.34-amd64.tgz
解压:
shell
[root@localhost home]# tar -zxvf clickhouse-common-static-22.9.7.34-amd64.tgz
[root@localhost home]# tar -zxvf clickhouse-server-22.9.7.34-amd64.tgz
[root@localhost home]# tar -xvf clickhouse-client-22.9.7.34-amd64.tgz
安装:
shell
[root@localhost install]# sh /home/clickhouse-common-static-22.9.7.34/install/doinst.sh
[root@localhost install]# sh /home/clickhouse-server-22.9.7.34/install/doinst.sh
[root@localhost install]# sh /home/clickhouse-client-22.9.7.34/install/doinst.sh
配置:
shell
[root@localhost install]# vim /etc/clickhouse-server/config.xml
(1)把 <listen_host>::</listen_host> 的注释打开,这样的话才能让 ClickHouse 被除本
机以外的服务器访问
(2)配置文件
在这个文件中,有 ClickHouse 的一些默认路径配置,比较重要的
数据文件路径:<path>/var/lib/clickhouse/</path>
日志文件路径:<log>/var/log/clickhouse-server/clickhouse-server.log</log>
启动:
shell
# 启动 ClickHouse
systemctl start clickhouse-server
# 停止 ClickHouse
systemctl stop clickhouse-server
# 查看状态 ClickHouse
systemctl status clickhouse-server
使用:
shell
#客户端连接输入密码
[root@localhost install]# clickhouse-client --password
[root@localhost install]# clickhouse-client -h 192.168.235.128 -u default --password 123456 --port 9000 -m
ClickHouse client version 22.9.7.34 (official build).
Connecting to 192.168.235.128:9000 as user default.
Connected to ClickHouse server version 22.9.7 revision 54460.