安装
安装过程还是比较简单的, 照着官方文档来就行。Clickhouse 安装文档
在 Ubuntu 的安装教程如下
- 检测是否启用 SSE 4.2指令集
grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported"
- 安装
sudo apt-get install -y apt-transport-https ca-certificates dirmngr
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 8919F6BD2B48D754
echo "deb https://packages.clickhouse.com/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
- 配置账号密码
比如想设置的用户和密码是 root / root123
# 生成密码
PASSWORD=root123 && echo -n "$PASSWORD" | sha1sum | tr -d '-' | xxd -r -p | sha1sum | tr -d '-'
# 生成的密码如下
faaffe644e901cfafaec7562415e5faec243b8b2
修改 /etc/clickhouse-server/users.xml
.
<yandex>
<users>
<root>
<password>256dac22d6458e094ff03d79d30f6ad2</password>
<networks>
<ip>::/0</ip>
</networks>
<profile>default</profile>
<quota>default</quota>
</root>
</users>
</yandex>
- 配置远程访问
修改/etc/clickhouse-server/config.xml
.
开启配置项
<listen_host>0.0.0.0</listen_host>
- 运行
修改目录权限
sudo chown -R clickhouse:clickhouse /var/lib/clickhouse/
sudo chown -R clickhouse:clickhouse /var/log/clickhouse-server/
启动
systemctl start clickhouse-server.service
检测启动状态
systemctl status clickhouse-server.service
开机启动
systemctl enable clickhouse-server.service