Skip to content

Commit 950ea8a

Browse files
committed
Initialize Metastore DB from backup.
1 parent d8997fe commit 950ea8a

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

metastore-image/Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@
1818

1919
FROM openjdk:8-jre
2020

21-
#COPY ./archive/apache-hive-2.3.6-bin.tar.gz /opt
22-
#COPY ./archive/db-derby-10.10.2.0-bin.tar.gz /opt
23-
#COPY ./archive/hadoop-2.9.2.tar.gz /opt
24-
2521
# Copy binary distributions from Apache servers/mirrors
2622
RUN cd /opt && \
2723
wget http://apache.lauf-forum.at/hadoop/common/hadoop-2.9.2/hadoop-2.9.2.tar.gz && \
@@ -43,6 +39,12 @@ RUN cd /opt && \
4339
cp /opt/db-derby-10.10.2.0-bin/lib/derbytools.jar /opt/apache-hive-2.3.6-bin/lib
4440

4541
COPY hive-conf/hive-site.xml /opt/apache-hive-2.3.6-bin/conf
42+
43+
# Copy metastore_db backup file and restore it
44+
COPY ./metastore_db_backup.tar /
45+
RUN cd /; \
46+
tar xf /metastore_db_backup.tar; \
47+
rm /metastore_db_backup.tar;
4648

4749
ENV HADOOP_HOME /opt/hadoop-2.9.2
4850
ENV DERBY_INSTALL /opt/db-derby-10.10.2.0-bin

metastore-image/docker-entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# start Derby
44
/opt/db-derby-10.10.2.0-bin/bin/startNetworkServer -h 0.0.0.0 &
55

6-
# create Metastore schema
7-
/opt/apache-hive-2.3.6-bin/bin/schematool -initSchema -dbType derby
6+
# create Metastore schema. Not needed because we restored a database backup
7+
# /opt/apache-hive-2.3.6-bin/bin/schematool -initSchema -dbType derby
88

99
# start Metastore
1010
/opt/apache-hive-2.3.6-bin/bin/hive --service metastore -p 9083
5.46 MB
Binary file not shown.

0 commit comments

Comments
 (0)