La carte hadoop réduit le travail avec l'entrée HDFS et la sortie HBASE

Je suis nouveau sur hadoop.
J'ai un travail de MapReduce qui est censé être un apport de la Sf et écrire la sortie du réducteur de Hbase. Je n'ai pas trouvé de bon exemple.

Voici le code, l'erreur runing cet exemple est d'incompatibilité de Type de carte, prévu ImmutableBytesWritable reçu IntWritable.

Mappeur De Classe

public static class AddValueMapper extends Mapper < LongWritable,
 Text, ImmutableBytesWritable, IntWritable > {  

  /* input <key, line number : value, full line>
   *  output <key, log key : value >*/  
public void map(LongWritable key, Text value, 
     Context context)throws IOException, 
     InterruptedException {
  byte[] key;
  int value, pos = 0;
  String line = value.toString();
  String p1 , p2 = null;
  pos = line.indexOf("=");

   //Key part
   p1 = line.substring(0, pos);
   p1 = p1.trim();
   key = Bytes.toBytes(p1);   

   //Value part
   p2 = line.substring(pos +1);
   p2 = p2.trim();
   value = Integer.parseInt(p2);

   context.write(new ImmutableBytesWritable(key),new IntWritable(value));
  }
}

Réducteur De Classe

public static class AddValuesReducer extends TableReducer<
  ImmutableBytesWritable, IntWritable, ImmutableBytesWritable> {

  public void reduce(ImmutableBytesWritable key, Iterable<IntWritable> values, 
   Context context) throws IOException, InterruptedException {

         long total =0;
         //Loop values
         while(values.iterator().hasNext()){
           total += values.iterator().next().get();
         }
         //Put to HBase
         Put put = new Put(key.get());
         put.add(Bytes.toBytes("data"), Bytes.toBytes("total"),
           Bytes.toBytes(total));
         Bytes.toInt(key.get()), total));
            context.write(key, put);
        }
    }

J'ai eu un emploi similaire, seulement avec HDFS et fonctionne très bien.

Édité 18-06-2013. Le projet de collège terminé avec succès il y a deux ans. Pour la configuration d'une tâche (pilote partie) cochez la réponse correcte.

source d'informationauteur jmventar