clickhouse的安装(docker安装)
-
拉取镜像
docker pull clickhouse/clickhouse-server
-
创建并运行容器
sudo docker run --name clickhouse-server --ulimit nofile=262144:262144 --volume=$HOME/clickhouse:/var/lib/clickhouse -p 8123:8123 -p 9000:9000 -p 9004:9004 clickhouse/clickhouse-server
-
linux下生成sha1密码
PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha1sum | tr -d '-' | xxd -r -p | sha1sum | tr -d '-'
-
指定用户名密码:sha1 (drxxxxClUn)
<password_double_sha1_hex>e83f02e59523337xxxxxx9d465aea4</password_double_sha1_hex> -
修改配置文件,指定用户default的密码
/etc/clickhouse-server/users.xml
-
将mysql数据导入到clickhouse
CREATE TABLE area_code ENGINE = MergeTree ORDER BY id AS SELECT * FROM mysql('ip:port', 'database', 'table', 'root', 'password'); -
使用clickhouse尽情各种查询吧