A method of automatically expanding and switching search engine nodes is presented. Based on Zookeeper, multiple Solr Shards are automatically expanded and switched. When the amount of data is large, Solr Sharing is used as an extension strategy, but when one of several Shards is down, the whole service will not be available. The method of this paper is to register Shards on Zookeeper for each activity. The application maintains a list of active nodes on Zookeeper and listens for Zookeeper messages. Once a new Shard is added or a Shard is lost, the list will change accordingly. When querying Solr service, the active Shards are obtained to query according to the list, and Solr Shards is realized. Auto-expansion avoids the situation that search service can not work because a Shard is down, and also provides the function of Auto-Expansion to improve work efficiency.
【技术实现步骤摘要】
一种实现搜索引擎节点自动扩展与切换的方法
本专利技术方法属于信息
,是一种优化方法,该方法可以提高搜索服务的可靠性和扩展性。
技术介绍
Solr作为一个开源的搜索引擎框架,得到广范的应用,它对外提供服务接口以供应用程序调用。Solr的Sharding技术提供了一种解决数据量大时的分布式解决策略,通过Solr的配置文件来指定相应的Shards。但当有新的Shard加入时,需要修改配置文件并重启Solr服务才能生效;并且当有Shard宕掉时,出于保护数据完整性的目的,整个Solr无法正常工作。关于Solr的相关信息可参考其官方网站http://lucene.apache.org/solr/。而目前多数方法都是为解决数据备份与完整性的解决方案,如Replication等方法,但还没有一种方法能实现Shard的自动扩展与切换功能。
技术实现思路
该专利技术主要为解决由于Shards中的某个宕掉致使整个搜索服务无法正常工作以及Solr无法自动识别新加入Shard的问题。本方法主要有以下几个步骤:a)注册节点。修改Solr服务,使Solr服务在启动时自动将自身地址注册为Zookeeper节点。b)监听Zookeeper。修改应用程序,在启动时开始监听Zookeeper消息,获取在Zookeeper中注册的Shards节点。c)维护Shards列表。监听程序维护一个活动的Shards列表,在收到Zookeeper节点变动的消息时,重新生成Shards列表。d)生成请求地址。修改应用程序,在查询时要据Shards列表生成所请求的Solr服务地址。在实际应用中,有应用服务 ...
【技术保护点】
1.一种实现搜索引擎节点自动扩展与切换的方法,其特征在于:对每一个搜索引擎节点Shards都在Zookeeper上注册,应用程序维护一个Zookeeper上活动节点的列表并监听Zookeeper的消息,一旦有新的Shard加入或者有Shard宕掉,该列表会相应变化,在查询请求Solr服务时根据该列表,获取活动的Shards进行查询,实现了Solr Shards的自动扩展,避免了因为某一个Shard宕掉致使搜索服务无法工作的情况。
【技术特征摘要】
1.一种实现搜索引擎节点自动扩展与切换的方法,其特征在于:对每一个搜索引擎节点Shards都在Zookeeper上注册,应用程序维护一个Zookeeper上活动节点的列表并监听Zookeeper的消息,一旦有新的Shard加入或者有Shard宕掉,该列表会相应变化,在查询请求Solr服务时根据该列表,获取活动的...
【专利技术属性】
技术研发人员:不公告发明人,
申请(专利权)人:南京白牙智能科技有限公司,
类型:发明
国别省市:江苏,32
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。