—仅供学习 如有侵权 请联系删除–
一、下载
选择Tgz安装包安装
下载地址:Index of /clickhouse/tgz/
选择stable目录下的安装包,采用21.9.4.35版本,分别是:
[root@hadoop08 resources]# ll
总用量 1023548
-rw-r--r--. 1 root root 82784 5月 27 19:09 clickhouse-client-21.9.6.24.tgz
-rw-r--r--. 1 root root 189150313 5月 27 19:20 clickhouse-common-static-21.9.6.24.tgz
-rw-r--r--. 1 root root 858764599 5月 27 19:22 clickhouse-common-static-dbg-21.9.6.24.tgz
-rw-r--r--. 1 root root 103488 5月 27 19:22 clickhouse-server-21.9.6.24.tgz
二、解压安装
依次将这四个安装包解压,并且每解压一个,执行一下解压文件夹下的install下的doinst.sh脚本
解压顺序:
clickhouse-common-static-21.9.4.35.tgz
clickhouse-common-static-dbg-21.9.4.35.tgz
clickhouse-server-21.9.4.35.tgz
clickhouse-client-21.9.4.35.tgz
------------------------------------------------------------
# 解压
tar -zxvf clickhouse-common-static-21.9.4.35.tgz
cd clickhouse-common-static-21.9.4.35/install/
# 运行doinst.sh
./doinst.sh
------------------------------------------------------------
tar -zxvf clickhouse-common-static-dbg-21.9.4.35.tgz
./clickhouse-common-static-dbg-21.9.4.35/install/doinst.sh
------------------------------------------------------------
tar -zxvf clickhouse-server-21.9.4.35.tgz
./clickhouse-server-21.9.4.35/install/doinst.sh
------------------------------------------------------------
tar -zxvf clickhouse-client-21.9.4.35.tgz
./clickhouse-client-21.9.4.35/install/doinst.sh
------------------------------------------------------------
在解压clickhouse-server-21.9.4.35.tgz并运行./clickhouse-server-21.9.4.35/install/doinst.sh
后,clickhouse会默认创建一个default的用户,让你设置密码,不设置密码可以按回车
Enter password for default user:
Password for default user is saved in file /etc/clickhouse-server/users.d/default-password.xml.
Setting capabilities for clickhouse binary. This is optional.
Allow server to accept connections from the network (default is localhost only), [y/N]: y
The choice is saved in file /etc/clickhouse-server/config.d/listen.xml.
三、启动
#查看命令
clickhouse --help
#启动
clickhouse start
连接clickhouse
clickhouse-client
## -m 支持多行语句
clickhouse-client -m
设置了密码的话,用clickhouse -client --password 启动
[root@hadoop08 clickhouse]# clickhouse-client --password root
ClickHouse client version 21.9.6.24 (official build).
Connecting to localhost:9000 as user default.
Connected to ClickHouse server version 21.9.6 revision 54449.
hadoop08 :) show databases
SHOW DATABASES
Query id: c6fc996f-7a06-402d-b627-424530e203e9
┌─name────┐
│ default │
│ system │
└─────────┘
2 rows in set. Elapsed: 0.005 sec.
四、clickhouse相关目录
-------------------------------------------
# 命令目录
/usr/bin
ll |grep clickhouse
-------------------------------------------
# 配置文件目录
cd /etc/clickhouse-server/
-------------------------------------------
# 日志目录
cd /var/log/clickhouse-server/
-------------------------------------------
# 数据文件目录
cd /var/lib/clickhouse/
-------------------------------------------
五、允许远程访问
clickhouse 默认不允许远程访问,需要修改配置文件
cd /etc/clickhouse-server/
vim config.xml
把listen 注释打开
强行保存wq!
重启clickhouse
clickhouse restart
在浏览器输入服务器ip+8123验证一下
这样就可以远程访问了!
六、使用DBeaver连接Clickhouse
先安装好DBeaver
创建连接
选择ClickHouse
刚开始,要按照驱动,根据提示安装完驱动,在主机上填写对应IP和端口,用户名【无】,密码【root】(没有设
置可以不填)