以下代码显示如何在从服务器中配置一个索引复制请求处理:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | < requestHandler name = "/replication" class = "solr.ReplicationHandler" > < lst name = "slave" > <!--主索引的url,该从索引将从这个主索引地址同步索引--> < str name = "masterUrl" >http://remote_host:port/solr/corename/replication</ str >; <!--拉取间隔,达到这个时间,从索引将从主索引同步索引.格式为 is HH:mm:ss . 如果该设置为空从索引将不会主动从主索引同步索引. 另外拉取索引的请求也可以通过 admin 页面或者 http api 来触发 --> < str name = "pollInterval" >00:00:20</ str > <!-- 以下参数不常用,非必填参数--> <!--在索引传输过程中使用压缩,可选的值有两个 internal 和 external 如果值是 'external' 请确保主索引的solr已经设置了accept-encoding header。 如果值是 'internal' 索引数据将被自动压缩?,这个主要在低带宽情况下使用,局域网中请不要使用,局域网中使用会降低复制效率--> < str name = "compression" >internal</ str > <!-以下是配置连接和读取超时时间,这个跟 http 中的概念一样,单位为毫秒--> < str name = "httpConnTimeout" >5000</ str > < str name = "httpReadTimeout" >10000</ str > <!-- 如果主服务中的 http base 的鉴权可用的话,从服务就需要配置这个用户名和密码 --> < str name = "httpBasicAuthUser" >username</ str > < str name = "httpBasicAuthPassword" >password</ str > </ lst > </ requestHandler > |