Commit c23aa6f9 c23aa6f9d4e8949d6532dc6c7c21293c6dd2aedf by zhanghao

commit

1 parent a8b5846a
1 #!/bin/bash
2 time=log-$(date -d "1 hour ago" +%Y-%m-%d.%H).log
3
4 scp -P 61702 -r test@172.17.19.238:/home/data/logs/logstash/litetuo/asst-gateway/$time ../
5
6 hadoop fs -rm /input/data/$time
7 hadoop fs -put ../$time /input/data/$time
8 hadoop jar ./target/BrBigDataTest-1.0.0.jar com.bigdata.test.ETLApp /input/data/$time /input/etl/
9 sleep 3
10
11 hive -f ./shell/load_data.hql
12 hive -f ./shell/biz_data_count.hql
13
14 hadoop fs -rm /input/data/$time
15 rm ../$time
16
17 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'
18 sleep 3
19 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'
1 use testdb;
2 drop table ${hivevar:name};
3 create table ${hivevar:name} as select * from qa_log;
...\ No newline at end of file ...\ No newline at end of file
1 use testdb; 1 use testdb;
2 LOAD DATA INPATH 'hdfs://localhost:8020/input/etl' OVERWRITE INTO TABLE qa_log; 2 truncate table qa_log;
3 truncate table biz_data_count; 3 truncate table biz_data_count;
4 truncate table biz_data_response;
...\ No newline at end of file ...\ No newline at end of file
4 truncate table biz_data_response;
5 LOAD DATA INPATH 'hdfs://localhost:8020/input/etl' OVERWRITE INTO TABLE qa_log;
...\ No newline at end of file ...\ No newline at end of file
......
1 use testdb;
2 select count(1) from qa_log where requestUri like concat('%','gateway.do','%');
3 select count(1) from qa_log where requestUri like concat('%','gateway.do','%') and (status like '200' and code like '0');
4 select count(1) from qa_log where requestUri like concat('%','gateway.do','%') and (status not like '200' or code not like '0');
...\ No newline at end of file ...\ No newline at end of file