分享

hbase如何创建二级索引以及创建二级索引实例

ainubis 发表于 2015-3-29 02:59:46
O(∩_∩)O谢谢分享
回复

使用道具 举报

bxy5648 发表于 2015-4-21 15:52:43
我的表的二级索引怎么连接不上呢,显示找不到我那个jar包
回复

使用道具 举报

bxy5648 发表于 2015-4-21 16:25:21
能直接用eclipse连接hbase数据库建立二级索引么
回复

使用道具 举报

dannyhe 发表于 2015-5-15 10:11:54
很好的东西分享。。。谢谢
回复

使用道具 举报

YLV 发表于 2015-6-5 09:25:11
好东西,谢谢分享
回复

使用道具 举报

jdayco 发表于 2015-8-30 09:06:53
华为的二级索引
回复

使用道具 举报

Rayn-瑞恩 发表于 2015-12-3 12:52:13
hhhhh ..不错不错。。。。。
回复

使用道具 举报

羽毛 发表于 2016-1-13 21:43:57
学习了  谢谢分享
回复

使用道具 举报

395455030 发表于 2016-1-31 16:16:41
    楼主,我用这个办法做了,当我向主表写入key=rk0003,value=b33时,索引表想要的结果是这样:
key=b33,value=rk0003
    实际是这样:
key=\x00\x00\x00\x1A\x00\x00\x00\x03\x00\x06rk0003\x04infoname\x7F\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x04b33,value=\x00\x00\x00\x1A\x00\x00\x00\x03\x00\x06rk0003\x04infoname\x7F\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x04b33
    在想要的值旁还多出了很多奇怪的字符,这是什么原因?
回复

使用道具 举报

louiscool2 发表于 2016-2-1 18:15:55
我按照这个做法,为啥put数据后,索引表没有自动插入数据呢?hbase日志里也提示协议处理器加载成功了,“Loaded coprocessor test.HbaseCoprocessor from HTD of test successfully.”
以下是代码,其中testi是索引表,test是数据表
create 'testi', {NAME=>'keys'}

create 'test', {NAME=>'info'}
alter 'test',METHOD=>'table_att','coprocessor'=>'hdfs:///user/dw/myhbase-0.0.1-SNAPSHOT.jar|test.HbaseCoprocessor|1001'
put 'test','row1','info:1','hello0'
public class HbaseCoprocessor extends BaseRegionObserver {

        public void prePut(final ObserverContext<RegionCoprocessorEnvironment> e,
                        final Put put, final WALEdit edit, final boolean writeToWAL)
                        throws IOException {
                // set configuration
                Configuration conf = new Configuration();
                // need conf.set...
                String colName = "1";
                HTable table = new HTable(conf, "testi");
                List<Cell> kv = put.get("info".getBytes(), "1".getBytes());
                Iterator<Cell> kvItor = kv.iterator();
                while (kvItor.hasNext()) {
                        Cell tmp = kvItor.next();      
                       Put indexPut = new Put(tmp.getValue());
                    //    Put indexPut = new Put("hello");
                        indexPut.add("keys".getBytes(), "1".getBytes(),
                                        tmp.getRow());
                        table.put(indexPut);
                }
                table.close();
        }

}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条