J.Alex
J.Alex

Reputation: 113

Apache Solr Cloud Backup Issues to path when 'solr.allowPaths' is set

I am trying to backup a solr cloud collection. Solr and Zookeeper are running in docker containers. There are 3 solr (using ports: 8981,8982,8983) and 3 ZKs containers running. I am passing a docker volume to the solr containers

volumes:
    - solr_backups:/solr-backups/storage

Within the Dockerfile the folders are built and given chmod 777. So all solr containers see the folder as though it was a network share(I assume).

Executing

$ curl "localhost:8981/solr/admin/collections?action=BACKUP&name=test1&collection=myColl&location=/solr-backups/storage"

Returns the following

...
 "failure":{
    "172.19.0.22:8983_solr":"org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException:
Error from server at http://172.19.0.22:8983/solr: 
Failed to backup core=myColl_shard1_replica_n1 because org.apache.solr.common.SolrException: 
Path /solr-backups/storage/test1 must be relative to SOLR_HOME, SOLR_DATA_HOME coreRootDirectory. 
Set system property 'solr.allowPaths' to add other allowed paths."},
  "Operation backup caused exception:":"org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: 
Could not backup all shards",
  "exception":{
    "msg":"Could not backup all shards",
    "rspCode":500},
  "error":{
    "metadata":[
      "error-class","org.apache.solr.common.SolrException",
      "root-error-class","org.apache.solr.common.SolrException"],
    "msg":"Could not backup all shards",
...

The curl is sent to 8981(could be sent to any of the 3). The error is reported back from 8983. The myColl doesn't have a shard on 8981. The backup folder test1 is being created and accessible to all 3 running solr containers.

Executing a shell into one of the containers.

$ ls -al /solr-backups/storage/
total 16
drwxrwxrwx 4 root root 4096 Nov 30 16:49 .
drwxr-xr-x 3 root root 4096 Nov 30 16:22 ..
drwxr-xr-x 2 solr root 4096 Nov 30 16:49 test1
drwxr-xr-x 2 solr root 4096 Nov 30 16:25 test3

Show the folder is there and owned by solr.

From the solr.xml

  <str name="allowPaths">${solr.allowPaths:*,_ALL_,/solr-backups/storage/}</str>

I've tried the above with just * and just the path. Also, all of the specials and and path.

I also set a cluster property when preforming docker-compose up

curl \"http://solr1:8983/solr/admin/collections?action=CLUSTERPROP&name=location&val=/solr-backups/storage\";

Any assistance would be greatly appreciated.

Upvotes: 5

Views: 3310

Answers (1)

Pan Panhuibin
Pan Panhuibin

Reputation: 1

the error message shows :

/solr-backups/storage/test1 must be relative to SOLR_HOME, SOLR_DATA_HOME coreRootDirectory. 

so you need to have a directory like $SOLR_HOME/solr-backups/storage/ or $SOLR_DATA_HOME/solr-backups/storage/

for solr v8.11 $SOLR_HOME is /var/solr/data

Upvotes: 0

Related Questions