默认已经安装好Docker, 尚未安装docker的可以参考这篇: Ubuntu安装Docker
- 直接运行, docker会自动帮你拉取镜像:
docker run -d --name ch-server --ulimit nofile=262144:262144 -p 8123:8123 -p 9000:9000 -p 9009:9009 yandex/clickhouse-server
- 执行情况:
Unable to find image 'yandex/clickhouse-server:latest' locally
latest: Pulling from yandex/clickhouse-server
423ae2b273f4: Pull complete
de83a2304fa1: Pull complete
f9a83bce3af0: Pull complete
b6b53be908de: Pull complete
965325ddb17a: Pull complete
0578e5e66a8e: Pull complete
cf4817e12b9b: Pull complete
fc49cff4c4a9: Pull complete
9d0dcd4885ed: Pull complete
7c6aa06ea350: Pull complete
26b0facd9219: Pull complete
Digest: sha256:26692f0312d8456bb9091957ce532135eeb31648adc3c7e22f31443cde8b9f1d
Status: Downloaded newer image for yandex/clickhouse-server:latest
e8e77479edf9b81f61f5a1edd13b15f2587211081aba9bc15981be99caa1f8df
-
查看镜像
root@node01:~# docker images REPOSITORY TAG IMAGE ID CREATED SIZE yandex/clickhouse-server latest f62e485ae47b 6 days ago 492MB
-
进入容器
root@node01:~# docker run -it f62e485ae47b /bin/bash
-
启动clickhouse-client
root@f535e209602a:/# clickhouse-client --host 192.168.180.130 ClickHouse client version 20.3.4.10 (official build). Connecting to 192.168.180.130:9000 as user default. Connected to ClickHouse server version 20.3.4 revision 54433.
-
查看数据库
e8e77479edf9 :) show databases; SHOW DATABASES ┌─name────┐ │ default │ │ system │ └─────────┘ 2 rows in set. Elapsed: 0.002 sec.