1.主机SolrConfig.xml

<requestHandler name="/replication" class="solr.ReplicationHandler" >
<lst name="master">
<!--Replicate on 'startup' and 'commit'. 'optimize' is also a valid value for replicateAfter. -->
<str name="replicateAfter">startup</str>
<str name="replicateAfter">commit</str> <!--Create a backup after 'optimize'. Other values can be 'commit', 'startup'. It is possible to have multiple entries of this config string. Note that this is just for backup, replication does not require this. -->
<!-- <str name="backupAfter">optimize</str> --> <!--If configuration files need to be replicated give the names here, separated by comma -->
<str name="confFiles">schema.xml,stopwords.txt,elevate.xml</str>
<!--The default value of reservation is 10 secs.See the documentation below . Normally , you should not need to specify this -->
<str name="commitReserveDuration">00:00:10</str>
</lst>
</requestHandler>

1)replicateAfter可取startup、commit、optimize,表示触发复制的时机。使用中,这三个值都可以配上。
2)backupAfter表示备份时机,如果需要备份,solr会在配置的时机自动生成备份。
3)confFiles表示在复制时需要复制到slave的文件列表。
4)commitReserveDuration默认是10秒,这个值通常你通常不需要修改,除非你的网络慢到传输5M数据需要10秒以上的时间。

2.从机SolrConfig.xml

<requestHandler name="/replication" class="solr.ReplicationHandler" >
<lst name="slave"> <!--fully qualified url for the replication handler of master . It is possible to pass on this as a request param for the fetchindex command-->
<str name="masterUrl">http://master_host:port/solr/corename/replication</str> <!--Interval in which the slave should poll master .Format is HH:mm:ss . If this is absent slave does not poll automatically.
But a fetchindex can be triggered from the admin or the http API -->
<str name="pollInterval">00:00:20</str>
<!-- THE FOLLOWING PARAMETERS ARE USUALLY NOT REQUIRED-->
<!--to use compression while transferring the index files. The possible values are internal|external
if the value is 'external' make sure that your master Solr has the settings to honour the accept-encoding header.
see here for details http://wiki.apache.org/solr/SolrHttpCompression
If it is 'internal' everything will be taken care of automatically.
USE THIS ONLY IF YOUR BANDWIDTH IS LOW . THIS CAN ACTUALLY SLOWDOWN REPLICATION IN A LAN-->
<str name="compression">internal</str>
<!--The following values are used when the slave connects to the master to download the index files.
Default values implicitly set as 5000ms and 10000ms respectively. The user DOES NOT need to specify
these unless the bandwidth is extremely low or if there is an extremely high latency-->
<str name="httpConnTimeout">5000</str>
<str name="httpReadTimeout">10000</str> <!-- If HTTP Basic authentication is enabled on the master, then the slave can be configured with the following -->
<str name="httpBasicAuthUser">username</str>
<str name="httpBasicAuthPassword">password</str>
</lst>
</requestHandler>

说明:上面的参数也不需要太多解释,其中pollInterval参数表明slave从master复制数据的频率。

如果对实时性要求不高,通常5-10分钟即可,也避免slave的indexsearcher频繁的切换,同时,master的commit频率也可相对保持一致。

HTTP API

solr的ReplicationHandler提供了一系列http命令(参数command),支持的可选值如下:

1)indexversion:slave从master获取最新的索引点信息。

2)filecontent:slave从master下载指定文件的内容。

3)filelist:slave从master获取指定indexversion的索引文件列表(及需要复制的配置文件)。

4)backup:备份索引。如果担心索引有损坏的可能性,可以定期备份索引。

5)fetchindex:手动复制数据,和slave自动复制相当。

6)disablepoll:停止slave的复制。

7)enablepoll:开启slave的复制。

8)abortfetch:终止slave上正在进行的下载文件过程。

9)commits:show当前仍旧保留的IndexCommit信息。

10)details:show slave当前的复制细节信息。

11)enablereplication:启动master对所有slave的复制功能

12)disablereplication:关闭master对所有slave的复制功能

