Can't register a snapshot repository in Elasti

2020-06-06 05:27发布

I am using Elasticsearch 1.4 and ubuntu 12.04.3 LTS.Trying to create a snapshot for Local elasticsearch. I refer this website

This website steps are working fine on windows Elasticsearch. If I Register the repository on Ubuntu Elasticsearch. it fired below message.

This Query What I run

curl -XPUT http://xx.xx.xx.xx:9200/_snapshot/es_snap -d '{
  "type": "fs",
  "settings": {
    "location": "/mount/backups/my_backup"
  }
}'

I got this Response.

{
  "error":"RepositoryException[[es_snap] failed to create repository]; 
            nested: CreationException[Guice creation errors:\n\n1) Error injecting constructor, org.elasticsearch.common.blobstore.BlobStoreException: 
            Failed to create directory at [
              D:/data/es_snapshot_bkup/es_snapshot_repo]\n  
                at org.elasticsearch.repositories.fs.FsRepository.<init>(Unknown Source)\n  
                while locating org.elasticsearch.repositories.fs.FsRepository\n  
                while locating org.elasticsearch.repositories.Repository\n\n1 error
            ]; 
            nested: BlobStoreException[Failed to create directory at [/mount/backups/my_backup]]; ",
  "status":500
}

3条回答
三岁会撩人
2楼-- · 2020-06-06 05:45

Your query looks good. But do you have the appropriate permissions to create a repo at "/mount/backups/my_backup". Try your curl command as a sudo user. It's worth a shot !

Reason why I think its a permissions issue is because of the following in your error log. nested: BlobStoreException[Failed to create directory at [/mount/backups/my_backup]]; ","status":500}

查看更多
叼着烟拽天下
3楼-- · 2020-06-06 05:47

Got the same error, and I had to make sure the same path was writable on ALL nodes (as the same user). I mounted the directory directly on one of the nodes, and used nfs to mount on the other ones. To troubleshoot perms, edit /etc/passwd and change the login shell for elasticsearch from /sbin/nolgin to /bin/bash and then run 'su - elasticsearch'. Then try writing a file to the directory. You have to do that on all the nodes.

查看更多
家丑人穷心不美
4楼-- · 2020-06-06 06:00
  1. First create a backup folder(Generally that folder create user home folder)

    mkdir ~/backup
    
  2. Give permission for that folder

    chmod 777 ~/backup
    
  3. Create a repository (Repository is represent you path)

    curl -XPUT http://xx.xx.xx.xx:9200/_snapshot/es_snap -d 
    '{"type":"fs","settings":{"location":"home/user/backup"
    ,"compress":true}}'
    
  4. Snapshot

    curl -XPUT "http://xx.xx.xx.xx:9200/_snapshot/en_snap/snapshot_1" -d 
    '{"indices":["index1","index2","index3"],"ignore_unavailable":true,
    "include_global_state": false,}'
    
  5. Restore

    curl -XPOST "http://xx.xx.xx.xx:9200/_snapshot/es_snap/snapshot_1/_restore" -d 
    '{"indices":["index1","index2"],"ignore_unavailable":true,
    "include_global_state": false}'
    
查看更多
登录 后发表回答