我在 Kubernetes 上有一个正在运行的 SolrCloud v8.11 集群,带有 solr-operator。
在 S3 存储桶上启用备份。
如何正确编写请求以对存储在 S3 存储桶中的备份执行RESTORE
?
我无法弄清楚我必须在发出的 Restore API
请求中提供的 location
和 snapshotName
到 Solr。
为了发现这些值,我尝试执行 LISTBACKUP
操作,但在这种情况下,location
值也是错误的...
$ curl https://my-solrcloud.example.org/solr/admin/collections\?action=LISTBACKUP\&name=collection-name\&repository=collection-backup\&location=my-s3-bucket/collection-backup
{
"responseHeader":{
"status":400,
"QTime":70},
"error":{
"metadata":[
"error-class","org.apache.solr.common.SolrException",
"root-error-class","org.apache.solr.common.SolrException"],
"msg":"specified location s3:///my-s3-bucket/collection-backup/ does not exist.",
"code":400}}
## The Log in cluster writes:
org.apache.solr.common.SolrException: specified location s3:///my-s3-bucket/collection-backup/ does not exist. => org.apache.solr.common.SolrException: specified location s3:///my-s3-bucket/collection-backup/ does not exist.
毕竟,定期备份按预期工作,但迟早会执行RESTORE 操作
,并且尚不清楚如何正确完成它。
提前谢谢您。
最佳答案
有点晚了,但我在寻找相同答案时遇到了这个问题。有a thread on the mailing list这帮助我弄清楚了它应该如何工作。
我发现有关此内容的文档非常困惑,但位置
似乎相对于备份存储库。因此,repository
参数已经说明了存储桶名称,name
参数将是您尝试列出的备份的名称。然后,Solr 将 S3 路径构建为 {存储库存储桶} + {位置} + {备份名称}
。因此,位置应该简单地是:/
假设您已为 SolrCloud 部署设置了一个 backupRepository
,如下所示:
backupRepositories:
- name: "my-backup-repo"
s3:
region: "us-east-1"
bucket: "my-s3-bucket"
并且您已经创建了一个 SolrBackup,如下所示:
---
apiVersion: solr.apache.org/v1beta1
kind: SolrBackup
metadata:
name: "my-collection-backup"
spec:
repositoryName: "my-backup-repo"
solrCloud: "my-solr-cloud"
collections:
- "my-collection"
LISTBACKUP 的完整 cURL 命令为:
$ curl https://my-solrcloud.example.org/solr/admin/collections \
-d action=LISTBACKUP \
-d name=my-collection-backup \
-d repository=my-backup-repo \
-d location=/
与 RESTORE 命令类似:
$ curl https://my-solrcloud.example.org/solr/admin/collections \
-d action=RESTORE \
-d name=my-collection-backup \
-d repository=my-backup-repo \
-d location=/ \
-d collection=my-collection-restore
关于kubernetes - 如何从 S3 存储桶恢复 Solr 备份,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71125463/