Solr配置集群的更多相关文章

  1. Solr主从集群配置简要说明

    关于solr的集群主要分为主从和SolrCloud两种.主从,比较适合以读为主的场景.SolrCloud适合数据量大,时不时会有更新的情形.那么solr的主从配置很简单.在solrconfig.xml ...

  2. Solr的集群搭建(索引库)

    Solr的集群的搭建 Solr集群原理 SolrCloud概念以及结构 概念: SolrCloud(Solr云)是Solr提供的分布式搜索方案,当你需要大规模,容错,分布式索引和检索能力时使用Solr ...

  3. Centos7:solr伪集群(SolrCloud)搭建

    JDK,tocmat环境搭建 zookeeper集群安装 解压缩zookeeper的压缩包 创建data目录 复制zoo_sample.cfg为zoo.cfg 修改confg/zoo.cfg中 dat ...

  4. Redis配置集群二(window)

    第一篇那redis的基础命令都差不多讲了一遍了,这篇就将怎么配置集群了,最后要达到的效果是一台主redis,还有几台从的redis,每次数据都是同步的,当主redis挂掉了,那么就会从几台从redis ...

  5. 图文解说:Nginx+tomcat配置集群负载均衡

    图文解说:Nginx+tomcat配置集群负载均衡 博客分类: appserver nginxTomcatUbuntuLinux网络应用  作者:niumd Blog:http://ari.iteye ...

  6. 转】Nginx+tomcat配置集群负载均衡

    原博文出自于:http://blog.csdn.net/bruce_6/article/details/38228299         感谢! 相信很多人都听过nginx,这个小巧的东西慢慢地在吞食 ...

  7. 配置集群Nginx+Memcached+Tomcat集群配置

    上班之余抽点时间出来写写博文,希望对新接触的朋友有帮助.今天在这里和大家一起学习一下配置集群 1.   Nginx Nginx是通过将多个Web Server绑定到同一个IP地址下,以实现多个WebS ...

  8. weblogic配置集群(二)

    接到上一篇博文来 weblogic配置集群(一) 三.启动管理server 按照上面的方式创建好域后,在D:\Oracle\Middleware\user_projects\domains\gszhD ...

  9. weblogic配置集群(一)

    一.程序安装 二.创建域 好的  篇幅太长  我就接下来的操作就写在下一篇博客了 weblogic配置集群(二)

随机推荐

  1. Node.js事件发射器

    在Node很多对象发出事件,例如net.Server每个同级连接到它,一个fs.readStream发出打开文件事件时,每次都发出一个事件. 它发出事件的所有对象都是events.EventEmitt ...

  2. BZOJ 1072 排列

    Description 给一个数字串\(s\)和正整数\(d\), 统计\(s\)有多少种不同的排列能被\(d\)整除(可以有前导\(0\)).例如\(123434\)有\(90\)种排列能被\(2\ ...

  3. hdu 5144 NPY and shot

    http://acm.hdu.edu.cn/showproblem.php?pid=5144 题意:给你初始的高度和速度,然后让你求出水平的最远距离. 思路:三分枚举角度,然后根据公式求出水平距离. ...

  4. Spring基础介绍

    Spring属于轻量级还是重量级框架?   这需针对使用Spring的功能而言,比如我们常使用其核心服务整合SSH,这样则为轻量级. 如果使用其大部分服务则可以理解为重量级.   普通JAVA项目环境 ...

  5. js中的Call与apply方法

    看到同行写得不错,直接转载了...0.0  祝大家天天开心! 例子来源http://uule.iteye.com/blog/1158829

  6. VS2010安装Visual Assist

    Visual Assist X是一款非常好的Microsoft Visual Studio 2005和Visual Studio .NET插件,支持C/C++,C#,ASP,Visual Basic, ...

  7. Light OJ 1030 - Discovering Gold

    题目大意: 给你一个1*N的方格,你初始位置是在1,给你一个骰子,假设你现在的位置是X,你投掷一个骰子掷的点数是y, 那么你的新位置就是 X+y, 并且你可以得到新位置的宝藏.假如X+y > N ...

  8. w​i​n​d​o​w​s​7​旗​舰​版​I​I​S​6​配​置​-​保​证​能​发​布

    http://wenku.baidu.com/view/20b4d26248d7c1c708a145d1.html

  9. Delphi 客户端调用Webservice 的TClientdataset 报出“http://www.borland.com/namespaces/Types-IAppServerSOAP”

    http://www.borland.com/namespaces/Types-IAppServerSOAP 服务器未能识别 HTTP 头 SOAPAction 的值 (2011-04-25 16:4 ...

  10. geopy使用详解

    由于专业需要,经常接触一些地理处理的工具包,文档都是英文的,自己看的同时将其翻译一下,一方面自己学习的同时有个记录,要是能同时给一起的学习的童鞋们一些帮助,想想也是极好的.以下的文档内容主要翻译自官方 ...