ClickHouse 列式数据库搭建

复制和安装 clickhouse

  1. 将本地clickhouse相关文件复制进master容器中root目录中
1
2
3
4
docker cp clickhouse-client-21.9.4.35.tgz master:/root
docker cp clickhouse-common-static-21.9.4.35.tgz master:/root
docker cp clickhouse-common-static-dbg-21.9.4.35.tgz master:/root
docker cp clickhouse-server-21.9.4.35.tgz master:/root
  1. clickhouse文件解压到/opt/module目录中
1
2
3
4
tar zxvf clickhouse-client-21.9.4.35.tgz -C /opt/module
tar zxvf clickhouse-common-static-21.9.4.35.tgz -C /opt/module
tar zxvf clickhouse-common-static-dbg-21.9.4.35.tgz -C /opt/module
tar zxvf clickhouse-server-21.9.4.35.tgz -C /opt/module
  1. 安装clickhouse

若有输入用户名或密码的则跳过

  • 执行每个文件路径下install目录下doinstall.sh
1
2
3
4
/opt/module/clickhouse-common-static-21.9.4.35/install/doinst.sh
/opt/module/clickhouse-common-static-21.9.4.35/install/doinst.sh
/opt/module/clickhouse-common-static-dbg-21.9.4.35/install/doinst.sh
/opt/module/clickhouse-server-21.9.4.35/install/doinst.sh

配置 clickhouse

  1. 修改 /etc/clickhouse-server/config.xml
  • 将里面 9000 端口改为 9001
1
sed -i 's/9000/9001/g' config.xml
  • 在文件约159行处,将注释的文本去掉注释
1
<!-- <listen_host>0.0.0.0</listen_host> --> 改为 <listen_host>0.0.0.0</listen_host>

开启并验证 clickhouse

1
systemctl start clickhouse-server
1
systemctl status clickhouse-server