-
Notifications
You must be signed in to change notification settings - Fork 2
/
demo2-s3-01.yaml
173 lines (173 loc) · 6.21 KB
/
demo2-s3-01.yaml
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
apiVersion: "clickhouse.altinity.com/v1"
kind: "ClickHouseInstallation"
metadata:
name: "demo2"
spec:
configuration:
clusters:
- name: "s3"
layout:
replicasCount: 2
shardsCount: 1
templates:
podTemplate: replica-1
volumeClaimTemplate: storage
zookeeper:
nodes:
- host: keeper-keeper
port: 2181
profiles:
default/allow_experimental_refreshable_materialized_view: 1
files:
# Allow zero-copy replication for demonstration purposes. It
# should be used very cautiously in production settings.
config.d/ed_zero_copy.xml: |
<clickhouse>
<merge_tree>
<allow_remote_fs_zero_copy_replication>false</allow_remote_fs_zero_copy_replication>
</merge_tree>
</clickhouse>
config.d/ed_s3_datalake.xml: |
<clickhouse>
<s3>
<data-lake>
<endpoint from_env="AWS_S3_DATALAKE_URL"/>
<use_environment_credentials>1</use_environment_credentials>
</data-lake>
</s3>
</clickhouse>
config.d/ed_storage_configuration.xml: |
<clickhouse>
<storage_configuration>
<disks>
<!-- Disk with single endpoint for all replicas. -->
<s3_disk>
<type>s3</type>
<endpoint from_env="AWS_S3_DISK_URL"/>
<metadata_path>/var/lib/clickhouse/disks/s3_disk/</metadata_path>
<use_environment_credentials>1</use_environment_credentials>
</s3_disk>
<!-- Disk with separate endpoint for each replica. -->
<s3_disk_with_replica>
<type>s3</type>
<endpoint from_env="AWS_S3_DISK_WITH_REPLICA_URL"/>
<metadata_path>/var/lib/clickhouse/disks/s3_disk_with_replica/</metadata_path>
<use_environment_credentials>1</use_environment_credentials>
</s3_disk_with_replica>
<!-- Disk with single endpoint for each shard. -->
<s3_zero_copy>
<type>s3</type>
<endpoint from_env="AWS_S3_ZERO_COPY_URL"/>
<metadata_path>/var/lib/clickhouse/disks/s3_zero_copy/</metadata_path>
<use_environment_credentials>1</use_environment_credentials>
</s3_zero_copy>
<!-- Local disk cache -->
<s3_disk_cache>
<type>cache</type>
<disk>s3_disk</disk>
<path>/var/lib/clickhouse/s3_disk_cache/cache/</path>
<max_size>100Gi</max_size>
<cache_on_write_operations>1</cache_on_write_operations>
</s3_disk_cache>
</disks>
<policies>
<!-- S3-backed MergeTree with single endpoint, no disk cache -->
<s3_disk_policy>
<volumes>
<main>
<disk>s3_disk</disk>
</main>
</volumes>
</s3_disk_policy>
<!-- S3-backed MergeTree with an endpoint for each replica, no disk cache -->
<s3_disk_with_replica_policy>
<volumes>
<main>
<disk>s3_disk_with_replica</disk>
</main>
</volumes>
</s3_disk_with_replica_policy>
<!-- S3-backed MergeTree with disk cache -->
<s3_disk_cached_policy>
<volumes>
<main>
<disk>s3_disk_cache</disk>
</main>
</volumes>
</s3_disk_cached_policy>
<!-- Block storage tiered with S3-backed MergeTree -->
<s3_tiered_policy>
<volumes>
<default>
<disk>default</disk>
<move_factor>0.1</move_factor>
</default>
<s3_disk_cached>
<disk>s3_disk_cache</disk>
<prefer_not_to_merge>true</prefer_not_to_merge>
<perform_ttl_move_on_insert>false</perform_ttl_move_on_insert>
</s3_disk_cached>
</volumes>
</s3_tiered_policy>
<!-- S3-backed MergeTree with zero-copy replication -->
<s3_zero_copy_policy>
<volumes>
<main>
<disk>s3_zero_copy</disk>
</main>
</volumes>
</s3_zero_copy_policy>
</policies>
</storage_configuration>
</clickhouse>
templates:
podTemplates:
- name: replica-1
spec:
nodeSelector:
node.kubernetes.io/instance-type: m6i.large
containers:
- name: clickhouse
image: clickhouse/clickhouse-server:24.3.3.102
env:
- name: AWS_S3_DISK_URL
valueFrom:
secretKeyRef:
name: s3-credentials
key: AWS_S3_DISK_URL
- name: AWS_S3_DISK_WITH_REPLICA_URL
valueFrom:
secretKeyRef:
name: s3-credentials
key: AWS_S3_DISK_WITH_REPLICA_URL
- name: AWS_S3_ZERO_COPY_URL
valueFrom:
secretKeyRef:
name: s3-credentials
key: AWS_S3_ZERO_COPY_URL
- name: AWS_S3_DATALAKE_URL
valueFrom:
secretKeyRef:
name: s3-credentials
key: AWS_S3_DATALAKE_URL
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: s3-credentials
key: AWS_ACCESS_KEY_ID
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: s3-credentials
key: AWS_SECRET_ACCESS_KEY
volumeClaimTemplates:
- name: storage
# PVCs must be deleted manually.
reclaimPolicy: Retain
spec:
storageClassName: gp3-encrypted
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 200Gi