1,添加solr和Key-Value Store Indexer组件服务
参考网址:
https://blog.csdn.net/sxhong/article/details/79217092
http://www.niuchaoqun.com/14543825447680.html
http://www.bubuko.com/infodetail-1920802.html
https://blog.csdn.net/qq236237606/article/details/79149276
重要:
https://blog.csdn.net/u010936936/article/details/78064148
alter 'v_news_227_info',{NAME =>'cf', REPLICATION_SCOPE =>1}
solrctl instancedir --generate $HOME/hbase-indexer/v_news_227_info
<field name="HBase_Indexer_v_news_227_info_name"type="string"indexed="true"stored="true"/>
HBase_Indexer_v_news_227_info_name
solrctl instancedir --create v_news_227_info $HOME/hbase-indexer/v_news_227_info
solrctl collection --create v_news_227_info
solrctl collection --create v_news_227_info -s 7 -r 3-m 21
hbase-indexer add-indexer \
--name HBase_Indexer_v_news_227_info_name \
--indexer-conf $HOME/hbase-indexer/v_news_227_info/morphline-hbase-mapper.xml \
--connection-param solr.zk=node-1:2181,node-2:2181,node-3:2181/solr \
--connection-param solr.collection=v_news_227_info \
--zookeeper node-1:2181,node-2:2181,node-3:2181
hbase-indexer add-indexer \
--name HBase_Indexer_v_news_227_info_name \
--indexer-conf $HOME/hbase-indexer/v_news_227_info/morphline-hbase-mapper.xml \
--connection-param solr.zk=node-2:2181/solr \
--connection-param solr.collection=v_news_227_info \
--zookeeper node-2:2181
hbase-indexer delete-indexer --name 'HBase_Indexer_v_news_227_info_name'
hbase-indexer list-indexers
disable 'v_news_227_info'
alter 'v_news_227_info',{NAME =>'info1', REPLICATION_SCOPE =>1}
enable 'v_news_227_info'
solrctl instancedir --generate $HOME/hbase-indexer/newsinfo
<field name="HBase_Indexer_newsinfo" type="string" indexed="true" stored="true"/>
solrctl instancedir --create newsinfo $HOME/hbase-indexer/newsinfo
//更新操作, 更新配置文件;
solrctl instancedir --update newsinfo $HOME/hbase-indexer/newsinfo
//更新collection;
solrctl collection --reload newsinfo
如果索引已经建立,已经有了索引数据,想要修改索引,则要先删除索引数据集,清空数据集可以通过solr API来完成,也可以在命令行中完成,键入如下命令:
solrctl collection --deletedocs newsinfo
//solrctl collection --create newsinfo
//solrctl collection --create newsinfo2
solrctl collection --create newsinfo -s 7 -r 3 -m 21
<?xml version="1.0"?>
<indexer table="HBase_Indexer_newsinfo" mapper="com.ngdata.hbaseindexer.morphline.MorphlineResultToSolrMapper" read-row="never">
<param name="morphlineFile" value="morphlines.conf"/>
<param name="morphlineId" value="newsinfoMap"/>
</indexer>
HBase Indexer找不到morphlines.conf文件
/opt/cloudera/parcels/CDH/lib/hbase-solr/morphlines.conf
所有问题是morphlines.conf找不到,在/opt/cloudera/parcels/CDH/lib/hbase-solr新建一个morphlines.conf文件,
把morphline-hbase-mapper.xml的内容改一下
<paramname="morphlineFile"value="/opt/cloudera/parcels/CDH/lib/hbase-solr/morphlines.conf"></param>
hbase-indexer add-indexer \
--name news_info_indexer \
--indexer-conf $HOME/hbase-indexer/newsinfo/morphline-hbase-mapper.xml \
--connection-param solr.zk=node-2:2181/solr \
--connection-param solr.collection=newsinfo \
--zookeeper node-2:2181
Morphlines.conf
morphlines.conf
hbase-indexer delete-indexer --name 'news_info_indexer'
vi index_news_info.xml
hbase-indexer add-indexer --name newsinfotestindexer --indexer-conf $HOME/hbase-indexer/newsinfo/morphline-hbase-mapper.xml --connection-param solr.zk=node-2:2181/solr --connection-param solr.collection=newsinfo --zookeeper node-1:2181,node-2:2181,node-3:2181
**.***.***.**:8983
--morphline-file morphlines.conf
//这个是能用的,使用find / |grep morphlines.conf$命令
hadoop --config /etc/hadoop/conf jar /opt/cloudera/parcels/CDH/lib/hbase-solr/tools/hbase-indexer-mr-1.5-cdh5.11.2-job.jar --conf /etc/hbase/conf/hbase-site.xml --morphline-file /opt/cm-5.11.2/run/cloudera-scm-agent/process/1178-ks_indexer-HBASE_INDEXER/morphlines.conf --hbase-indexer-file /root/hbase-indexer/newsinfo/morphline-hbase-mapper.xml --zk-host node-2:2181/solr --collection newsinfo --reducers 0 --go-live
HBase_Indexer_newsinfo:*美团网* OR HBase_Indexer_newsinfo:*投资*
HBase_Indexer_newsdt:*
使用solr做模糊查询参考博客
https://cloud.tencent.com/developer/article/1078470
https://blog.csdn.net/yeyinglingfeng/article/details/79162544
https://www.cnblogs.com/xinfang520/p/7722363.html
分页查询:
https://blog.csdn.net/qq_20261343/article/details/50707860
https://blog.csdn.net/qq_37334135/article/details/76862508
https://www.cnblogs.com/pazsolr/p/5796920.html
https://blog.csdn.net/yelllowcong/article/details/78709435
https://blog.csdn.net/hu948162999/article/details/47727159
https://blog.csdn.net/HenryMrZ/article/details/79096848
http://www.cnblogs.com/seaspring/p/6428074.html
--------------------------------------------------------------------
详细:
http://mxdxm.iteye.com/blog/2191342
HBase_Indexer_newsinfo:*美团网* OR HBase_Indexer_newsinfo:*投资* OR
Key-Value Store Indexer中的配置
Morphlines 文件
Key-Value Store Indexer(服务范围)
SOLR_LOCATOR : {
# Name of solr collection
collection : newsinfo
# ZooKeeper ensemble
zkHost : "$ZK_HOST"
}
morphlines : [
{
id : newsinfoMap
importCommands : ["org.kitesdk.**", "com.ngdata.**"]
commands : [
{
extractHBaseCells {
mappings : [
{
inputColumn : "info1:Keywords"
outputField : "HBase_Indexer_newsinfo"
type : string
source : value
},
{
inputColumn :"info1:News_Dt"
outputField :"HBase_Indexer_newsdt"
type :string
source : value
},
{
inputColumn :"info1:Org_Name"
outputField :"HBase_Indexer_Org_Name"
type :string
source : value
}
]
}
}
{ logDebug { format : "output record: {}", args : ["@{}"] } }
]
}
]