Commit af8f0e61 af8f0e613b128f305bf66c136171b5b97ffa6e26 by zhanghao

commit

1 parent 6953c72d
1 #!/bin/bash
2 hadoop fs -rm /input/debug/data/app.out
3 hadoop fs -put /home/test/logs/app.out /input/debug/data/app.out
4 hadoop jar ./target/BrBigDataTest-1.0.0.jar com.bigdata.test.ETLApp /input/debug/data/app.out /input/debug/etl/
5 sleep 3
6
7 hive -f ./shell_debug/load_data.hql
8 hive -f ./shell_debug/method_count.hql
9 hive -f ./shell_debug/biz_data_count.hql
10 hive -f ./shell_debug/biz_data_response.hql
11
12 hadoop fs -rm /input/debug/data/app.out
13
14 sqoop export --connect "jdbc:mysql://127.0.0.1:3306/bigdata" --username root --password zidonghua --table method_count_debug --export-dir /user/hive/warehouse/testdb.db/method_count_debug --input-fields-terminated-by '\t'
15 sleep 3
16 sqoop export --connect "jdbc:mysql://127.0.0.1:3306/bigdata" --username root --password zidonghua --table biz_data_count_debug --export-dir /user/hive/warehouse/testdb.db/biz_data_count_debug --input-fields-terminated-by '\t'
17 sleep 3
18 sqoop export --connect "jdbc:mysql://127.0.0.1:3306/bigdata" --username root --password zidonghua --table biz_data_response_debug --export-dir /user/hive/warehouse/testdb.db/biz_data_response_debug --input-fields-terminated-by '\t'
1 use testdb;
2
3 INSERT OVERWRITE TABLE biz_data_count_debug
4 select method,biz_data,count(1) as count,max(timestamp) as timestamp
5 from qa_log_debug
6 where method is not null and method!='N/A'
7 group by method,biz_data;
...\ No newline at end of file ...\ No newline at end of file
1 use testdb;
2
3 INSERT OVERWRITE TABLE biz_data_response_debug
4 select method,biz_data,uid,timestamp,response
5 from qa_log_debug
6 where method is not null and method!='N/A';
...\ No newline at end of file ...\ No newline at end of file
1 CREATE DATABASE IF NOT EXISTS testdb;
2
3 use testdb;
4
5 CREATE TABLE qa_log_debug(
6 rest string,
7 requestUri string,
8 request string,
9 response string,
10 status string,
11 method string,
12 uid string,
13 biz_data string,
14 code string,
15 trace string,
16 timestamp string
17 ) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';
18
19 CREATE TABLE method_count_debug(
20 method string,
21 count string,
22 timestamp string
23 ) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';
24
25 CREATE TABLE biz_data_count_debug(
26 method string,
27 biz_data string,
28 count string,
29 timestamp string
30 ) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';
31
32 CREATE TABLE biz_data_response_debug(
33 method string,
34 biz_data string,
35 uid string,
36 timestamp string,
37 response string
38 ) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';
...\ No newline at end of file ...\ No newline at end of file
1 use testdb;
2
3 LOAD DATA INPATH 'hdfs://localhost:8020/input/debug/etl' OVERWRITE INTO TABLE qa_log_debug;
...\ No newline at end of file ...\ No newline at end of file
1 use testdb;
2
3 INSERT OVERWRITE TABLE method_count_debug
4 select method,count(1) as count,max(timestamp) as timestamp
5 from qa_log_debug
6 where method is not null and method!='N/A'
7 group by method;
...\ No newline at end of file ...\ No newline at end of file
1 use testdb;
2
3 select method from qa_log_debug
4 where method is not null and method!='N/A'
5 group by method;
...\ No newline at end of file ...\ No newline at end of file