设为首页 收藏本站
查看: 830|回复: 0

[经验分享] solr(8)Solr Index Replication

[复制链接]

尚未签到

发表于 2016-12-14 08:18:39 | 显示全部楼层 |阅读模式
solr(8)Solr Index Replication

1. Introduction Index Replication
The master will handle updates to the index, all querying is handled by the slaves.

Master — Slave1, Slave2, Slave3. A Solr index can be replicated across multiple slave servers, which then process requests.

Index Replication in Solr
Solr includes a Java implementation of index replication that works over HTTP.
solrconfig.xml, works across platforms with same configuration.

Some Term
Index - A lucene index is a directory of files. These files make up the searchable and returnable data of a Solr Core.
Distribution - The copying of an index from the master server to all slaves.
Inserts and Deletes - The directory remains unchanged. Documents are always inserted into newly created files. Documents         
                                  that are deleted are not removed from the files. They are flagged in the file, deletable, and are not
                                  removed from the files until the index is optimized.
Master and Slave - Slave nodes receive no updates directly, instead all changes are made against the single master node.
                               Changes made on the master are distributed to all the salve nodes.
Update -
Optimization - Optimization should only be run on the master nodes.
Segment -
mergeFactor -
Snapshot -

Configuring the ReplicationHandler
maxNumberOfBackups - how many backups we keep on disk as it receives back commands.

Configuring the Replication RequestHandler on a Master Server
<requestHandler name="/replication" class="solr.ReplicationHandler">
  <lst name="master">
    <str name="replicateAfter">optimize</str>
    <str name="backupAfter">optimize</str>
    <str name="confFiles">schema.xml,stopwords.txt,elevate.xml</str>
    <str name="commitReserveDuration">00:00:10</str>
  </lst>
  <int name="maxNumberOfBackups">2</int>
  <lst name="invariants">
    <str name="maxWriteMBPerSec">16</str>
  </lst>
</requestHandler>

Configuring the Replication RequestHandler on a Slave Server
<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://remote_host:port/solr/core_name/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 honor 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>

Setting Up a Repeater with the ReplicationHandler
<requestHandler name="/replication" class="solr.ReplicationHandler">
  <lst name="master">
    <str name="replicateAfter">commit</str>
    <str name="confFiles">schema.xml,stopwords.txt,synonyms.txt</str>
  </lst>
  <lst name="slave">
    <str name="masterUrl">http://master.solr.company.com:8983/solr/core_name/replication</str>
    <str name="pollInterval">00:00:60</str>
  </lst>
</requestHandler>

Commit and Optimize Operations

Slave Replication

Replicating Configuration Files

Reading the Sample Configuration and Setup an Replication Myself

2. Understanding of Solr
There is a URL/handlers mapping in solrconfig.xml.

Some built-in handlers in Solr
Search handlers: DisMaxRequestHandler, LukeRequestHandler, MoreLikeThisHandler, SearchHandler, SpellCheckerRequestHandler

We are using solr.SearchHandler, http://wiki.apache.org/solr/SearchHandler

Update handlers: DataImportHandler, BinaryUpdateRequestHandler, CSVUpdateRequestHandler, ExtractingRequestHandler, JsonUpdateRequestHandler, XmlUpdateRequestHandler, XsltUpdateRequestHandler

We are using
solr.RealTimeGetHandler,
solr.UpdateRequestHandler,
solr.ExtractingRequestHandler,
solr.FieldAnalysisRequestHandler,
solr.DocumentAnalysisRequestHandler,
solr.admin.AdminHandler,
solr.PingRequesthandler,
solr.DumpRequestHandler,
solr.ReplicationHandler,
solr.DirectUpdateHandler2

UpdateRequestProcessor and Chain, something like FilterChain. The implement class will extends from SearchComponent

Java - solrj
scala - https://github.com/inoio/solrs
            https://github.com/takezoe/solr-scala-client

3. Configuration on Ubuntu Master and Slaves
…todo...


References:
solr 6 and solr 7
http://sillycat.iyunv.com/blog/2227066
http://sillycat.iyunv.com/blog/2227398

pull mode index replication
https://cwiki.apache.org/confluence/display/solr/Index+Replication

distributed search with index sharding
https://cwiki.apache.org/confluence/display/solr/Distributed+Search+with+Index+Sharding

Solr Cloud
https://cwiki.apache.org/confluence/display/solr/SolrCloud

Solr Article
http://blog.csdn.net/jaynol/article/details/17230857
http://blog.csdn.net/jaynol/article/details/24717123
http://blog.csdn.net/jaynol/article/details/24776437
http://blog.csdn.net/jaynol/article/details/24959373
http://blog.csdn.net/jaynol/article/details/25098667
http://blog.csdn.net/jaynol/article/details/25305323
http://blog.csdn.net/jaynol/article/details/25604271

lucene
https://lucene.apache.org/core/5_2_1/

solr clients
https://wiki.apache.org/solr/IntegratingSolr

XML for Solr
https://wiki.apache.org/solr/UpdateXmlMessages#XML_Messages_for_Updating_a_Solr_Index
https://cwiki.apache.org/confluence/display/solr/Uploading+Data+with+Index+Handlers

akka system
http://sillycat.iyunv.com/blog/1767866
http://sillycat.iyunv.com/blog/1768625
http://sillycat.iyunv.com/blog/1768626
http://sillycat.iyunv.com/blog/2099267
http://sillycat.iyunv.com/blog/2100232

actor waiting
http://stackoverflow.com/questions/3107286/wait-for-an-actor-to-exit

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-313923-1-1.html 上篇帖子: solr开--solr配置安装 下篇帖子: Solr tomcat setup
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表