luence有一个IndexDeletePolicy接口,这个接口是提供luence删除索引文件的两个时机,分别是init和commit,
init是在IndexWirter创建时执行的。commit是在有索引文件更新,提交是执行的。而indexDeletePolicy这两个方法都会得到一个提交点集合即(IndexCommit),IndexCommit是luence的一个抽象类,从它可以取到该提交点相关的段文件名,所有的索引文件,索引目录,索引版本,最后修改时间等,具体的方法如下:
/**
* Get the segments file (<code>segments_N</code>) associated
* with this commit point.
*/
public abstract String getSegmentsFileName();
/**
* Returns all index files referenced by this commit point.
*/
public abstract Collection<String> getFileNames() throws IOException;
/**
* Returns the {@link Directory} for the index.
*/
public abstract Directory getDirectory();
/** Returns the version for this IndexCommit. This is the
* same value that {@link IndexReader#getVersion} would
* return if it were opened on this commit. */
public abstract long getVersion();
/** Convenience method that returns the last modified time
* of the segments_N file corresponding to this index
* commit, equivalent to
* getDirectory().fileModified(getSegmentsFileName()). */
public long getTimestamp() throws IOException {
return getDirectory().fileModified(getSegmentsFileName());
}
所以通过indexCommit,Solr能知道那些文件是需要复制的。
复制索引文件
Solr复制是从机Slave不断的向主机发起轮询操作,看主机的索引文件版本是否发生变化,如果发生了变化,则从机就下载索引文件到一个临时目录,如果下载期间出现通讯故障,则会从断点出继续下载。下载完所有的文件时,把下载的文件移动到索引目录,通过ReplicationHandler发起一个commit命令,重新加载索引文件。
转载自:http://ronxin999.blog.163.com/blog/
分享到:
相关推荐
Solr.学习文档 Solr优化 Solr replication Solr sharing indexes
solr.warsolr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包...
solr
3,solr工作方式 文档通过http利用xml加到一个搜索集合中。solr查询该集合也是通过http收到一个xml/json响应来实现。他的主要特性包括:高效,灵活的缓存功能,垂直搜索功能,高亮下试搜索结果,通过索引复制来提高...
solr
Solr 依存于Lucene,因为Solr底层的核心技术是使用Lucene 来实现的,Solr和Lucene的本质区别有以下三点:搜索服务器,企业级和管理。Lucene本质上是搜索库,不是独立的应用程序,而Solr是。Lucene专注于搜索底层的...
solr文档
solr manageschema 配置文件,增加了分词器后的配置文件
solr技术文solr技术文solr技术文
Solr定时更新Solr定时更新
如何使用solr搭建服务器
3. solr是什么 2 3.1 solr的功能 3 3.2 solr术语 3 3.2.1 Auto-warming 3 3.2.2 Facet 3 3.3.3 Document 6 3.3.4 Field 6 3.3.5 IndexWriter 6 3.3.6 IndexSearcher 6 3.3.7 Directory 6 3.3.8 Segment 7 3.3.9 ...
solr安装ik分词器将jar复制到solr\WEB-INF\lib 中 具体使用:https://mp.csdn.net/postedit
1.6 分布式和复制 Solr 架构 13 2 Solr的安装与配置 13 2.1 在Tomcat下Solr安装 13 2.1.1 安装准备 13 2.1.2 安装过程 14 2.1.3 验证安装 15 2.2 中文分词配置 15 2.2.1 mmseg4j 15 2.2.2 paoding 19 2.3 多核...
Solr 是Apache下的一个顶级开源项目,采用Java开发,基于Lucene的全文搜索服务器。Solr可以独立运行在Jetty、Tomcat等这些Servlet容器中。这里谈到了Lucene,它是一个开放源代码的全文检索引擎工具包。提供了完整的...
Apache Solr是一个性能强大的,基于 Lucene 的全文搜索的 开源企业级搜索服务器,拥有XML/HTTP,JSON APIs,hit highlighting, faceted search, caching, replication,web管理界面等很多功能,Solr运行在Java servlet...
an introduction to the administration, monitoring, and tuning of a Solr instance, as well as the concepts of sharding and replication. Next, you'll learn about various Solr extensions and how to ...
Apache Solr(solr-8.11.1.tgz)Binary releases 二进制版本
solr的使用
SolrJ、SolrCloud、Spring Data Solr的使用详解和工作原理;Solr的多种性能优化技巧,如索引的性能优化、缓存的性能 优化、查询的性能优化、JVM和Web容器的优化,以及操作系统级别的优化。 拓展知识中首先讲解了Solr...