Clickhouse单机版安装

Clickhouse单机版安装

默认已经安装好Docker

运行docker拉去clickhouse镜像

1
docker run -d --name ch-server --ulimit nofile=262144:262144 -p 8123:8123 -p 9000:9000 -p 9009:9009 yandex/clickhouse-server

执行结果

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
BrucedeMacBook-Pro:access brucexie$ 
BrucedeMacBook-Pro:access brucexie$ 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
5bed26d33875: Pull complete
f11b29a9c730: Pull complete
930bda195c84: Pull complete
78bf9a5ad49e: Pull complete
48c0344961cc: Pull complete
95297bce383f: Pull complete
e94e305e3659: Pull complete
a6fac603533b: Pull complete
2d3c70d84327: Pull complete
20b7c5270667: Pull complete
e823f6d09260: Pull complete
Digest: sha256:a5205317af160b0480232a2f6dbd84c62b792e6f30f95c4ea0b1089f29d0f7cc
Status: Downloaded newer image for yandex/clickhouse-server:latest
b3d1d48a41e8b678a00f1b1ebc9043b8385b4705b4439d025bde153b3ef3306d
BrucedeMacBook-Pro:access brucexie$

查看镜像

1
2
3
4
5
BrucedeMacBook-Pro:access brucexie$ 
BrucedeMacBook-Pro:access brucexie$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
yandex/clickhouse-server latest bb41d103e9b1 3 days ago 496MB
BrucedeMacBook-Pro:access brucexie$

进入容器

1
2
3
4
5
BrucedeMacBook-Pro:access brucexie$ docker run -it bb41d103e9b1 /bin/bash
root@3b81db4890aa:/#
root@3b81db4890aa:/# ps -ef | grep clickhouse-client
root 43 1 0 00:48 pts/0 00:00:00 grep --color=auto clickhouse-client
root@3b81db4890aa:/#

连接容器

1
2
3
4
5
6
7
root@3b81db4890aa:/# 
root@3b81db4890aa:/# clickhouse-client --host 10.97.180.3
ClickHouse client version 20.3.7.46 (official build).
Connecting to 10.97.180.3:9000 as user default.
Connected to ClickHouse server version 20.3.7 revision 54433.

b3d1d48a41e8 :)

开始使用

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
b3d1d48a41e8 :) 
b3d1d48a41e8 :) show databases;

SHOW DATABASES

┌─name────┐
default
│ system │
└─────────┘

2 rows in set. Elapsed: 0.006 sec.

b3d1d48a41e8 :)
b3d1d48a41e8 :) use system;

USE system

Ok.

0 rows in set. Elapsed: 0.005 sec.

b3d1d48a41e8 :) show tables;

SHOW TABLES

┌─name───────────────────────────┐
│ aggregate_function_combinators │
│ asynchronous_metrics │
│ build_options │
│ clusters │
│ collations │
│ columns │
│ contributors │
│ data_type_families │
│ databases │
│ detached_parts │
│ dictionaries │
│ disks │
│ events │
│ formats │
│ functions │
│ graphite_retentions │
│ macros │
│ merge_tree_settings │
│ merges │
│ metric_log │
│ metrics │
│ models │
│ mutations │
│ numbers │
│ numbers_mt │
│ one │
│ parts │
│ parts_columns │
│ processes │
│ quota_usage │
│ quotas │
│ replicas │
│ replication_queue │
│ row_policies │
│ settings │
│ stack_trace │
│ storage_policies │
│ table_engines │
│ table_functions │
│ tables │
│ zeros │
│ zeros_mt │
└────────────────────────────────┘

42 rows in set. Elapsed: 0.007 sec.

b3d1d48a41e8 :)