Lightweight Hive Metastore with PostgreSQL
2.4K
A minimal, production-ready Docker image for running the Apache Hive Metastore backed by an external PostgreSQL database. Designed for security, observability, and automation in container environments.
4.0.1)eclipse-temurin:21-jdk-alpine)hive userhive-site.xml via volume mountdocker pull seathegood/hive-metastore:latest
docker run -d \
-e POSTGRES_USER=hive \
-e POSTGRES_PASSWORD=hivepassword \
-e METASTORE_DB_HOST=postgres.local \
-e METASTORE_DB_PORT=5432 \
-e METASTORE_PORT=9083 \
-p 9083:9083 \
seathegood/hive-metastore:latest
This image includes the PostgreSQL JDBC driver and does not require manual copying.
| Variable | Description |
|---|---|
POSTGRES_USER | Username for the metastore DB |
POSTGRES_PASSWORD | Password for the metastore DB |
METASTORE_DB_HOST | Hostname of the PostgreSQL database |
METASTORE_DB_PORT | Port of the PostgreSQL database (default: 5432) |
METASTORE_PORT | Port to expose Hive Metastore (default: 9083) |
You may optionally set
METASTORE_DB_URLto override the full JDBC connection string.
This image includes a healthcheck that:
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s \
CMD ["/usr/local/bin/healthcheck.sh"]
Hive Metastore logs are sent to stdout and stderr, making them accessible via:
docker logs <container>
No log files are written to disk by default.
The container traps SIGTERM and SIGINT to ensure the Hive process shuts down cleanly.
To further harden the container in orchestration environments:
securityContext:
runAsUser: 999
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
docker build -t hive-metastore:local \
--build-arg HIVE_VERSION=4.0.1 \
--build-arg HADOOP_VERSION=3.4.1 \
.
ci.yml: Linting and validationpublish.yml: Builds and pushes Docker images on tagged releasescheck-upstream.yml: Monitors for Hive releases, bumps versions, and creates pull requests/releasesversion: '3.8'
services:
postgres:
image: postgres:15
environment:
POSTGRES_USER: hive
POSTGRES_PASSWORD: hivepassword
POSTGRES_DB: metastore_db
ports:
- 5432:5432
hive-metastore:
image: seathegood/hive-metastore:latest
depends_on:
- postgres
environment:
POSTGRES_USER: hive
POSTGRES_PASSWORD: hivepassword
METASTORE_DB_HOST: postgres
METASTORE_DB_PORT: 5432
METASTORE_PORT: 9083
ports:
- 9083:9083
healthcheck:
test: ["CMD", "/usr/local/bin/healthcheck.sh"]
interval: 30s
timeout: 10s
retries: 3
apiVersion: apps/v1
kind: Deployment
metadata:
name: hive-metastore
spec:
replicas: 1
selector:
matchLabels:
app: hive-metastore
template:
metadata:
labels:
app: hive-metastore
spec:
containers:
- name: metastore
image: seathegood/hive-metastore:latest
ports:
- containerPort: 9083
env:
- name: POSTGRES_USER
value: hive
- name: POSTGRES_PASSWORD
value: hivepassword
- name: METASTORE_DB_HOST
value: postgres.default.svc.cluster.local
- name: METASTORE_DB_PORT
value: "5432"
- name: METASTORE_PORT
value: "9083"
readinessProbe:
exec:
command: ["/usr/local/bin/healthcheck.sh"]
initialDelaySeconds: 30
periodSeconds: 15
---
apiVersion: v1
kind: Service
metadata:
name: hive-metastore
spec:
ports:
- port: 9083
targetPort: 9083
selector:
app: hive-metastore
hiveMetastore:
enabled: true
image:
repository: seathegood/hive-metastore
tag: latest
env:
POSTGRES_USER: hive
POSTGRES_PASSWORD: hivepassword
METASTORE_DB_HOST: postgres
METASTORE_DB_PORT: 5432
METASTORE_PORT: 9083
service:
type: ClusterIP
port: 9083
We welcome contributions! See CONTRIBUTING.md for details on local setup, testing, and release process.
MIT License — see the LICENSE file.
This project includes software distributed under the Apache License 2.0, including Apache Hive and Apache Hadoop.
See the LICENSES directory for more details.
NOTICE files are also included to meet Apache License 2.0 requirements. See the top-level NOTICE file and licenses/ directory.
For a full list of included components and their licenses, see THIRD_PARTY.md.
Content type
Image
Digest
sha256:e56511fda…
Size
502.8 MB
Last updated
12 months ago
docker pull seathegood/hive-metastore