run_linux.sh
1.46 KB
#!/bin/bash
time=log-$(date -d "1 hour ago" +%Y-%m-%d.%H).log
scp -P 61702 -r test@172.17.19.238:/home/data/logs/logstash/litetuo/asst-gateway/$time ../
hadoop fs -rm /input/data/$time
hadoop fs -put ../$time /input/data/$time
hadoop jar ./target/BrBigDataTest-1.0.0.jar com.bigdata.test.ETLApp /input/data/$time /input/etl/
sleep 3
hive -f ./shell/load_data.hql
hive -f ./shell/method_count.hql
hive -f ./shell/biz_data_count.hql
hive -f ./shell/biz_data_response.hql
hive -f ./shell/tc_response.hql
hadoop fs -rm /input/data/$time
rm ../$time
sqoop export --connect "jdbc:mysql://127.0.0.1:3306/bigdata" --username root --password zidonghua --table method_count --export-dir /user/hive/warehouse/testdb.db/method_count --input-fields-terminated-by '\t'
sleep 3
sqoop export --connect "jdbc:mysql://127.0.0.1:3306/bigdata" --username root --password zidonghua --table biz_data_count --export-dir /user/hive/warehouse/testdb.db/biz_data_count --input-fields-terminated-by '\t'
sleep 3
sqoop export --connect "jdbc:mysql://127.0.0.1:3306/bigdata" --username root --password zidonghua --table biz_data_response --export-dir /user/hive/warehouse/testdb.db/biz_data_response --input-fields-terminated-by '\t'
sleep 3
mysql -uroot -pzidonghua -e "truncate bigdata.tc_response;"
sleep 3
sqoop export --connect "jdbc:mysql://127.0.0.1:3306/bigdata" --username root --password zidonghua --table tc_response --export-dir /user/hive/warehouse/testdb.db/tc_response --input-fields-terminated-by '\t'