CREATE EXTERNAL TABLE access_log ( `ip` STRING, `time_local` STRING, `method` STRING, `uri` STRING, `protocol` STRING, `status` STRING, `bytes_sent` STRING, `referer` STRING, `useragent` STRING ) ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.RegexSerDe' WITH SERDEPROPERTIES ( 'input.regex'='^(\\S+) \\S+ \\S+ \\[([^\\[]+)\\] "(\\w+) (\\S+) (\\S+)" (\\d+) (\\d+) "([^"]+)" "([^"]+)".*')STORED AS TEXTFILELOCATION '/tmp/access_logs/';
위와 같이 apache log를 파싱해서 사용하려고 테이블을 생성하고
select useragent from access_log limit 10;
간단한 쿼리 실행했을때
Kill Command = /home/hadoop/hadoop-1.0.4/libexec/../bin/hadoop job -Dmapred.job.tracker=master:9001 -kill job_201301251520_0068Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 02013-01-31 19:39:41,663 Stage-1 map = 0%, reduce = 0%2013-01-31 19:40:13,814 Stage-1 map = 100%, reduce = 100%Ended Job = job_201301251520_0068 with errorsError during job, obtaining debugging information...Examining task ID: task_201301251520_0068_m_000002 (and more) from job job_201301251520_0068Exception in thread "Thread-20" java.lang.RuntimeException: Error while reading from task log urlat org.apache.hadoop.hive.ql.exec.errors.TaskLogProcessor.getStackTraces(TaskLogProcessor.java:240)at org.apache.hadoop.hive.ql.exec.JobDebugger.showJobFailDebugInfo(JobDebugger.java:227)at org.apache.hadoop.hive.ql.exec.JobDebugger.run(JobDebugger.java:92)at java.lang.Thread.run(Thread.java:662)Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: http://slave01:50060/tasklog?taskid=attempt_201301251520_0068_m_000000_1&start=-8193at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1459)at java.net.URL.openStream(URL.java:1010)at org.apache.hadoop.hive.ql.exec.errors.TaskLogProcessor.getStackTraces(TaskLogProcessor.java:192)... 3 moreFAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.MapRedTaskMapReduce Jobs Launched:Job 0: Map: 1 HDFS Read: 0 HDFS Write:
에러가 발생했을때
set mapred.child.java.opts = -Xmx1024m;
add jar /home/hadoop/hive/lib/hive_contrib.jar;
위와같이
메모리 늘려주고 , jar를 추가해주면 된다.
메모리 늘려주고 , jar를 추가해주면 된다.
참조 사이트
https://issues.apache.org/jira/browse/HIVE-1579
http://mail-archives.apache.org/mod_mbox/hive-user/201107.mbox/%3CCAPP5OR_2AKuu73L+1mSVOLvqUYOsZA23GPN-3pxgzMvhcFjUXw@mail.gmail.com%3E
댓글