Lily hbase indexer搭建配置概要文档

1.solrcloud搭建好
2.hbase-solr-indexer服务开启
3.确定hbase中的对应的表开启replication功能

create 'noc', {NAME => 'c', COMPRESSION => 'snappy', REPLICATION_SCOPE => '1', VERSIONS => '1'} // 1表示开启replication

已经创建的表可以使用一下的命令:

disable 'noc' 
alter 'noc',{NAME => 'c', REPLICATION_SCOPE => 1} 
enable 'noc' 

以下可以参考4.solr相关配置文件模板样例 中general.sh文件
4. 生成实体配置文件,可以自己设置
 solrctl instancedir --generate $PROJECT_HOME 
5. 修改生成好的scheme.xml文件
 mv $PROJECT_HOME/conf/schema.xml $PROJECT_HOME/conf/schema.old

 cp $PROJECT_SCHEMA $PROJECT_HOME/conf/ 
6.创建collection实例并配置文件上传到zookeeper,命令
 solrctl instancedir --create $COLLECTION_NAME $PROJECT_HOME 
7.上传到zookeeper之后,其他节点就可以从zookeeper下载配置文件。接下来创建collection,命令
 solrctl collection --create $COLLECTION_NAME -s n (n小于solrcloud节点数) 
如果需要指定--solr

 solrctl --solr http://x.x.x.x:8983/solr/ collection --create $COLLECTION_NAME -s n 

8.创建Lily HBase Indexer配置文件Morphlines.conf

/etc/hbase-solr/conf下面(所有节点确认一下)
9.注册Lily HBase Indexer configuration 和 Lily Hbase Indexer Service

hbase-indexer add-indexer 
--name $INDEXER_NAME 
--indexer-conf $INDEXER_CONF 
--connection-param solr.zk=$SOLR_ZK_ENSEMBLE 
--connection-param solr.collection=$COLLECTION_NAME 
--zookeeper $ZOOKEEPER

10.验证索引器是否成功创建

hbase-indexer list-indexers
nocIndexer
+ Lifecycle state: ACTIVE
+ Incremental indexing state: SUBSCRIBE_AND_CONSUME
+ Batch indexing state: INACTIVE
+ SEP subscription ID: Indexer_nocIndexer
+ SEP subscription timestamp: 2017-03-21T20:04:52.923+08:00
+ Connection type: solr
+ Connection params:
+ solr.zk = n1.cluster:2181,n2.cluster:2181,n3.cluster:2181/solr
+ solr.collection = noc
+ Indexer config:
403 bytes, use -dump to see content
+ Indexer component factory: com.ngdata.hbaseindexer.conf.DefaultIndexerComponentFactory
+ Additional batch index CLI arguments:
(none)
+ Default additional batch index CLI arguments:
(none)
+ Processes
+ 4 running processes
+ 0 failed processes

11.测试put数据查看结果
当写入数据后,稍过几秒我们可以在相对于的solr中查询到该插入的数据,表明配置已经成功。

案列配置文档地址:

  http://files.cnblogs.com/files/husky/solr_indexer%E9%85%8D%E7%BD%AE%E6%A0%B7%E4%BE%8B.tar.gz

原文地址:https://www.cnblogs.com/husky/p/6637257.html