Skip to content

Commit 5f0eb8c

Browse files
author
Xiaochong Wei
committed
Init
1 parent 8ea32d6 commit 5f0eb8c

File tree

1 file changed

+223
-0
lines changed

1 file changed

+223
-0
lines changed

yscope-k8s/README.md

Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
# Setup
2+
3+
## Dependency Installation
4+
5+
### Install docker
6+
7+
Follow the guide here: [docker]
8+
9+
### Install kubectl
10+
11+
`kubectl` is the command-line tool for interacting with Kubernetes clusters. You will use it to
12+
manage and inspect your k3d cluster.
13+
14+
Follow the guide here: [kubectl]
15+
16+
### Install k3d
17+
18+
k3d is a lightweight wrapper to run k3s (Rancher Lab's minimal Kubernetes distribution) in docker.
19+
20+
Follow the guide here: [k3d]
21+
22+
### Runbook
23+
24+
Import the images and apply them to the cluster:
25+
```shell
26+
# Create a cluster called presto
27+
# There should be two directories under /path/to/host/configs/:
28+
# - /path/to/host/configs/etc-coordinator:
29+
# - /path/to/host/configs/etc-coordinator/catalog/clp.properties
30+
# - /path/to/host/configs/etc-coordinator/config.properties
31+
# - /path/to/host/configs/etc-coordinator/jvm.config
32+
# - /path/to/host/configs/etc-coordinator/log.properties
33+
# - /path/to/host/configs/etc-coordinator/metadata-filter.json
34+
# - /path/to/host/configs/etc-coordinator/node.properties
35+
#
36+
# - /path/to/host/configs/etc-worker:
37+
# - /path/to/host/configs/etc-worker/catalog/clp.properties
38+
# - /path/to/host/configs/etc-worker/config.properties
39+
# - /path/to/host/configs/etc-worker/node.properties
40+
# - /path/to/host/configs/etc-worker/velox.properties
41+
#
42+
# There will be examples of these config files in the following sections
43+
k3d cluster create presto --servers 1 --agents 1 -v /path/to/host/configs/:/configs
44+
# Load the coordinator image
45+
k3d image import ghcr.io/y-scope/yscope-presto-with-clp-connector-coordinator:latest -c presto
46+
# Load the worker image
47+
k3d image import ghcr.io/y-scope/yscope-presto-with-clp-connector-worker:latest -c presto
48+
# Launch the container
49+
kubectl apply -f coordinator.yaml worker.yaml
50+
```
51+
52+
To do a sanity check:
53+
```shell
54+
kubectl port-forward svc/presto-coordinator 8080:8080
55+
# Check is coordinator alive
56+
curl -X GET http://coordinator:8080/v1/info
57+
# Check is worker connected to the coordinator
58+
curl -X GET http://coordinator:8080/v1/nodes
59+
```
60+
61+
# Example Configs for Coordinator
62+
63+
Example of k8s image YAML:
64+
```yaml
65+
apiVersion: v1
66+
kind: Pod
67+
metadata:
68+
labels:
69+
app: coordinator
70+
name: coordinator
71+
spec:
72+
containers:
73+
- name: coordinator
74+
image: ghcr.io/y-scope/yscope-0.293-coordinator:latest
75+
imagePullPolicy: Never
76+
volumeMounts:
77+
- name: "coordinator-config"
78+
mountPath: "/opt/presto-server/etc"
79+
volumes:
80+
- name: "coordinator-config"
81+
hostPath:
82+
path: "/configs/etc-coordinator"
83+
---
84+
apiVersion: v1
85+
kind: Service
86+
metadata:
87+
name: coordinator
88+
labels:
89+
app: coordinator
90+
spec:
91+
type: NodePort
92+
ports:
93+
- port: 8080
94+
nodePort: 30000
95+
name: "8080"
96+
selector:
97+
app: coordinator
98+
```
99+
100+
Example of `/path/to/host/configs/etc-coordinator/catalog/clp.properties` (need to update `clp.metadata-db-*` fields):
101+
```
102+
connector.name=clp
103+
clp.metadata-provider-type=mysql
104+
clp.metadata-db-url=jdbc:mysql://REPLACE_ME
105+
clp.metadata-db-name=REPLACE_ME
106+
clp.metadata-db-user=REPLACE_ME
107+
clp.metadata-db-password=REPLACE_ME
108+
clp.metadata-table-prefix=clp_
109+
clp.split-provider-type=mysql
110+
clp.metadata-filter-config=$(pwd)/etc-coordinator/metadata-filter.json
111+
```
112+
113+
Example of `/path/to/host/configs/etc-coordinator/config.properties`:
114+
```
115+
coordinator=true
116+
node-scheduler.include-coordinator=false
117+
http-server.http.port=8080
118+
query.max-memory=1GB
119+
query.max-memory-per-node=1GB
120+
discovery-server.enabled=true
121+
discovery.uri=http://localhost:8080
122+
optimizer.optimize-hash-generation=false
123+
regex-library=RE2J
124+
use-alternative-function-signatures=true
125+
inline-sql-functions=false
126+
nested-data-serialization-enabled=false
127+
native-execution-enabled=true
128+
```
129+
130+
Example of `/path/to/host/configs/etc-coordinator/jvm.config`:
131+
```
132+
-server
133+
-Xmx4G
134+
-XX:+UseG1GC
135+
-XX:G1HeapRegionSize=32M
136+
-XX:+UseGCOverheadLimit
137+
-XX:+ExplicitGCInvokesConcurrent
138+
-XX:+HeapDumpOnOutOfMemoryError
139+
-XX:+ExitOnOutOfMemoryError
140+
-Djdk.attach.allowAttachSelf=true
141+
```
142+
143+
Example of `/path/to/host/configs/etc-coordinator/log.properties`:
144+
```
145+
com.facebook.presto=DEBUG
146+
```
147+
148+
Example of `/path/to/host/configs/etc-coordinator/metadata-filter.json`:
149+
```
150+
{
151+
"clp.default": [
152+
{
153+
"filterName": "msg.timestamp",
154+
"rangeMapping": {
155+
"lowerBound": "begin_timestamp",
156+
"upperBound": "end_timestamp"
157+
},
158+
"required": true
159+
}
160+
]
161+
}
162+
```
163+
164+
Example of `/path/to/host/configs/etc-coordinator/node.properties`:
165+
```
166+
node.environment=production
167+
node.id=coordinator
168+
```
169+
170+
# Example Configs for Worker
171+
172+
Example of k8s image YAML:
173+
🚧This is still in progress.
174+
```yaml
175+
apiVersion: v1
176+
kind: Pod
177+
metadata:
178+
labels:
179+
app: worker
180+
name: worker
181+
spec:
182+
containers:
183+
- name: worker
184+
image: ubuntu:22.04
185+
# imagePullPolicy: Never
186+
command:
187+
- /bin/bash
188+
- -c
189+
args:
190+
- sleep infinity
191+
```
192+
193+
Example of `/path/to/host/configs/etc-worker/catalog/clp.properties`:
194+
```
195+
connector.name=clp
196+
```
197+
198+
Example of `/path/to/host/configs/etc-worker/config.properties` (need to replace the `presto.version` to make it the same as coordinator`s):
199+
```
200+
discovery.uri=http://127.0.0.1:8080
201+
presto.version=REPLACE_ME
202+
http-server.http.port=7777
203+
shutdown-onset-sec=1
204+
register-test-functions=false
205+
runtime-metrics-collection-enabled=false
206+
```
207+
208+
Example of `/path/to/host/configs/etc-worker/node.properties`:
209+
```
210+
node.environment=production
211+
node.internal-address=127.0.0.1
212+
node.location=testing-location
213+
node.id=worker-1
214+
```
215+
216+
Example of `/path/to/host/configs/etc-worker/velox.properties`:
217+
```
218+
mutable-config=true
219+
```
220+
221+
[docker]: https://docs.docker.com/engine/install
222+
[k3d]: https://k3d.io/stable/#installation
223+
[kubectl]: https://kubernetes.io/docs/tasks/tools/#kubectl

0 commit comments

Comments
 (0)