我正在尝试备份 solr 云集合。Solr 和 Zookeeper 在 docker 容器中运行。有 3 个 solr(使用端口:8981,8982,8983)和 3 个 ZKs 容器正在运行。我正在将 docker 卷传递给 solr 容器
volumes:
- solr_backups:/solr-backups/storage
在 Dockerfile 中,文件夹被构建并给出chmod 777
。因此,所有 solr 容器都将文件夹视为网络共享(我假设)。
执行
$ curl "localhost:8981/solr/admin/collections?action=BACKUP&name=test1&collection=myColl&location=/solr-backups/storage"
返回以下内容
...
"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",
...
curl 被发送到 8981(可以发送到 3 个中的任何一个)。该错误是从 8983 报告回来的。8981myColl
上没有分片。test1
正在创建备份文件夹,所有 3 个正在运行的 solr 容器都可以访问该文件夹。
在其中一个容器中执行 shell。
$ 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
显示文件夹在那里并且归 solr 所有。
从 solr.xml
<str name="allowPaths">${solr.allowPaths:*,_ALL_,/solr-backups/storage/}</str>
我已经用 * 和路径尝试了上面的方法。此外,所有的特价商品和路径。
在执行 docker-compose up 时,我还设置了一个集群属性
curl \"http://solr1:8983/solr/admin/collections?action=CLUSTERPROP&name=location&val=/solr-backups/storage\";
任何帮助将不胜感激。