Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张浩
/
BrBigDataTest
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
a8b5846a
...
a8b5846a176e3da3ec568d35ee410861e728db3d
authored
2022-01-06 14:19:33 +0800
by
zhanghao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
commit
1 parent
863090c3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
8 deletions
run.sh
shell/biz_data_count.hql
shell/create_table.hql
shell/load_data.hql
run.sh
View file @
a8b5846
...
...
@@ -10,11 +10,11 @@ hadoop jar ./target/BrBigDataTest-1.0.0.jar com.bigdata.test.ETLApp /input/data/
sleep 3
hive -f ./shell/load_data.hql
hive -f ./shell/biz_data_count.hql
total
=
$(
hive -f ./shell/select.hql
)
result
=
$(
echo
$total
| tr
" "
","
)
,
$time
curl http://192.168.8.113:9090/tool/hadoopTotal?total
=
${
result
}
$(
hive -hivevar
name
=
$backupname
-f ./shell/back_up.hql
)
hadoop fs -rm /input/data/
$time
rm ../
$time
\ No newline at end of file
rm ../
$time
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'
...
...
shell/biz_data_count.hql
0 → 100755
View file @
a8b5846
use testdb;
INSERT INTO TABLE biz_data_count
select method,biz_data,count(1) as count,max(timestamp) as timestamp
from qa_log
where method='com.ai.handler.plan.detail.index.info'
group by method,biz_data;
INSERT INTO TABLE biz_data_response
select method,biz_data,uid,timestamp,response
from qa_log
where method='com.ai.handler.plan.detail.index.info';
\ No newline at end of file
shell/create_table.hql
View file @
a8b5846
CREATE DATABASE IF NOT EXISTS testdb;
use testdb;
CREATE
EXTERNAL
TABLE qa_log(
CREATE TABLE qa_log(
rest string,
requestUri string,
request string,
...
...
@@ -12,4 +12,19 @@ biz_data string,
code string,
trace string,
timestamp string
) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';
CREATE TABLE biz_data_count(
method string,
biz_data string,
count string,
timestamp string
) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';
CREATE TABLE biz_data_response(
method string,
biz_data string,
uid string,
timestamp string,
response string
) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';
\ No newline at end of file
...
...
shell/load_data.hql
View file @
a8b5846
use testdb;
LOAD DATA INPATH 'hdfs://localhost:8020/input/etl' OVERWRITE INTO TABLE qa_log;
\ No newline at end of file
LOAD DATA INPATH 'hdfs://localhost:8020/input/etl' OVERWRITE INTO TABLE qa_log;
truncate table biz_data_count;
truncate table biz_data_response;
\ No newline at end of file
...
...
Please
register
or
sign in
to post a comment