如何将减少的输出加载到HBase中?

如何将减少的输出加载到HBase中?,hbase,Hbase,使用MapReduce教程的WordCount示例,我正在更改代码以将reduce()输出加载到HBase表中。请任何人建议WordCount示例代码中的更改。这对我会有很大帮助。谢谢。由于您使用的是旧的API,因此可以使用以下代码编写减速机。您需要实现org.apache.hadoop.hbase.mapred.TableReduce: 你的密码打错了。它是initTableReduceJob而不是initTableReducerJob。这里的“字数”是HBase表名。您需要在运行应用程序之前

使用MapReduce教程的WordCount示例,我正在更改代码以将reduce()输出加载到HBase表中。请任何人建议WordCount示例代码中的更改。这对我会有很大帮助。谢谢。

由于您使用的是旧的API,因此可以使用以下代码编写减速机。您需要实现
org.apache.hadoop.hbase.mapred.TableReduce


你的密码打错了。它是
initTableReduceJob
而不是
initTableReducerJob
。这里的“字数”是HBase表名。您需要在运行应用程序之前创建表。

您可以使用以下代码来编写减速机,因为您使用的是旧的API。您需要实现
org.apache.hadoop.hbase.mapred.TableReduce


你的密码打错了。它是
initTableReduceJob
而不是
initTableReducerJob
。这里的“字数”是HBase表名。您需要在运行应用程序之前创建表。

虽然您不需要自己创建HBaseConfiguration,但我建议您创建一个表以确保配置正确<代码>配置配置=HBaseConfiguration.create();JobConf conf=newjobconf(config,WordCountHBase.class)虽然您不需要自己创建HBaseConfiguration,但我建议您创建一个以确保配置正确<代码>配置配置=HBaseConfiguration.create();JobConf conf=newjobconf(config,WordCountHBase.class)请停止回滚编辑。您正在进行如此剧烈的更改,以至于您的问题不再有意义。请停止回滚编辑。你做出了如此巨大的改变,以至于你的问题不再有意义。
public static class Reduce extends MapReduceBase implements
    TableReduce<Text, IntWritable> {

public static final byte[] CF = "cf".getBytes();
public static final byte[] COUNT = "count".getBytes();

@Override
public void reduce(Text key, Iterator<IntWritable> values,
        OutputCollector<ImmutableBytesWritable, Put> output,
        Reporter reporter) throws IOException {
    int i = 0;
    while (values.hasNext()) {
        i += values.next().get();
    }
    Put put = new Put(Bytes.toBytes(key.toString()));
    put.add(CF, COUNT, Bytes.toBytes(i));
    output.collect(null, put);
}
}
TableMapReduceUtil.initTableReduceJob("wordcount", Reduce.class, conf);