java从HBase读取数据 1 周,3 日 Questions & Answers 6864 我是HBase新手,从表中逐行检索结果的最佳方法是什么?我想读取表中的全部数据。我的表有两个列族,分别是col1和col2
# 1 楼答案 使用Hbase的扫描api,可以指定起始行和结束行,并可以从表中检索数据 下面是一个例子: http://eternaltechnology.blogspot.in/2013/05/hbase-scanner-example-scanning.html
# 3 楼答案 我在找这样的东西 地图功能 public void map(ImmutableBytesWritable row, Result value, Context context) throws InterruptedException, IOException { String x1 = new String(value.getValue(Bytes.toBytes("ColumnFamily"), Bytes.toBytes("X1"))); String x2 = new String(value.getValue(Bytes.toBytes("ColumnFamily"), Bytes.toBytes("X2"))); } 驱动程序文件: Configuration config2 = new Configuration(); Job job2 = new Job(config1, "kmeans2"); //Configuration for job2 job2.setJarByClass(Converge.class); job2.setMapperClass(Converge.Map.class); job2.setReducerClass(Converge.Reduce.class); job2.setInputFormatClass(TableInputFormat.class); job2.setOutputFormatClass(NullOutputFormat.class); job2.setOutputKeyClass(Text.class); job2.setOutputValueClass(Text.class); job2.getConfiguration().set(TableInputFormat.INPUT_TABLE, "tablename");
# 4 楼答案 我认为您需要的是:通过HBase shell和Java API:http://cook.coredump.me/post/19672191046/hbase-client-example 不过,您应该了解hbase外壳的“扫描”速度非常慢(未缓存)。但它仅用于调试目的 另一个有用的信息是:http://hbase.apache.org/book/perf.reading.html 本章关于阅读HBase的内容是正确的,但却有点难以理解,因为它假定读者对HBase有一定程度的熟悉,并包含更高级的建议。我会从一开始就向你推荐这本指南
# 1 楼答案
使用Hbase的扫描api,可以指定起始行和结束行,并可以从表中检索数据
下面是一个例子:
http://eternaltechnology.blogspot.in/2013/05/hbase-scanner-example-scanning.html
# 2 楼答案
在Hbase shell中,您可以使用scan命令列出表中的数据,或使用get检索记录。参考here
# 3 楼答案
我在找这样的东西
地图功能
驱动程序文件:
# 4 楼答案
我认为您需要的是:通过HBase shell和Java API:http://cook.coredump.me/post/19672191046/hbase-client-example
不过,您应该了解hbase外壳的“扫描”速度非常慢(未缓存)。但它仅用于调试目的
另一个有用的信息是:http://hbase.apache.org/book/perf.reading.html 本章关于阅读HBase的内容是正确的,但却有点难以理解,因为它假定读者对HBase有一定程度的熟悉,并包含更高级的建议。我会从一开始就向你推荐这本指南