Commit a8b5846a a8b5846a176e3da3ec568d35ee410861e728db3d by zhanghao

commit

1 parent 863090c3
...@@ -10,11 +10,11 @@ hadoop jar ./target/BrBigDataTest-1.0.0.jar com.bigdata.test.ETLApp /input/data/ ...@@ -10,11 +10,11 @@ hadoop jar ./target/BrBigDataTest-1.0.0.jar com.bigdata.test.ETLApp /input/data/
10 sleep 3 10 sleep 3
11 11
12 hive -f ./shell/load_data.hql 12 hive -f ./shell/load_data.hql
13 hive -f ./shell/biz_data_count.hql
13 14
14 total=$(hive -f ./shell/select.hql)
15 result=$(echo $total | tr " " ","),$time
16 curl http://192.168.8.113:9090/tool/hadoopTotal?total=${result}
17
18 $(hive -hivevar name=$backupname -f ./shell/back_up.hql)
19 hadoop fs -rm /input/data/$time 15 hadoop fs -rm /input/data/$time
20 rm ../$time
...\ No newline at end of file ...\ No newline at end of file
16 rm ../$time
17
18 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'
19 sleep 3
20 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
3 INSERT INTO TABLE biz_data_count
4 select method,biz_data,count(1) as count,max(timestamp) as timestamp
5 from qa_log
6 where method='com.ai.handler.plan.detail.index.info'
7 group by method,biz_data;
8
9 INSERT INTO TABLE biz_data_response
10 select method,biz_data,uid,timestamp,response
11 from qa_log
12 where method='com.ai.handler.plan.detail.index.info';
...\ No newline at end of file ...\ No newline at end of file
1 CREATE DATABASE IF NOT EXISTS testdb; 1 CREATE DATABASE IF NOT EXISTS testdb;
2 use testdb; 2 use testdb;
3 CREATE EXTERNAL TABLE qa_log( 3 CREATE TABLE qa_log(
4 rest string, 4 rest string,
5 requestUri string, 5 requestUri string,
6 request string, 6 request string,
...@@ -12,4 +12,19 @@ biz_data string, ...@@ -12,4 +12,19 @@ biz_data string,
12 code string, 12 code string,
13 trace string, 13 trace string,
14 timestamp string 14 timestamp string
15 ) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';
16
17 CREATE TABLE biz_data_count(
18 method string,
19 biz_data string,
20 count string,
21 timestamp string
22 ) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';
23
24 CREATE TABLE biz_data_response(
25 method string,
26 biz_data string,
27 uid string,
28 timestamp string,
29 response string
15 ) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'; 30 ) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';
...\ 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;
...\ No newline at end of file ...\ No newline at end of file
2 LOAD DATA INPATH 'hdfs://localhost:8020/input/etl' OVERWRITE INTO TABLE qa_log;
3 truncate table biz_data_count;
4 truncate table biz_data_response;
...\ No newline at end of file ...\ No newline at end of file
......