Skip to content

Instantly share code, notes, and snippets.

@Xuanwo
Created February 8, 2025 16:08
Show Gist options
  • Save Xuanwo/979cb81e2f7ed66d7afe43f038c8aaec to your computer and use it in GitHub Desktop.
Save Xuanwo/979cb81e2f7ed66d7afe43f038c8aaec to your computer and use it in GitHub Desktop.
docker compose for hive 4 on hdfs with postgres as external metastore
version: '3.8'
services:
namenode:
image: bde2020/hadoop-namenode:2.0.0-hadoop3.2.1-java8
container_name: namenode
hostname: namenode.local
environment:
- CLUSTER_NAME=hive-cluster
ports:
- "9870:9870" # HDFS Web UI
- "8020:8020" # HDFS RPC
volumes:
- namenode-data:/hadoop/dfs/name
networks:
- hive-network
datanode:
image: bde2020/hadoop-datanode:2.0.0-hadoop3.2.1-java8
container_name: datanode
hostname: datanode.local
environment:
- CORE_CONF_fs_defaultFS=hdfs://namenode.local:8020
volumes:
- datanode-data:/hadoop/dfs/data
depends_on:
- namenode
networks:
- hive-network
metastore-db:
image: postgres:14
container_name: metastore-db
hostname: metastore-db.local
environment:
POSTGRES_USER: hive
POSTGRES_PASSWORD: hivepassword
POSTGRES_DB: metastore
volumes:
- metastore-db-data:/var/lib/postgresql/data
networks:
- hive-network
metastore:
image: apache/hive:4.0.0
container_name: metastore
hostname: metastore.local
environment:
SERVICE_NAME: metastore
HIVE_METASTORE_USER: hive
HIVE_METASTORE_PASSWORD: hivepassword
HIVE_METASTORE_DB_HOSTNAME: metastore-db.local
CORE_CONF_fs_defaultFS: hdfs://namenode.local:8020
depends_on:
- namenode
- datanode
- metastore-db
ports:
- "9083:9083" # Hive Metastore Port
networks:
- hive-network
hiveserver2:
image: apache/hive:4.0.0
container_name: hiveserver2
hostname: hiveserver2
environment:
SERVICE_NAME: hiveserver2
HIVE_METASTOREURIS: thrift://metastore.local:9083
CORE_CONF_fs_defaultFS: hdfs://namenode.local:8020
depends_on:
- metastore
ports:
- "10000:10000" # HiveServer2 JDBC Port
- "10002:10002" # Hive Beeline Port
networks:
- hive-network
volumes:
namenode-data:
datanode-data:
metastore-db-data:
networks:
hive-network:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment