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. 接受、online、见刊时,期刊的 IF 都不同,究竟算发几分期刊?

  2. QS Network

    zoj1586:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1586 题目大意:最小生成树,不只算两点之间的费用,还要算点 ...

  3. Apache HTTPServer与JBoss/Tomcat的整合与请求分发

    http://www.blogjava.net/supercrsky/archive/2008/12/24/248143.html

  4. Dll方式的线程,需要引用这个

    {== D6DLLSynchronizer =================================================} {: This unit handles the D6 ...

  5. 使用SetWindowPos API函数移动窗口后,还需修改Delphi的属性值,以备下次使用,否则就会出问题(不是API不起作用,而是使用了错误的坐标值)

    单独改变坐标的代码如下,可不断左移: procedure TForm1.Button1Click(Sender: TObject); begin SetWindowPos(panel1.Handle, ...

  6. 使用 InstallShield limited edition 打包部署Outlook 2013 Office add-in插件

    原文: Outlook: Deploying an Outlook 2013 add-in (using InstallShield LE) Today I had to create an inst ...

  7. ♫【HTML5 敏捷实践】第1章 使用语义化的方式实现

    <!DOCTYPE html> 向后兼容的HTML5<doctype>标签.HTML5规范规定<doctype>对大小写不敏感:然而,之前版本的HTML需要< ...

  8. 网络流(最大密集度子图,分数规划):UvaLive 3709 Hard Life

    John is a Chief Executive Officer at a privately owned medium size company. The owner of the company ...

  9. 数据结构(Splay平衡树):COGS 339. [NOI2005] 维护数列

    339. [NOI2005] 维护数列 时间限制:3 s   内存限制:256 MB [问题描述] 请写一个程序,要求维护一个数列,支持以下 6 种操作:(请注意,格式栏 中的下划线‘ _ ’表示实际 ...

  10. QTP自传之录制

    录制,是一件吃力不讨好的活.很多人以为录制就是我的主要甚至全部的功能,这是大错特错的.不过,录制功能却是不熟悉我的人了解我的有效途径,是大家学习的有力武器.今天就先从录制功能说起吧. 说到录制,就不得 ...