Cloudera Manager 4.0 Пример Wordcount
Я установил Cloudera Manager, и к главному узлу подключены 2 узла. Я пытаюсь запустить программу wordcount с помощью учебника, предоставленного cloudera по этой ссылке: https://ccp.cloudera.com/display/SUPPORT/Hadoop+Tutorial
Cloudera говорит, что нужно скомпилировать файл WordCount.java, который я создал с помощью nano в командной строке. и я создал каталог Wordcount_Classes и поместил туда файл wordcount.java. Я не знаю, должен ли этот каталог быть перемещен в какое-то место в одном из каталогов cloudera для работы Java-кода? Или если я делаю что-то еще не так. Я установил Cloudera Manager, и он автоматически установил ClouderaHadoop на все узлы. Я получаю это на моем терминале:
mark@*****:~/wordcount_classes$ javac WordCount.java
WordCount.java:6: package org.apache.hadoop.fs does not exist
import org.apache.hadoop.fs.Path;
^
WordCount.java:7: package org.apache.hadoop.conf does not exist
import org.apache.hadoop.conf.*;
^
WordCount.java:8: package org.apache.hadoop.io does not exist
import org.apache.hadoop.io.*;
^
WordCount.java:9: package org.apache.hadoop.mapred does not exist
import org.apache.hadoop.mapred.*;
^
WordCount.java:10: package org.apache.hadoop.util does not exist
import org.apache.hadoop.util.*;
^
WordCount.java:14: cannot find symbol
symbol : class MapReduceBase
location: class org.myorg.WordCount
public static class Map extends MapReduceBase implements Mapper<LongWritable, Text, Text, IntWritable> {
^
WordCount.java:14: cannot find symbol
symbol : class Mapper
location: class org.myorg.WordCount
public static class Map extends MapReduceBase implements Mapper<LongWritable, Text, Text, IntWritable> {
^
WordCount.java:14: cannot find symbol
symbol : class LongWritable
location: class org.myorg.WordCount
public static class Map extends MapReduceBase implements Mapper<LongWritable, Text, Text, IntWritable> {
^
WordCount.java:14: cannot find symbol
symbol : class Text
location: class org.myorg.WordCount
public static class Map extends MapReduceBase implements Mapper<LongWritable, Text, Text, IntWritable> {
^
WordCount.java:14: cannot find symbol
symbol : class Text
location: class org.myorg.WordCount
public static class Map extends MapReduceBase implements Mapper<LongWritable, Text, Text, IntWritable> {
^
WordCount.java:14: cannot find symbol
symbol : class IntWritable
location: class org.myorg.WordCount
public static class Map extends MapReduceBase implements Mapper<LongWritable, Text, Text, IntWritable> {
^
WordCount.java:14: interface expected here
public static class Map extends MapReduceBase implements Mapper<LongWritable, Text, Text, IntWritable> {
^
WordCount.java:15: cannot find symbol
symbol : class IntWritable
location: class org.myorg.WordCount.Map
private final static IntWritable one = new IntWritable(1);
^
WordCount.java:16: cannot find symbol
symbol : class Text
location: class org.myorg.WordCount.Map
private Text word = new Text();
^
WordCount.java:18: cannot find symbol
symbol : class LongWritable
location: class org.myorg.WordCount.Map
public void map(LongWritable key, Text value, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException {
^
WordCount.java:18: cannot find symbol
symbol : class Text
location: class org.myorg.WordCount.Map
public void map(LongWritable key, Text value, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException {
^
WordCount.java:18: cannot find symbol
symbol : class OutputCollector
location: class org.myorg.WordCount.Map
public void map(LongWritable key, Text value, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException {
^
WordCount.java:18: cannot find symbol
symbol : class Text
location: class org.myorg.WordCount.Map
public void map(LongWritable key, Text value, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException {
^
WordCount.java:18: cannot find symbol
symbol : class IntWritable
location: class org.myorg.WordCount.Map
public void map(LongWritable key, Text value, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException {
^
WordCount.java:18: cannot find symbol
symbol : class Reporter
location: class org.myorg.WordCount.Map
public void map(LongWritable key, Text value, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException {
^
WordCount.java:28: cannot find symbol
symbol : class MapReduceBase
location: class org.myorg.WordCount
public static class Reduce extends MapReduceBase implements Reducer<Text, IntWritable, Text, IntWritable> {
^
WordCount.java:28: cannot find symbol
symbol : class Reducer
location: class org.myorg.WordCount
public static class Reduce extends MapReduceBase implements Reducer<Text, IntWritable, Text, IntWritable> {
^
WordCount.java:28: cannot find symbol
symbol : class Text
location: class org.myorg.WordCount
public static class Reduce extends MapReduceBase implements Reducer<Text, IntWritable, Text, IntWritable> {
^
WordCount.java:28: cannot find symbol
symbol : class IntWritable
location: class org.myorg.WordCount
public static class Reduce extends MapReduceBase implements Reducer<Text, IntWritable, Text, IntWritable> {
^
WordCount.java:28: cannot find symbol
symbol : class Text
location: class org.myorg.WordCount
public static class Reduce extends MapReduceBase implements Reducer<Text, IntWritable, Text, IntWritable> {
^
WordCount.java:28: cannot find symbol
symbol : class IntWritable
location: class org.myorg.WordCount
public static class Reduce extends MapReduceBase implements Reducer<Text, IntWritable, Text, IntWritable> {
^
WordCount.java:28: interface expected here
public static class Reduce extends MapReduceBase implements Reducer<Text, IntWritable, Text, IntWritable> {
^
WordCount.java:29: cannot find symbol
symbol : class Text
location: class org.myorg.WordCount.Reduce
public void reduce(Text key, Iterator<IntWritable> values, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException {
^
WordCount.java:29: cannot find symbol
symbol : class IntWritable
location: class org.myorg.WordCount.Reduce
public void reduce(Text key, Iterator<IntWritable> values, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException {
^
WordCount.java:29: cannot find symbol
symbol : class OutputCollector
location: class org.myorg.WordCount.Reduce
public void reduce(Text key, Iterator<IntWritable> values, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException {
^
WordCount.java:29: cannot find symbol
symbol : class Text
location: class org.myorg.WordCount.Reduce
public void reduce(Text key, Iterator<IntWritable> values, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException {
^
WordCount.java:29: cannot find symbol
symbol : class IntWritable
location: class org.myorg.WordCount.Reduce
public void reduce(Text key, Iterator<IntWritable> values, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException {
^
WordCount.java:29: cannot find symbol
symbol : class Reporter
location: class org.myorg.WordCount.Reduce
public void reduce(Text key, Iterator<IntWritable> values, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException {
^
WordCount.java:15: cannot find symbol
symbol : class IntWritable
location: class org.myorg.WordCount.Map
private final static IntWritable one = new IntWritable(1);
^
WordCount.java:16: cannot find symbol
symbol : class Text
location: class org.myorg.WordCount.Map
private Text word = new Text();
^
WordCount.java:32: operator + cannot be applied to int,IntWritable.get
sum += values.next().get();
^
WordCount.java:32: inconvertible types
found : <nulltype>
required: int
sum += values.next().get();
^
WordCount.java:34: cannot find symbol
symbol : class IntWritable
location: class org.myorg.WordCount.Reduce
output.collect(key, new IntWritable(sum));
^
WordCount.java:39: cannot find symbol
symbol : class JobConf
location: class org.myorg.WordCount
JobConf conf = new JobConf(WordCount.class);
^
WordCount.java:39: cannot find symbol
symbol : class JobConf
location: class org.myorg.WordCount
JobConf conf = new JobConf(WordCount.class);
^
WordCount.java:42: cannot find symbol
symbol : class Text
location: class org.myorg.WordCount
conf.setOutputKeyClass(Text.class);
^
WordCount.java:43: cannot find symbol
symbol : class IntWritable
location: class org.myorg.WordCount
conf.setOutputValueClass(IntWritable.class);
^
WordCount.java:49: cannot find symbol
symbol : class TextInputFormat
location: class org.myorg.WordCount
conf.setInputFormat(TextInputFormat.class);
^
WordCount.java:50: cannot find symbol
symbol : class TextOutputFormat
location: class org.myorg.WordCount
conf.setOutputFormat(TextOutputFormat.class);
^
WordCount.java:52: cannot find symbol
symbol : class Path
location: class org.myorg.WordCount
FileInputFormat.setInputPaths(conf, new Path(args[0]));
^
WordCount.java:52: cannot find symbol
symbol : variable FileInputFormat
location: class org.myorg.WordCount
FileInputFormat.setInputPaths(conf, new Path(args[0]));
^
WordCount.java:53: cannot find symbol
symbol : class Path
location: class org.myorg.WordCount
FileOutputFormat.setOutputPath(conf, new Path(args[1]));
^
WordCount.java:53: cannot find symbol
symbol : variable FileOutputFormat
location: class org.myorg.WordCount
FileOutputFormat.setOutputPath(conf, new Path(args[1]));
^
WordCount.java:55: cannot find symbol
symbol : variable JobClient
location: class org.myorg.WordCount
JobClient.runJob(conf);
^
49 errors
Может кто-нибудь помочь мне запустить программу wordcount или подсказать, что мне делать, или если кто-то знает хороший онлайн-учебник, который мне не удалось найти? Спасибо!
1 ответ
Вам нужны зависимости (соответствующие вашим операторам импорта) от вашего javac
Классный путь
С Hadoop это проще сделать через hadoop classpath
полезность:
$ javac -classpath `hadoop classpath`:. WordCount.java
У вас не должно быть проблем с компиляцией cannot find symbol
вид после того, как ваш classpath установлен правильно.