Can't Register a Snapshot Repository in Elasticsearch

Can't register a snapshot repository in Elasticsearch

  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}'

Is it possible to register multiple Elasticsearch snapshot repositories for the same S3 bucket?

You should use different repository s3 path for different elasticsearch versions.

Till you use different base path for each Elasticsearch cluster snapshot repositories irrespective of bucket name, then it's fine.

There are many breaking changes in repository meta-deta files across major elasticsearch version release, hence you can't use same repository path across elasticsearch version. If you do so, repository will get corrupted.

cannot register s3 repository to aws elastic search

search-weblogs-etrt4mbbu254nsfupy6oiytuz4.us-east-1.es.example.com doesn't exist. It has example.com in it. Where did that come from? You should use your actual search domain.

How do I set the path.repo in Docker compose 3?

As mentioned in the documentation, You have to set your path.repo in your elasticsearch.yml file. This file is at /usr/share/elasticsearch/config/ directory in your image.

So, your compose file should look something like this:

    version: '3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.2.4
container_name: elasticsearch
volumes:
- elastic-data:/usr/share/elasticsearch/data
- elastic-backup:/usr/share/elasticsearch/backup
- ./elasticsearch/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
ports:
- 9200:9200
environment:
discovery.type: single-node
volumes:
elastic-data:
elastic-backup:

and your elasticsearch.yml should have these:

    cluster.name: "docker-cluster"
network.host: 0.0.0.0

# minimum_master_nodes need to be explicitly set when bound on a public IP
# # set to 1 to allow single node clusters
# # Details: https://github.com/elastic/elasticsearch/pull/17288
# discovery.zen.minimum_master_nodes: 1
path.repo: ["/usr/share/elasticsearch/backup"]

After starting the container, I could see the repo in the http://127.0.0.1:9200/_nodes/?pretty response:

    "settings" : {
"cluster" : {
"name" : "docker-cluster"
},
"node" : {
"name" : "3cUpSf-"
},
"path" : {
"logs" : "/usr/share/elasticsearch/logs",
"home" : "/usr/share/elasticsearch",
"repo" : [
"/usr/share/elasticsearch/backup"
]
},

From comment:

There is an user called elasticsearch which is created in this image and Elasticsearch binary runs in context of this user not root user, so this user doesn't have write permission on /opt directory inside the container, but it does have enough permission on /usr/share/elastisearch directory. That's the reason in my above example I have used this directory instead of the /opt/ dir.



Related Topics



Leave a reply



Submit