Reputation: 302
I am creating a Map Reduce Jon using Hbase. So I am taking some input from a table in mapper job and then then I am using Reducer Job. To call the reducer Job I am using this function.
TableMapReduceUtil.initTableReducerJob(table, reducer, job);
Here table is of Type String. My problem is that I need to use the table with namespace here and I do not know how to do that.
In case of mapper Job. Api is providing the function for NameSpace i.e.
TableMapReduceUtil.initTableMapperJob(table, scan, mapper, outputKeyClass, outputValueClass, job);
Here table is of Type org.apache.hadoop.hbase.TableName.
So can anyone tell me how to do that in reducer job as well?
Upvotes: 0
Views: 593
Reputation: 1882
I guss your want to use a mapreduce job to read your hbase table and write some data to hdfs ? if so look here
void org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.initTableMapperJob
(String table, Scan scan, Class<? extends TableMapper> mapper,
Class<?> outputKeyClass,
Class<?> outputValueClass, Job job, boolean addDependencyJars) throws IOException
this method could add your job (org.apache.hadoop.mapreduce.Job;
) in the setting .
job.setJarByClass(MapReduceReaderHbaseDriver.class);
job.setReducerClass(WordCountHBaseReducer.class);
FileOutputFormat.setOutputPath(job, new Path("hdfspath"));
use those methods could make the reducer get connected to hdfs
BTW translate from one hbase table to another hbase table you can use import or export command
for example
(1)old cluster:./hbase org.apache.hadoop.hbase.mapreduce.Export test hdfs://new cluster ip:9000/dic/test
(2)new cluster:./hbase org.apache.hadoop.hbase.mapreduce.Import test hdfs://new cluster ip:9000/dic/test
Upvotes: 0
Reputation: 302
So, I just need to provide the table name as
namespace:tablename
and it will handle it internally.
Upvotes: 1