今天遇见一个问题,就是CDH创建hbase-indexer add-indexer的问题。
前提摘要:之前创建成功过Lily实时,后来某些原因hbase-indexer服务组件被删了,导致出现这种问题
解决方案:
先检查自己创建实时索引语句
给HBase表开启复制功能
# 为索引器监控HBase表变化提供支持
# 参数1:$1--> tableName;
# 参数2:$2--> columnsFamilyName
hbase shell <<EOF
alter_async HDR_OUT_VISIT, {NAME => 'cf',REPLICATION_SCOPE => '1'}
EOF
创建索引器
# collectionName $1; 项目路径 $2; ZK_HOST $3
//开启实时同步
hbase-indexer server --zookeeper ip:2181,ip:2181,ip:2181
6.1、添加索引器
hbase-indexer add-indexer --name HDR_OUT_VISIT --indexer-conf /usr/local/freeSearch/hbase_indexer_files/HDR_OUT_VISIT.xml --connection-param solr.zk=ip:2181,ip:2181,ip:2181/solr --connection-param solr.collection=HDR_OUT_VISIT --zookeeper ip:2181,ip:2181,ip:2181
查看实时索引器
hbase-indexer list-indexers -dump --zookeeper ip:2181,ip:2181,ip:2181
删除实时索引
hbase-indexer delete-indexer -n HDR_OUT_VISIT --zookeeper ip:2181,ip:2181,ip:2181
发现没有错之后:
这很可能是你已经对该hbase中的表已经设置过了indexer,然后,你又选择进行配置新的indexer,但之前配置的indexer和hbase中的连接信息并没有清理掉。
这种情况下(使用的zookeeper进行协调同步):
1.关闭hbase-solr-indexer服务
2.关闭solr-server服务
3.关闭hbase集群
4.清理zookeeper上和solr有关(/solr),和indexer有关(/ngdata),和hbase有关(/hbase)
5.重新启动hbase集群,solrcloud,hbase-solr-indexer服务。
6.如果可以清理hdfs上为solr创建的目录下面的与indexer配置相关的文件
7.移除之前配置的solr collection / instancedir 相关配置文件
8.重新开始配置Lily hbase indexer。
本人测试过,再从新用以上命令创建索引之后没问题!