1 读取数据
使用HTable类中的get()方法。这种方法需要Get类的一个实例。
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.util.Bytes;
import java.io.IOException;
public class ReadTable {
public static void main(String[] args) throws IOException {
//实例化Configuration类
Configuration conf = HBaseConfiguration.create();
//实例化HTable类
HTable hTable = new HTable(conf, "People");
//实例化获得类
Get get = new Get(Bytes.toBytes("1"));
//选择获取的数据