2013-03-07 脚本的雏形

来源:互联网 发布:蓝牙模块发送不了数据 编辑:程序博客网 时间:2024/06/01 08:09

     将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';
}

现在看来觉得真是太雏形了。。。


原创粉丝点击