Search code examples
dockersolr

The loss of core.properties after Solr Docker container restart


I run the Solr instance from the Docker image. I have 2 cores.

After I have restarted the container, core.properties of one of the cores was deleted and the core disappeared from the Admin UI. After I created and added this file manually, everything became the same as before. Then I have tried to restart the container again and core.properties was deleted again, but that time from another core.

What could be the reason for that?

EDIT:

There are 2 cores: main_core and swap_core. I do many operation with them, like: adding the default schema, checking the schema, adding custom fields, adding data etc. Also I tried to implement the reindex but unsuccessfully. But everything worked +- as I expected until I reloaded the Docker container. The container's structure looks like this:

- solr
    - Files
        - var
            - solr
                - data
                    - main_core
                        - conf
                        - data
                        core.properties
                    - swap_core
                        - conf
                        - data
                        core.properties

After the first reloading core.properties from the main_core was deleted. I restored it manually and reloaded the container once more. Then core.properties from the swap_core was deleted.

Apart from that, I get the

org.apache.solr.common.SolrException: The 'leaderUrl' parameter value is not allowed: URL is neither a live node of the cluster nor in the configured 'allowUrls'

error.

I'm not sure that the Python code would help much, especially since there are about 10-12 different functions that work with Solr and since before the Docker container restart everything was alright. I would just add that I use the Pysolr Python library.

import pysolr

solr = pysolr.Solr("http://localhost:8983/solr/main_core")

Solution

  • SOLVED: It turned out that I had to modify the solr.xml

    <str name="allowUrls">${solr.allowUrls:}</str>
    

    in that way:

    <str name="allowUrls">${solr.allowUrls:localhost:8983/solr}</str>
    

    Even the reindex started to work properly.