-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhive-compose.yml
86 lines (83 loc) · 2.86 KB
/
hive-compose.yml
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
version: '3.9'
# https://github.com/apache/hive/blob/master/packaging/src/docker/docker-compose.yml
services:
postgres:
# The postgres:16 image uses Debian as its base, and has some issues
image: postgres:16-alpine
restart: unless-stopped
container_name: postgres
hostname: postgres
environment:
POSTGRES_DB: 'metastore_db'
POSTGRES_USER: 'hive'
POSTGRES_PASSWORD: 'password'
ports:
- '5432:5432'
volumes:
- hive-db:/var/lib/postgresql
# access cmd is `psql metastore_db hive`, don't forget the database arg, otherwrise, `FATAL: database "hive" does not exist`
metastore:
image: apache/hive:${HIVE_VERSION}
depends_on:
- postgres
restart: unless-stopped
container_name: metastore
hostname: metastore
environment:
DB_DRIVER: postgres
SERVICE_NAME: 'metastore'
SERVICE_OPTS: '-Xmx1G -Djavax.jdo.option.ConnectionDriverName=org.postgresql.Driver
-Djavax.jdo.option.ConnectionURL=jdbc:postgresql://postgres:5432/metastore_db
-Djavax.jdo.option.ConnectionUserName=hive
-Djavax.jdo.option.ConnectionPassword=password'
# HIVE_CUSTOM_CONF_DIR: /hive_custom_conf # can't replace hive-site.xml
ports:
- '9083:9083'
volumes:
- type: bind
source: hive/postgresql-42.5.1.jar
target: /opt/hive/lib/postgres.jar
- type: bind
source: hive/conf/hive-site.xml
target: /opt/hive/conf/hive-site.xml
# maybe needless(we always access hive by hs2)
- type: bind
source: hive/conf/core-site.xml
target: /opt/hadoop/etc/hadoop/core-site.xml
# hiveserver2 should have all configs
hiveserver2:
image: apache/hive:${HIVE_VERSION}
depends_on:
- metastore
restart: unless-stopped
container_name: hiveserver2
environment:
HIVE_SERVER2_THRIFT_PORT: 10000
SERVICE_OPTS: '-Xmx1G -Dhive.metastore.uris=thrift://metastore:9083'
IS_RESUME: 'true'
SERVICE_NAME: 'hiveserver2'
ports:
- '10000:10000'
- '10002:10002'
volumes:
- type: bind
source: hive/postgresql-42.5.1.jar
target: /opt/hive/lib/postgres.jar
- type: bind
source: hive/conf/hive-site.xml
target: /opt/hive/conf/hive-site.xml
# for create db(hdfs dir) permission issue `/tmp/hive on HDFS should be writable. Current permissions are: rwxr-xr-x`
- type: bind
source: hive/conf/core-site.xml
target: /opt/hadoop/etc/hadoop/core-site.xml
volumes:
hive-db:
# hive_db
# The volume persists the metadata of Hive tables inside Postgres container.
# warehouse
# The volume stores tables' files inside HiveServer2 container.
# docker exec -it hiveserver2 beeline -u 'jdbc:hive2://hiveserver2:10000/'
networks:
default:
name: ${NETWORK_NAME}
external: true