2013-04-05 1 views
0

최근에 hadoop 1.1.2를 학습하기 시작했습니다.hadoop jar 명령 클래스 이름은 대소 문자를 구분합니까?

WordCount 케이스를 실행하기 시작하면 두 종류의 코드가 모두 정상입니다.

명령 A :

hadoop jar /usr/local/hadoop/hadoop-examples-1.1.2.jar WordCount input output 

명령 B는 :

hadoop jar /usr/local/hadoop/hadoop-examples-1.1.2.jar wordcount input output 

유일한 차이점은 메인 클래스 이름 wordcount이다.

제 질문은 날씨 기본 클래스 이름입니다. wordcount 기본적으로 대/소문자를 구분하지 않습니까?

업데이트 :

@Amar는 WordCount 잘 작동하지 않습니다와 나는 그가 옳은 것을 확인했다고 말했습니다. 나는 here 문서로 오도되었다. 공식 문서를 업데이트해야합니다.

그러나 나는 왜 이것이 wordcount이어야하는지 알지 못합니다.

답변

3

처럼 wordcount없이 실행 해 다음과 같이 당신은 무언가를 받게됩니다 hadoop jar /usr/local/hadoop/hadoop-examples-1.1.2.jar input output

:

Unknown program 'input' chosen. 
Valid program names are: 
    aggregatewordcount: An Aggregate based map/reduce program that counts the words in the input files. 
    aggregatewordhist: An Aggregate based map/reduce program that computes the histogram of the words in the input files. 
    dbcount: An example job that count the pageview counts from a database. 
    grep: A map/reduce program that counts the matches of a regex in the input. 
    join: A job that effects a join over sorted, equally partitioned datasets 
    multifilewc: A job that counts words from several files. 
    pentomino: A map/reduce tile laying program to find solutions to pentomino problems. 
    pi: A map/reduce program that estimates Pi using monte-carlo method. 
    randomtextwriter: A map/reduce program that writes 10GB of random textual data per node. 
    randomwriter: A map/reduce program that writes 10GB of random data per node. 
    secondarysort: An example defining a secondary sort to the reduce. 
    sleep: A job that sleeps at each map and reduce task. 
    sort: A map/reduce program that sorts the data written by the random writer. 
    sudoku: A sudoku solver. 
    teragen: Generate data for the terasort 
    terasort: Run the terasort 
    teravalidate: Checking results of terasort 
    wordcount: A map/reduce program that counts the words in the input files. 

을 그래서 기본적으로 는 메인 클래스 이름하지 않는 첫 번째 인수를, 오히려 그것은이다 실행할 예제 프로그램의 이름.

그래서 심지어는 WordCount을 받아들이지 않아야합니다. 그것은 나를위한 것이 아닙니다. 당신의 내용

bin/hadoop jar hadoop-examples-1.0.4.jar WordCount LICENSE.txt output


: 메인 클래스가 이미 항아리에 포함 된 META-INF/MANIFEST.MF 파일에 정의되어 있습니다 : Main-Class: org/apache/hadoop/examples/ExampleDriver

+0

문서 [here] (http://hadoop.apache.org/docs/r1.1.2/commands_manual.html#jar)는 사용법이 'usage : hadoop jar [mainClass] args ...'라고 말합니다. 그래서' 단어 수는'mainClass'이어야합니다. 다시 확인해 보니'WordCount'가 제대로 작동하지 않습니다. 그러나 [here] 문서 (http://hadoop.apache.org/docs/r1.1.2/mapred_tutorial.html#Usage)가 나를 오도합니다. – Huo

+0

위의 답변에 정확히 무엇을 이해하지 못 했습니까? – Amar

+0

jar 매니페스트 안에 지정하지 않은 경우에만 주 클래스를 지정해야합니다. 문서의 대괄호는 선택 사항임을 나타냅니다. 그리고 이것은 다른 항아리입니다! 이 경우이 jar가 예상하는 첫 번째 인수는 예제 프로그램의 이름입니다 (예 : treasort, wordcount 등). 단순한. – Amar

0

케이싱에 따라 병에서 WordCount 또는 wordcount 클래스를로드하려고하므로 대소 문자를 구분합니다. Java는이 점에서 대소 문자를 구분하므로 hadoop jar도 마찬가지입니다.

+0

위의 그림과 같이 다음 명령은 동일한 결과를 가지고 hadoop-examples-1.1.2.jar 파일의 압축을 풀고'wordcount' 클래스를 소문자로 찾지 않습니다. – Huo

+0

그리고 아마 그렇게해서는 안됩니다. WordCount.java라는 파일에 WordCount라는 클래스가있을 것입니다. – sidoh

+0

그래서 클래스 이름은'wordcount'가 아니라'WordCount'입니다. '명령 B'는 어떻게 잘 동작합니까? – Huo

관련 문제