如何设置 solr 8.11 复制从站?

发布于 2025-01-16 22:05:14 字数 1241 浏览 3 评论 0原文

我尝试设置 solr 主/从复制。但我有一些问题需要了解如何设置从属 solr。在每个文档或“如何做”中,仅描述了从属设备的不同 solrconfig.xml,但没有描述我应该如何设置它们。

我应该在从属设备上也创建一个核心吗?因为当我这样做时,奴隶solr并没有意识到他应该是一个奴隶。当我在slave上调用 /replication?command=details 时,输出是

{
  "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"}}}

所以他认为他是一个master。在从属 solrconfig.xml 中,我创建了正确的 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!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

难理解 2025-01-23 22:05:14

我也应该在从属设备上创建一个核心吗?因为当我这样做的时候,slave solr并没有意识到他应该是一个slave。

是的,您需要创建第二个核心,完成后更新其 solrconfig.xml 以指示主 Solr 在哪里。

主核心中的 solrconfig.xml 将有一个如下所示的部分:

<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>

而从属核心中的 solrconfig.xml 将有一个看起来或多或少像这样的部分:

<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>

更多详细信息https://github.com/hectorcorrea/solr-for-newbies/blob/code4lib_2018/tutorial.md#solr-replication

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文