Derby example
Please note that the version you need to specify is not only the version of Apache Hive which you want to roll out, but has to be amended with a Stackable version as shown. This Stackable version is the version of the underlying container image which is used to execute the processes. For a list of available versions please check our image registry. It should generally be safe to simply use the latest image version that is available.
---
apiVersion: hive.stackable.tech/v1alpha1
kind: HiveCluster
metadata:
name: simple-hive-derby
spec:
image:
productVersion: 4.0.0
clusterConfig:
database:
connString: jdbc:derby:;databaseName=/tmp/metastore_db;create=true
credentialsSecret: hive-credentials
dbType: derby
metastore:
roleGroups:
default:
replicas: 1
---
apiVersion: v1
kind: Secret
metadata:
name: hive-credentials
type: Opaque
stringData:
username: APP
password: mine
You should not use the Derby database in production. Derby stores data locally which does not work in high availability setups (multiple replicas) and all data is lost after Pod restarts.
|
To create a single node Apache Hive Metastore (v4.0.0) cluster with derby and S3 access, deploy a minio (or use any available S3 bucket):
helm install minio \
minio \
--repo https://charts.bitnami.com/bitnami \
--set auth.rootUser=minio-access-key \
--set auth.rootPassword=minio-secret-key
In order to upload data to minio we need a port-forward to access the web ui.
kubectl port-forward service/minio 9001
Then, connect to localhost:9001 and login with the user minio-access-key
and password minio-secret-key
. Create a bucket and upload data.
Deploy the hive cluster:
---
apiVersion: hive.stackable.tech/v1alpha1
kind: HiveCluster
metadata:
name: simple-hive-derby
spec:
image:
productVersion: 4.0.0
clusterConfig:
database:
connString: jdbc:derby:;databaseName=/stackable/metastore_db;create=true
credentialsSecret: hive-credentials
dbType: derby
s3:
inline:
host: minio
port: 9000
accessStyle: Path
credentials:
secretClass: simple-hive-s3-secret-class
metastore:
roleGroups:
default:
replicas: 1
---
apiVersion: secrets.stackable.tech/v1alpha1
kind: SecretClass
metadata:
name: simple-hive-s3-secret-class
spec:
backend:
k8sSearch:
searchNamespace:
pod: {}
---
apiVersion: v1
kind: Secret
metadata:
name: simple-hive-s3-secret
labels:
secrets.stackable.tech/class: simple-hive-s3-secret-class
stringData:
accessKey: minio-access-key
secretKey: minio-secret-key
---
apiVersion: v1
kind: Secret
metadata:
name: hive-credentials
type: Opaque
stringData:
username: APP
password: mine
To create a single node Apache Hive Metastore using PostgreSQL, deploy a PostgreSQL instance via helm.
This installs PostgreSQL in version 10 to work around the issue mentioned above:
helm install hive bitnami/postgresql --version=12.1.5 \
--set postgresqlUsername=hive \
--set postgresqlPassword=hive \
--set postgresqlDatabase=hive
apiVersion: hive.stackable.tech/v1alpha1
kind: HiveCluster
metadata:
name: simple-hive-postgres
spec:
image:
productVersion: 4.0.0
clusterConfig:
database:
connString: jdbc:postgresql://hive-postgresql.default.svc.cluster.local:5432/hive
credentialsSecret: hive-credentials
dbType: postgres
metastore:
roleGroups:
default:
replicas: 1
---
apiVersion: v1
kind: Secret
metadata:
name: hive-credentials
type: Opaque
stringData:
username: hive
password: hive