CDH6 高版本hbase+solr实现二级索引
之前的环境是单独下载的CDH组件包搭建的集群,但是因为hadoop版本过低导致漏洞无法修复,重新搭建高版本集群环境。
新集群环境:

主要组件:hadoop,hbase,zookeeper,Key-Value Store Indexer
1.创建hbase表:
hbase shell
create 'users', { NAME => 'info', REPLICATION_SCOPE => '1' }
2.使用CDH创建solr集合并修改配置:
1)创建solr实体配置文件本地目录,tsolr会自动创建
# solrctl instancedir --generate /opt/tsolr
创建后会在tsolr目录下生成一个conf文件夹,里面是相关配置文件。
2)编辑conf文件夹里的managed-schema文件,hbase表中需要索引的列对应managed-schema的filed节点
例:
<field name="firstname_s" type="string" indexed="true" stored="true" required="false" multiValued="false" />
<field name="lastname_s" type="string" indexed="true" stored="true" required="false" multiValued="false" />
<field name="age_i" type="string" indexed="true" stored="true" required="true" multiValued="false" />
注意:conf中的solrConfig.xml可以设置提交方式。设置方式参考:https://blog.csdn.net/qq_40570699/article/details/100560066
3)创建collection实例并配置文件上传到zookeeper
# solrctl instancedir --create tsolr /opt/tsolr
注意:之前如果有创建过,需要先删除再创建,或者覆盖更新
(# solrctl instancedir --update tsolr /opt/tsolr)
4)上传到zookeeper之后,其他节点就可以从zookeeper下载配置文件。接着创建collection
# solrctl collection --create tsolr -s 15 -r 2 -m 50
(红色参数表示s表示设置Shard数为15,-r表示设置的replica数为2,-m表示最大shards数目,collection名称是tsolr!)
3.创建indexer模板,并且执行indexer任务:
1.编辑 vim /opt/tsolr/users.xml
<?xml version="1.0"?>
<indexer table="indexdemo-user">
<field name="firstname_s" value="info:firstname"/>
<field name="lastname_s" value="info:lastname"/>
<field name="age_i" value="info:age" type="int"/>
</indexer>
2.执行hbase-indexer
cd /opt/cloudera/parcels/CDH-6.0.0-xxxxx/bin
../hbase-indexer add-indexer -n myindexer -c demo/user_indexer.xml -cp solr.zk=flzxldyjdata1:2181,flzxldyjdata2:2181,flzxldyjdata3:2181,flzxldyjdata4:2181,flzxldyjdata5:2181/solr -cp solr.collection=collection1
CDH6 高版本hbase+solr实现二级索引的更多相关文章
- hbase基于solr配置二级索引
一.概述 Hbase适用于大表的存储,通过单一的RowKey查询虽然能快速查询,但是对于复杂查询,尤其分页.查询总数等,实现方案浪费计算资源,所以可以针对hbase数据创建二级索引(Hbase Sec ...
- HBase协处理器同步二级索引到Solr
一. 背景二. 什么是HBase的协处理器三. HBase协处理器同步数据到Solr四. 添加协处理器五. 测试六. 协处理器动态加载 一. 背景 在实际生产中,HBase往往不能满足多维度分析,我们 ...
- 通过phoenix在hbase上创建二级索引,Secondary Indexing
环境描述: 操作系统版本:CentOS release 6.5 (Final) 内核版本:2.6.32-431.el6.x86_64 phoenix版本:phoenix-4.10.0 hbase版本: ...
- Hbase(三) hbase协处理器与二级索引
一.协处理器—Coprocessor 1. 起源Hbase 作为列族数据库最经常被人诟病的特性包括:无法轻易建立“二级索引”,难以执 行求和.计数.排序等操作.比如,在旧版本的(<0.92)Hb ...
- HBase协处理器同步二级索引到Solr(续)
一. 已知的问题和不足二.解决思路三.代码3.1 读取config文件内容3.2 封装SolrServer的获取方式3.3 编写提交数据到Solr的代码3.4 拦截HBase的Put和Delete操作 ...
- HBase Region级别二级索引
我们会经常谈及二级索引,这是对全表数据进行另外一种方式的组织存储,是针对table级别的.如果要为HBase上的表实现一个强一致性的二级索引,那么就无法逃避分布式事务,而这一直是用户最期待的功能. 而 ...
- HBase 协处理器实现二级索引
HBase在0.92之后引入了coprocessors,提供了一系列的钩子,让我们能够轻易实现访问控制和二级索引的特性.下面简单介绍下两种coprocessors,第一种是Observers,它实际类 ...
- CDH使用Solr实现HBase二级索引
一.为什么要使用Solr做二级索引二.实时查询方案三.部署流程3.1 安装HBase.Solr3.2 增加HBase复制功能3.3创建相应的 SolrCloud 集合3.4 创建 Lily HBa ...
- HBase 二级索引与Join
二级索引与索引Join是Online业务系统要求存储引擎提供的基本特性.RDBMS支持得比较好,NOSQL阵营也在摸索着符合自身特点的最佳解决方案. 这篇文章会以HBase做为对象来探讨如何基于Hba ...
随机推荐
- Mybatis 使用 SQL 递归获取单表中的树结构
xml 代码 <resultMap type="xxx.xxx.xxx.xxx.实体类" id="xxxListTree"> <result ...
- 【Linux常见命令】split命令
split - split a file into pieces 按照指定的行数或大小分割文件 语法: split [OPTION]... [INPUT [PREFIX]] Output fixed- ...
- CCF NOI1039 2的n次方
问题链接:CCF NOI1039 2的n次方. 时间限制: 1000 ms 空间限制: 262144 KB 题目描述 对于任意给定的n,计算2的n次方. 输入 输入整数n. 输出 输出2的n次方的值 ...
- Math.Round和四舍五入
Math.Round方法并不是像想象中的四舍五入, 可以从下面的输出结果看出来: Math.Round(3.44, 1); //Returns 3.4. Math.Round(3.45, 1); // ...
- 数据库SQL语言从入门到精通--Part 4--SQL语言中的模式、基本表、视图
数据库从入门到精通合集(超详细,学习数据库必看) 前言: 使用SQL语言时,要注意SQL语言对大小写并不敏感,一般使用大写.所有符号一定是西文标点符号(虽然是常识,但我还是提一嘴) 1.模式的定义与删 ...
- CF思维联系– Codeforces-987C - Three displays ( 动态规划)
ACM思维题训练集合 It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in ...
- Codeforces Round #618 (Div. 2)-B. Assigning to Classes
Reminder: the median of the array [a1,a2,-,a2k+1] of odd number of elements is defined as follows: l ...
- CodeForces - 260B
A recently found Ancient Prophesy is believed to contain the exact Apocalypse date. The prophesy is ...
- redis-py中的坑
今天发现,使用redis-py从redis中获取的数据竟然是加密的. conn = redis.Redis(host='redis_serverip', port=6379, password='re ...
- C/S程序设计范式
在socket编程之并发回射服务器3篇文章中,提到了3种设计范式: 多进程 父进程阻塞于accept调用,然后为每个连接创建一个子进程. 多线程 主线程阻塞于accept调用,然后为每个连接创建一个子 ...