目录
1.系统环境
2. 部署clickhouse-server
2.1. 启动my-clickhouse-server容器实例
2.2. 创建本地挂载目录
2.3.my-clickhouse-server容器的配置文件、目录复制到本地挂载目录下
2.4. 复制完成后,停止删除容器my-clickhouse-server
2.5.重新运行部署my-clickhouse-server
2.6 clickhouse-servers设置密码,修改完成后,重启容器。
修改本地文件
密码生成
users.xml
2.7.DBeaver连接clickhouse
3.clickhouse-client连接server
4.clickhouse创建database
5.其他内容,参考官方文档
UK Property Price Paid | ClickHouse Docs
docker 、CentOS 7.9
docker run -d --name my-clickhouse-server --ulimit nofile=262144:262144 yandex/clickhouse-server
引用/home下空间比较大,所以映射路径都放在/home下
mkdir -p /home/clickhouse-server/
mkdir -p /home/clickhouse-server/etc/
docker cp my-clickhouse-server:/var/log/clickhouse-server /home/clickhouse-server/
docker cp my-clickhouse-server:/var/lib/clickhouse /home/clickhouse-server/
docker cp my-clickhouse-server:/etc/clickhouse-server /home/clickhouse-server/etc/
docker stop my-clickhouse-server
docker rm my-clickhouse-server
docker run -d --restart=always --privileged=true -p 8123:8123 -p 9000:9000 --name my-clickhouse-server --ulimit nofile=262144:262144 \
-v /home/clickhouse-server/clickhouse-server:/var/log/clickhouse-server \
-v /home/clickhouse-server/clickhouse:/var/lib/clickhouse \
-v /home/clickhouse-server/etc/clickhouse-server:/etc/clickhouse-server \
yandex/clickhouse-server
vim /home/clickhouse-server/etc/clickhouse-server/users.xml
密码生成命令,具体内容可参考users.xml文件内说明
[root@inlong clickhouse]# PASSWORD=$(base64 < /dev/urandom | head -c8); echo "clickhouse"; echo -n "clickhouse" | sha1sum | tr -d '-' | xxd -r -p | sha1sum | tr -d '-'
clickhouse
5873faa64eaf2895016c5ee79af4704e167fec7a
10000000000
random
1
5873faa64eaf2895016c5ee79af4704e167fec7a
::/0
default
default
1
5873faa64eaf2895016c5ee79af4704e167fec7a
::/0
default
inlong
1
3600
0
0
0
0
0
7200
0
0
0
0
0
docker run -it --rm --link my-clickhouse-server:clickhouse-server yandex/clickhouse-client --host clickhouse-server --user default --password=clickhouse
6eafc5c3cfd1 :) CREATE DATABASE IF NOT EXISTS flink_clickhouse
CREATE DATABASE IF NOT EXISTS flink_clickhouse
Query id: 75018a8e-323f-4193-885a-455848102a9d
Ok.
0 rows in set. Elapsed: 0.002 sec.