docker搭建clickhouse并初始化用户名密码
1、新建挂载目录
mkdir -p /home/clickhouse-server/
mkdir -p /home/clickhouse-server/etc/
2、拉取镜像
docker pull clickhouse/clickhouse-server
3、创建临时容器
docker run -d --rm --name clickhouse-server --ulimit nofile=262144:262144 clickhouse/clickhouse-server
4、拷贝挂载目录
docker cp clickhouse-server:/var/log/clickhouse-server /home/clickhouse-server/
docker cp clickhouse-server:/var/lib/clickhouse /home/clickhouse-server/
docker cp clickhouse-server:/etc/clickhouse-server /home/clickhouse-server/etc/
5、删除临时容器
docker stop clickhouse-server
6、找到/home/clickhouse-server/etc/clickhouse-server/users.xml 目录下的文件,配置用户名密码
把default改成root,并且配置密码
7、启动容器
docker run -d --restart=always --privileged=true -p 8123:8123 -p 9000:9000 --name 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 \
clickhouse/clickhouse-server