使用JAVA API for Hbase

时间:2016-10-08 21:33:32

标签: hbase

我使用以下代码在Hbase中创建一个表:

import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.client.HBaseAdmin;

public class MyfirstHBaseTable
{
  public static void main(String[] args) throws IOException
  {
    HBaseConfiguration hconfig = new HBaseConfiguration(new Configuration());
    HTableDescriptor htable = new HTableDescriptor("User"); 
    htable.addFamily( new HColumnDescriptor("Id"));
    htable.addFamily( new HColumnDescriptor("Name"));
    System.out.println( "Connecting..." );
    HBaseAdmin hbase_admin = new HBaseAdmin( hconfig );
    System.out.println( "Creating Table..." );
    hbase_admin.createTable( htable );
    System.out.println("Done!");
  }
}

但是出现了以下错误:

enter image description here

有人可以建议还有什么需要做的吗?

0 个答案:

没有答案