Saving ElasticSearch Backups into Google Cloud Storage

Hello,

Currently I am using Elasticsearch
"version" : {
"number" : "6.8.1"
and I am trying to create snapshots to the gce storage
But I need your help to explain me something because I am receiving an error when I am trying to create my repo.
What I have done:

  1. I have installed and enabled the elasticsearch-plugin for repository-gcs
  2. I have created a service account with storage admin permissions
  3. I have got a json file

My questions:
4) I need to add a secure settings using this command:
/usr/share/elasticsearch/bin/elasticsearch-keystore add-file gcs.client.default.credentials_file /root/elastic_bucket.json

  1. and then create a repo like this:
    curl -XPUT -H "content-type:application/json" 'localhost:9200/_snapshot/bucket1' -d '{"type":"gcs", "settings":{"bucket":"<bucket_name>","client":"<client_name>" ,"service_account":"elastic_bucket.json"}}'

But I receive that:

{"error":{"root_cause":[{"type":"blob_store_exception","reason":"Unable to check if bucket [<bucket_name>] exists"}],"type":"repository_exception","reason":"[bucket1] cannot create blob store","caused_by":{"type":"blob_store_exception","reason":"Unable to check if bucket [<bucket_name>] exists","caused_by":{"type":"illegal_argument_exception","reason":"Unknown client name [<client_name>].

So, I dont understand, what is the client name? I mean, when you define this: gcs.client..credentials_file, what should be the name? the name of the user? the name of the service account?
I am very confused If I need to do something more?
Also, Do I need to add my bucket url location into the path.repo inside the elasticsearch.yml configuration file? Like we do with a file system?

Any help with that?
Thanks!

Remove the client attribute from the repository creation settings. Additionally the term <bucket_name> is an indication of a placeholder so you must replace it with the actual bucket name that you are using in GCS.

Hi @thiago, thanks for your reply.
Yes, I didnt post the actual name of the bucket because is global unique, and for security reasons I just added like that to give an example of my config.
So, If I remove the client, by default is "default" right?
That reflects the default service account that use a compute engine to connect to a bucket? Do you know?

Many thanks!

That is correct. If you remove the client attribute it will use the default client which is the one that the configuration you posted has.

Nice, so just to be sure that I understand the command. If I dont want to use the default, then the client name is the name of the service account that I have created specific to that right? Then I need to define it also during the creation of my repo right?

Furthermore, do I need to add my storage bucket url into the elasticsearch.yml config file as repo.path?

Thanks!

That is correct.

No. That setting is only required for creating a shared FS repo, which is not the case here.

Great!! Thanks for your help, I appreciate it!

1 Like

Good morning @thiago,
Sorry for bothering you again.
I was wondering If you can answer me this question please,
I have got a cluster of elasticsearch (3 nodes), and I want to take a snapshot into the google cloud storage bucket.
This need to be done by execute the command from the master node only? or I can execute through any node in the cluster? The result will be the same?

Thanks in advance!

You may execute it from any node.

Good morning @thiago,

Once again sorry for bothering, one quick question please If you can answer to me.
I have got a ES cluster of 3 nodes.
When I execute the following command to create a snapshot repo of GCS type (where values real values):

curl -XPUT -H "content-type:application/json" 'localhost:9200/_snapshot/bucket1' -d '{"type":"gcs", "settings":{"bucket":"value","client":"elastic_bucket" ,"service_account":"elastic_bucket.json","compress":true}}'

I receive an error

that repository type [gcs] does not exist

Is there any chance this error happens because at first I need to install in all the nodes the
plugin for repository-gcs?
I mean, before I create a snapshot repo on one node, all the nodes in the cluster must have the plugin and the keystore?
Is required to restart the node after I install the plugin or its not necessary ?

I am asking because, I tried the same command on a single ES node (not in a cluster) and worked fine.

Many thanks!

Yes, the plugin needs to be installed on every node of the cluster. After installing, you need to restart.

Good afternoon @thiago,

I am so sorry for bothering once more, I was wondering If you can help me to troubleshooting this issue:

I am trying to create a ES snapshot through curator and I receive this error message:

Failed to complete action: snapshot. <class 'curator.exceptions.FailedExecution'>: Exception encountered. Rerun with loglevel DEBUG and/or check Elasticsearch logs for more information. Exception: AuthorizationException(403, u'cluster_block_exception', u'blocked by: [FORBIDDEN/4/index closed];')

The weird thing is that the backup does not work when I am using curator but it is working by using this command:
curl -XPUT 'localhost:9200/_snapshot/<name>/first-snap?wait_for_completion=true'

Do you have any idea why this is happening?
Does not work with:
curator --config curator.yml action.yml

where action.yml:
---
actions:
1:
action: snapshot
options:
repository:
filters:
- filtertype: none

What actions I should do in order to troubleshot this? Any ideas please?

Many thanks!

No worries mate :wink:

That means that the index you are trying to snapshot is closed. You need to open it do snapshot.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.