forked from D-Net/dnet-hadoop
finished migration to hive only
This commit is contained in:
parent
12749a0a77
commit
d05210ba99
|
@ -10,8 +10,11 @@ export SOURCE=$1
|
||||||
export SHADOW=$2
|
export SHADOW=$2
|
||||||
|
|
||||||
echo "Updating shadow database"
|
echo "Updating shadow database"
|
||||||
hive --database ${SOURCE} -e "show tables" | grep -v WARN | sed "s/^\(.*\)/analyze table ${SOURCE}.\1 compute statistics;/" | impala-shell -c -f -
|
hive --database ${SOURCE} -e "show tables" | grep -v WARN | sed "s/^\(.*\)/analyze table ${SOURCE}.\1 compute statistics;/" > foo
|
||||||
impala-shell -q "create database if not exists ${SHADOW}"
|
hive -f foo
|
||||||
impala-shell -d ${SHADOW} -q "show tables" --delimited | sed "s/^/drop view if exists ${SHADOW}./" | sed "s/$/;/" | impala-shell -c -f -
|
hive -e "create database if not exists ${SHADOW}"
|
||||||
impala-shell -d ${SOURCE} -q "show tables" --delimited | sed "s/\(.*\)/create view ${SHADOW}.\1 as select * from ${SOURCE}.\1;/" | impala-shell -c -f -
|
hive --database ${SHADOW} -e "show tables" | grep -v WARN | sed "s/^/drop view if exists ${SHADOW}./" | sed "s/$/;/" > foo
|
||||||
|
hive -f foo
|
||||||
|
hive --database ${SOURCE} -e "show tables" | grep -v WARN | sed "s/\(.*\)/create view ${SHADOW}.\1 as select * from ${SOURCE}.\1;/" > foo
|
||||||
|
hive -f foo
|
||||||
echo "Shadow db ready!"
|
echo "Shadow db ready!"
|
|
@ -13,7 +13,7 @@ echo "Getting file from " $SCRIPT_PATH
|
||||||
hdfs dfs -copyToLocal $SCRIPT_PATH
|
hdfs dfs -copyToLocal $SCRIPT_PATH
|
||||||
|
|
||||||
echo "Creating indicators"
|
echo "Creating indicators"
|
||||||
impala-shell -q "invalidate metadata"
|
hive --database ${TARGET} -e "show tables" | grep -v WARN | sed "s/^\(.*\)/analyze table ${TARGET}.\1 compute statistics;/" > foo
|
||||||
impala-shell -d ${TARGET} -q "show tables" --delimited | sed "s/^\(.*\)/compute stats ${TARGET}.\1;/" | impala-shell -c -f -
|
hive -f foo
|
||||||
cat step16-createIndicatorsTables.sql | impala-shell -d $TARGET -f -
|
hive --database ${TARGET} -f step16-createIndicatorsTables.sql
|
||||||
echo "Indicators created"
|
echo "Indicators created"
|
|
@ -15,11 +15,14 @@ echo "Getting file from " $4
|
||||||
hdfs dfs -copyToLocal $4
|
hdfs dfs -copyToLocal $4
|
||||||
|
|
||||||
echo "Creating monitor database"
|
echo "Creating monitor database"
|
||||||
cat step20-createMonitorDB.sql | sed s/SOURCE/$1/g | sed s/TARGET/$2/g1 | impala-shell -f -
|
cat step20-createMonitorDB.sql | sed s/SOURCE/$1/g | sed s/TARGET/$2/g1 > foo
|
||||||
|
hive -f foo
|
||||||
echo "Impala shell finished"
|
echo "Impala shell finished"
|
||||||
|
|
||||||
echo "Updating shadow monitor database"
|
echo "Updating shadow monitor database"
|
||||||
impala-shell -q "create database if not exists ${SHADOW}"
|
hive -e "create database if not exists ${SHADOW}"
|
||||||
impala-shell -d ${SHADOW} -q "show tables" --delimited | sed "s/^/drop view if exists ${SHADOW}./" | sed "s/$/;/" | impala-shell -f -
|
hive --database ${SHADOW} -e "show tables" | grep -v WARN | sed "s/^/drop view if exists ${SHADOW}./" | sed "s/$/;/" > foo
|
||||||
impala-shell -d ${TARGET} -q "show tables" --delimited | sed "s/\(.*\)/create view ${SHADOW}.\1 as select * from ${TARGET}.\1;/" | impala-shell -f -
|
hive -f foo
|
||||||
|
hive --database ${TARGET} -e "show tables" | grep -v WARN | sed "s/\(.*\)/create view ${SHADOW}.\1 as select * from ${TARGET}.\1;/" > foo
|
||||||
|
hive -f foo
|
||||||
echo "Shadow db ready!"
|
echo "Shadow db ready!"
|
|
@ -10,12 +10,14 @@ export SOURCE=$1
|
||||||
export TARGET=$2
|
export TARGET=$2
|
||||||
export SHADOW=$3
|
export SHADOW=$3
|
||||||
|
|
||||||
impala-shell -q "invalidate metadata;"
|
hive --database ${TARGET} -e "show tables" | grep -v WARN | sed "s/\(.*\)/analyze table ${TARGET}.\1 compute statistics;/" > foo
|
||||||
impala-shell -d ${TARGET} -q "show tables" --delimited | sed "s/\(.*\)/compute stats ${TARGET}.\1;/" | impala-shell -f -
|
hive -f foo
|
||||||
echo "Impala shell finished"
|
echo "Impala shell finished"
|
||||||
|
|
||||||
echo "Updating shadow observatory database"
|
echo "Updating shadow observatory database"
|
||||||
impala-shell -q "create database if not exists ${SHADOW}"
|
hive -e "create database if not exists ${SHADOW}"
|
||||||
impala-shell -d ${SHADOW} -q "show tables" --delimited | sed "s/^/drop view if exists ${SHADOW}./" | sed "s/$/;/" | impala-shell -f -
|
hive --database ${SHADOW} -e "show tables" | grep -v WARN | sed "s/^/drop view if exists ${SHADOW}./" | sed "s/$/;/" > foo
|
||||||
impala-shell -d ${TARGET} -q "show tables" --delimited | sed "s/\(.*\)/create view ${SHADOW}.\1 as select * from ${TARGET}.\1;/" | impala-shell -f -
|
hive -f foo
|
||||||
|
hive -d ${TARGET} -e "show tables" | grep -v WARN | sed "s/\(.*\)/create view ${SHADOW}.\1 as select * from ${TARGET}.\1;/" > foo
|
||||||
|
hive -f foo
|
||||||
echo "Shadow db ready!"
|
echo "Shadow db ready!"
|
|
@ -11,6 +11,7 @@ export TARGET=$2
|
||||||
export SHADOW=$3
|
export SHADOW=$3
|
||||||
|
|
||||||
echo "Creating observatory database"
|
echo "Creating observatory database"
|
||||||
impala-shell -q "drop database if exists ${TARGET} cascade"
|
hive -e "drop database if exists ${TARGET} cascade"
|
||||||
impala-shell -q "create database if not exists ${TARGET}"
|
hive -e "create database if not exists ${TARGET}"
|
||||||
impala-shell -d ${SOURCE} -q "show tables" --delimited | grep -iv roar | sed "s/\(.*\)/create view ${TARGET}.\1 as select * from ${SOURCE}.\1;/" | impala-shell -f -
|
hive --database ${SOURCE} -e "show tables" | grep -v WARN | grep -iv roar | sed "s/\(.*\)/create view ${TARGET}.\1 as select * from ${SOURCE}.\1;/" > foo
|
||||||
|
hive -f foo
|
||||||
|
|
Loading…
Reference in New Issue