Member since
09-21-2017
3
Posts
1
Kudos Received
0
Solutions
08-03-2018
09:32 AM
Tip and top... 😉
... View more
08-03-2018
09:31 AM
1 Kudo
Thanks Eric for your post. This is useful and very efficient.
... View more
09-21-2017
10:17 AM
Hi all, Thank you Brandon for posting your idea. I have used the framework and built an KSH script to export successfully my Hive databases. I share herewith the content of what I have conceived, just have to replace the key words and use the right user to execute and backup your databases: #!/bin/ksh
# Author: Francois Tizie
# 2017/09/19
# This program exports all tables from the given Hive database
##############################################################
EXPORT_DIR=/path-to-hdfs/project_name/HIVE_DB_DUMP/
HiveTables=$(hive -e "use your_database_name;show tables;" 2>/dev/null | egrep -v "WARN|^$|^Logging|^OK|^Time\ taken")
hdfs dfs -mkdir -p /path-to-hdfs/project_name/HIVE_DB_DUMP/ 2>/dev/null
for Table in $HiveTables
do
hive -e "EXPORT TABLE your_database_name.$Table TO '/path-to-hdfs/project_name/HIVE_DB_DUMP/your_database_name.$Table';"
done
... View more