【docker】安装clickhouse
docker-compose 安装clickhouse
·
一、联网安装clickhouse
1、为了方便安装,将clickhouse的工作目录和数据目录都在同一个目录下,在home下创建目录
mkdir clickhouse
cd clickhouse
## 创建日志、配置文件、数据文件夹
mkdir log
mkdir config
mkdir data
2、docker-compose-ch-1.yaml
version: '3'
services:
clickhouse:
environment:
- TZ=Asia/Shanghai
image: yandex/clickhouse-server
container_name: clickhouse
restart: always
networks:
- deng
ports:
- "8123:8123"
- "9000:9000"
volumes:
# 默认配置
- /etc/localtime:/etc/localtime:ro
# 运行日志
- ./log:/var/log/clickhouse-server
# 数据持久
- ./data:/var/lib/clickhouse:rw
networks:
deng:
external: true
执行 docker-compose -f docker-compose-ch-1.yaml up -d
3、修改配置
将容器内的配置复制到创建的文件夹中
docker cp clickhouse:/etc/clickhouse-server/config.xml ./config
docker cp clickhouse:/etc/clickhouse-server/users.xml ./config
docker cp clickhouse:/etc/clickhouse-server/config.d/docker_related_config.xml ./config
修改docker_related_config.xml 监听地址,第3行
config.xml 打开监听地址
users.xml 设置密码
4、修改docker-compose
将docker-compose-ch-1.yaml的配置修改为docker-compose-ch-2.yaml,我一般用2个yaml文件,先执行1,将配置文件复制出来之后再执行docker-compose-ch-2.yaml
version: '3'
services:
clickhouse:
environment:
- TZ=Asia/Shanghai
image: yandex/clickhouse-server:latest
container_name: clickhouse
restart: always
networks:
- deng
ports:
- "8123:8123"
- "19000:9000"
volumes:
# 默认配置
- ./config/docker_related_config.xml:/etc/clickhouse-server/config.d/docker_related_config.xml:rw
- ./config/config.xml:/etc/clickhouse-server/config.xml:rw
- ./config/users.xml:/etc/clickhouse-server/users.xml:rw
- /etc/localtime:/etc/localtime:ro
# 运行日志
- ./log:/var/log/clickhouse-server
# 数据持久
- ./data:/var/lib/clickhouse:rw
networks:
deng:
external: true
执行 docker-compose -f docker-compose-ch-1.yaml down
执行 docker-compose -f docker-compose-ch-2.yaml up -d
DBeaver连接clickhouse
clickhouse客户端命令
clickhouse-client --password
更多推荐
已为社区贡献3条内容
所有评论(0)