阿里云仓库在线安装docker
https://blog.csdn.net/xys2015/article/details/109370082
docker pull yandex/clickhouse-server:20.8
参考启动脚本
#!/bin/bash
start() {
/bin/docker run -d --name ck \
--network=host \
--restart always \
--ulimit nofile=262144:262144 \
--log-opt max-size=100m \
--log-opt max-file=3 \
--memory=16g \
--cpus=4 \
-v /data0/clickhouse/clickhouse-data:/var/lib/clickhouse \
-v /data0/clickhouse/clickhouse-logs:/var/log/clickhouse-server \
-v /data0/clickhouse/clickhouse-config/config.xml:/etc/clickhouse-server/config.xml \
-v /data0/clickhouse/clickhouse-config/users.xml:/etc/clickhouse-server/users.xml \
yandex/clickhouse-server:20.8
}
stop () {
/bin/docker stop ck
/bin/docker rm -fv ck
}
status() {
/bin/docker ps -a | grep ck
}
restart() {
stop
start
status
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
esac
需要的目录提前创建好,需要的配置文件可以从容器里面复制出来
docker exec -it ck bash
clickhouse-client -h localhost --port 9000 -m
默认没有密码
CREATE TABLE test_table2
ENGINE = MergeTree
PARTITION BY date
ORDER BY (date) AS
SELECT *, today() as date
FROM mysql('192.168.144.167:10034', 'db_name', 'test_table2', 'root', 'H6vHFajsdfwjjwj7g4T')
csdn 111187090