本文主要是介绍2013-03-07 脚本的雏形,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
将hive cli中测试通过的语句,整理成脚本的形式:
analyzefunc( ){
hive -e "create external table if not exists temp (ip STRING,identd STRING,username STRING,handledate STRING,requrl STRING,status int,returnbytes int,referer string,browser STRING) row format SERDE 'org.apache.hadoop.hive.serde2.dynamic_type.DynamicSerDe'WITH SERDEPROPERTIES ('serialization.format'='org.apache.hadoop.hive.serde2.thrift.TCTLSeparatedProtocol','quote.delim'='("|\\[|\\])','field.delim'=' ') STORED AS TEXTFILE location '/logs/apache/2013-02-25';
create table if not exists result_url(appname string,url string,ip string,count int);
insert into table result_url (select 'appcrm',requrl,mid(handledate,0,14),count(1) from temp group by requrl,mid(handledate,0,14);//ip,
insert into table result_pv (select count(1) from appcrm_temp group by mid(handledate,0,14);"
}
export2mysql( ){
sqoop export --connect jdbc:mysql://localhost/hadoopguide --username root -m 1 --table hdfsfile --export-dir output/part-r-00000 --input-fields-terminated-by '\t';
}
现在看来觉得真是太雏形了。。。
这篇关于2013-03-07 脚本的雏形的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!