1 安装clickHouse
1)windows docker 单机安装
1.1 镜像安装
# 搜索clickhouse
docker search clickhouse
# 安装image
docker pull clickhouse-server # 服务端
docker pull clickhouse-client # 客户端
1.2 创建容器
# 创建镜像
docker run -d --name=dq_ck_auth -p 8124:8123 -p 9011:9009 -p 9111:9000 --ulimit nofile=262144:262144 cf337fa4bbbe
# 共享配置文件容器创建
docker run -d --name=dq_ck_auth -p 8124:8123 -p 9019:9009 -p 9100:9000 -v /home/daneil/mine/clickhouse/conf/:/etc/clickhouse-server/ --ulimit nofile=262144:262144 cf337fa4bbbe
# 配置文件位置
/etc/clickhouse/
# 启动容器
docker run -it --rm --link dq_ck_auth:clickhouse-server yandex/clickhouse-client --user user_sha256 --password 123 --host clickhouse-server
# 更多操作
docker run -it --rm --link dq_ck_auth:clickhouse-server yandex/clickhouse-client -- help
# 查看当前安装的版本
select version()
1.3 创建密码
# 创建随机密码
PASSWORD=$(base64 < /dev/urandom | head -c8);echo "$PASSWORD"; echo -n "$PASSWORD" | sha256sum | tr -d '-'6lYaUiFi967f3bf355dddfabfca1c9f5cab39352b2ec1cd0b05f9e1e6b8f629705fe7d6e
# 创建sha1密码
echo -n 123 | openssl dgst -sha256
# 创建doubel_sha1密码
echo -n 123 | openssl dgst -sha1 -binary | openssl dgst -sha1
# 配置密码 -- /etc/clickhouse/users.xml
<users>
<default>
<password></password>
<networks>
<ip>::/0</ip>
</networks>
<profile>default</profile>
<quota>default</quota>
</default>
<dba>
<password>4JEaxKRL</password>
<networks incl="networks" replace="replace">
<ip>::/0</ip>
</networks>
<profile>default</profile>
<quota>default</quota>
</dba>
<user_sha256>
<password>4JEaxKRL</password>
<networks incl="networks" replace="replace">
<ip>::/0</ip>
</networks>
<profile>default</profile>
<quota>default</quota>
</user_sha256>
<user_sha1>
<password>4JEaxKRL</password>
<networks incl="networks" replace="replace">
<ip>::/0</ip>
</networks>
<profile>default</profile>
<quota>default</quota>
</user_sha1>
</users>
2) Deepin 单机安装
sudo apt-get install apt-transport-https ca-certificates dirmngr
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4
echo "deb https://repo.clickhouse.tech/deb/stable/ main/" | sudo tee
/etc/apt/sources.list.d/clickhouse.list
sudo apt-get update
sudo apt-get install -y clickhouse-server clickhouse-client # 安装server和client
systemctl start clickhouse-server.service # 启动服务
clickhouse-client # 开启客户端
3) 目录结构
3.1 /etc/clickhouse-server
服务端的配置文件目录,包括全局配置config.xml和用户配置users.xml
3.2 /var/lib/clickhouse
默认的数据存储目录,(通常建议修改默认路径,保存到挂载大容量磁盘的路径)
3.3 /var/log/clickhouse-server
默认日志存储目录,(通常建议修改默认路径,保存到挂载大容量磁盘的路径)
3.4 配置文件 /etc/security/limits.d/clickhouse.conf (默认配置)
clickhouse soft nofile 262144
clickhouse hard nofile 262144