简体   繁体   中英

How to setup solr 8.11 replication slave?

I try to setup a solr master/slave replication. But I've some issues to understand how I setup the slave solr. In each documentation or "How to do" there are only described the different solrconfig.xml for slave but not how I should setup them.

Should I create on the slave also a core too? Because when I do it, the slave solr didn't recognized that he should be a slave. When I call /replication?command=details on slave, the output are

{
  "responseHeader":{
    "status":0,
    "QTime":1},
  "status":"OK",
  "details":{
    "indexSize":"69 bytes",
    "indexPath":"/var/solr/data/vdiParts/data/index/",
    "commits":[[
        "indexVersion",0,
        "generation",1,
        "filelist",["segments_1"]]],
    "isMaster":"true",
    "isSlave":"false",
    "indexVersion":0,
    "generation":1,
    "master":{
      "replicateAfter":["commit"],
      "replicationEnabled":"true"}}}

So he thinks he is a master. In slave solrconfig.xml I create the correct requestHandler

<requestHandler name="/replication" class="solr.ReplicationHandler">
        <lst name="follower">
            <str name="leaderUrl">http://[host]:8983/solr/[core]/replication</str>
            <str name="pollInterval">00:00:20</str>
            <str name="httpConnTimeout">5000</str>
            <str name="httpReadTimeout">10000</str>
        </lst>
    </requestHandler>

Thx!

Should I create on the slave also a core too? Because when I do it, the slave solr didn't recognized that he should be a slave.

Yes, you need to create the second core and after you have done that, update its solrconfig.xml to indicate that where is the master Solr.

solrconfig.xml in the master core will have a section like this:

<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</str>
  </lst>
</requestHandler>

whereas the solrconfig.xml in the slave will have a section that looks more or less like this:

<requestHandler name="/replication" class="solr.ReplicationHandler">
  <lst name="slave">
    <str name="masterUrl">http://localhost:8983/solr/bibdata/replication</str>
    <str name="pollInterval">00:00:20</str>
    <str name="compression">internal</str>
    <str name="httpConnTimeout">5000</str>
    <str name="httpReadTimeout">10000</str>
    <str name="httpBasicAuthUser">username</str>
    <str name="httpBasicAuthPassword">password</str>
  </lst>
</requestHandler>

More details https://github.com/hectorcorrea/solr-for-newbies/blob/code4lib_2018/tutorial.md#solr-replication

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM