public class SaveToHBase {
public static int userNumber = 0;
public static String tableName = "UserData";
public static String columnFamily = "userinfo";
public static Configuration cfg = HBaseConfiguration.create();
public static class Map extends Mapper<LongWritable, Text, Text, Text>{
public void map(LongWritable key,Text value,Context context) throws IOException, InterruptedException{
context.write(new Text("user"+userNumber), value);
userNumber++;
}
}
public static class Reduce extends Reducer<Text, Text, Text, Text>{
public void reduce(Text key,Text value,Context context) throws IOException, InterruptedException{
String[] data = value.toString().trim().split("#");
SaveToHBase.put(tableName, key.toString(), columnFamily, "id", data[0]);
SaveToHBase.put(tableName, key.toString(), columnFamily, "password", data[1]);
SaveToHBase.put(tableName, key.toString(), columnFamily, "email", data[2]);
context.write(key,value);
}
}
public static void put(String tableName,String row,String columnFamily,String column,String data) throws IOException{
HTable table = new HTable(cfg, tableName);
Put put = new Put(Bytes.toBytes(row));
put.add(Bytes.toBytes(columnFamily),Bytes.toBytes(column),Bytes.toBytes(data));
table.put(put);
}
public static void create(String tableName, String columnFamily) throws Exception{
HBaseAdmin admin = new HBaseAdmin(cfg);
HTableDescriptor tableDescriptor = new HTableDescriptor(tableName);
tableDescriptor.addFamily(new HColumnDescriptor(columnFamily));
admin.createTable(tableDescriptor);
}
Exception in thread "main" java.lang.RuntimeException: org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to find region for blog_dest,,99999999999999 after 14 tries.
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to find region for tmp_order_not_closed,,99999999999999 after 10 tries.
主要原因是在client的机器这边,没有配置hbase集群的主机信息。简单的方法就是在/etc/hosts文件增加全部的节点IP信息,第二种就是使用DNS的方式。
Exception in thread "main" java.lang.RuntimeException: org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to find region for blog_dest,,99999999999999 after 14 tries.
请问有大神知道怎么回事儿吗
#5
FileOutputFormat.setOutputPath(job, new Path(args[1]))
Exception in thread "main" java.lang.RuntimeException: org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to find region for blog_dest,,99999999999999 after 14 tries.
Exception in thread "main" java.lang.RuntimeException: org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to find region for blog_dest,,99999999999999 after 14 tries.
请问有大神知道怎么回事儿吗
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to find region for tmp_order_not_closed,,99999999999999 after 10 tries.
主要原因是在client的机器这边,没有配置hbase集群的主机信息。简单的方法就是在/etc/hosts文件增加全部的节点IP信息,第二种就是使用DNS的方式。
#7
FileOutputFormat.setOutputPath(job, new Path(args[1]))
Exception in thread "main" java.lang.RuntimeException: org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to find region for blog_dest,,99999999999999 after 14 tries.
请问有大神知道怎么回事儿吗
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to find region for tmp_order_not_closed,,99999999999999 after 10 tries.
主要原因是在client的机器这边,没有配置hbase集群的主机信息。简单的方法就是在/etc/hosts文件增加全部的节点IP信息,第二种就是使用DNS的方式。