-
Notifications
You must be signed in to change notification settings - Fork 2
/
hive.yaml
230 lines (228 loc) · 6.45 KB
/
hive.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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
---
apiVersion: v1
kind: Namespace
metadata:
name: hive
---
apiVersion: v1
kind: ConfigMap
metadata:
creationTimestamp: null
name: metastore-cfg
namespace: hive
data:
core-site.xml: |2-
<configuration>
<property>
<name>fs.s3a.connection.ssl.enabled</name>
<value>false</value>
</property>
<property>
<name>fs.s3a.endpoint</name>
<value>http://minio.minio.svc.cluster.local:9000</value>
</property>
<property>
<name>fs.s3a.fast.upload</name>
<value>true</value>
</property>
<property>
<name>fs.s3a.access.key</name>
<value>${env.AWS_ACCESS_KEY_ID}</value>
</property>
<property>
<name>fs.s3a.secret.key</name>
<value>${env.AWS_SECRET_ACCESS_KEY}</value>
</property>
<property>
<name>fs.s3a.path.style.access</name>
<value>true</value>
</property>
</configuration>
metastore-site.xml: |2-
<configuration>
<property>
<name>metastore.task.threads.always</name>
<value>org.apache.hadoop.hive.metastore.events.EventCleanerTask</value>
</property>
<property>
<name>metastore.expression.proxy</name>
<value>org.apache.hadoop.hive.metastore.DefaultPartitionExpressionProxy</value>
</property>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:postgresql://postgres.postgres.svc.cluster.local:5432/${env.POSTGRES_DB}?allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=UTC</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>org.postgresql.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>${env.POSTGRES_USER}</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>${env.POSTGRES_PASSWORD}</value>
</property>
<property>
<name>metastore.warehouse.dir</name>
<value>s3a://test/warehouse</value>
</property>
<property>
<name>metastore.thrift.port</name>
<value>9083</value>
</property>
<property>
<name>metastore.log4j.file</name>
<value>/opt/metastore-log4j2.properties</value>
</property>
</configuration>
---
# same secret as in minio namespace, the minio admin account - for ease of use (s3 key/secret)
apiVersion: v1
kind: Secret
metadata:
name: minio-admin
namespace: hive
data:
username: YWRtaW4= #admin
password: YWRtaW5wYXNzd29yZDEyMw== #adminpassword123
---
#same secret that is in the postgres namespace
apiVersion: v1
kind: Secret
metadata:
name: postgres-admin
namespace: hive
data:
db: cG9zdGdyZXM= #postgres
password: cG9zdGdyZXNzcGFzc3dvcmQxMjM= #postgresspassword123
user: cG9zdGdyZXM= #postgres
---
apiVersion: v1
kind: ConfigMap
metadata:
name: hive-postgres-init-script
namespace: hive
data:
entrypoint.sh: |-
#!/bin/bash
/opt/apache-hive-metastore-3.1.3-bin/bin/schematool --verbose -initSchema -dbType postgres -userName $POSTGRES_USER -passWord $POSTGRES_PASSWORD -url jdbc:postgresql://postgres.postgres.svc.cluster.local:5432/$POSTGRES_DB
---
apiVersion: batch/v1
kind: Job
metadata:
name: hive-initschema
namespace: hive
spec:
template:
spec:
containers:
- name: hivemeta
image: alexcpn/hivemetastore:3.13
command: ["/bin/entrypoint.sh"]
volumeMounts:
- name: hive-postgres-init-script-volume
mountPath: /bin/entrypoint.sh
readOnly: true
subPath: entrypoint.sh
env:
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: postgres-admin
key: db
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: postgres-admin
key: user
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-admin
key: password
restartPolicy: Never
volumes:
- name: hive-postgres-init-script-volume
configMap:
defaultMode: 0700
name: hive-postgres-init-script
backoffLimit: 1
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: metastore
namespace: hive
spec:
selector:
matchLabels:
app: metastore
strategy:
type: Recreate
template:
metadata:
labels:
app: metastore
spec:
containers:
- name: metastore
image: alexcpn/hivemetastore:3.1.3.5
env:
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: postgres-admin
key: db
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: postgres-admin
key: user
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-admin
key: password
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: minio-admin
key: username
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: minio-admin
key: password
ports:
- containerPort: 9083
volumeMounts:
- name: metastore-cfg-vol
mountPath: /opt/apache-hive-metastore-3.1.3-bin/conf/metastore-site.xml
subPath: metastore-site.xml
- name: metastore-cfg-vol
mountPath: /opt/hadoop-3.3.0/etc/hadoop/core-site.xml
subPath: core-site.xml
command: ["/opt/apache-hive-metastore-3.1.3-bin/bin/start-metastore"]
args: ["-p", "9083"]
resources:
requests:
memory: "1G"
imagePullPolicy: Always
volumes:
- name: metastore-cfg-vol
configMap:
name: metastore-cfg
---
apiVersion: v1
kind: Service
metadata:
name: metastore
namespace: hive
spec:
type: LoadBalancer
ports:
- port: 9083
selector:
app: metastore