# Saving ElasticSearch Backups into Google Cloud Storage

**URL:** <https://discuss.elastic.co/t/saving-elasticsearch-backups-into-google-cloud-storage/193535>\
**Category:** Elasticsearch\
**Created:** [August 2, 2019, 12:41pm UTC](https://discuss.elastic.co/t/saving-elasticsearch-backups-into-google-cloud-storage/193535 "2019-08-02T12:41:19Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ab\_Avramidis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ab_avramidis/32/51514_2.png) [@Ab\_Avramidis](https://discuss.elastic.co/u/Ab_Avramidis)\
**Post date:** [August 2, 2019, 12:41pm UTC](https://discuss.elastic.co/t/saving-elasticsearch-backups-into-google-cloud-storage/193535/1 "2019-08-02T12:41:19Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [August 2, 2019, 12:58pm UTC](https://discuss.elastic.co/t/saving-elasticsearch-backups-into-google-cloud-storage/193535/2 "2019-08-02T12:58:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Ab\_Avramidis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ab_avramidis/32/51514_2.png) [@Ab\_Avramidis](https://discuss.elastic.co/u/Ab_Avramidis)\
**Post date:** [August 2, 2019, 1:03pm UTC](https://discuss.elastic.co/t/saving-elasticsearch-backups-into-google-cloud-storage/193535/3 "2019-08-02T13:03:10Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [August 2, 2019, 1:04pm UTC](https://discuss.elastic.co/t/saving-elasticsearch-backups-into-google-cloud-storage/193535/4 "2019-08-02T13:04:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Ab\_Avramidis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ab_avramidis/32/51514_2.png) [@Ab\_Avramidis](https://discuss.elastic.co/u/Ab_Avramidis)\
**Post date:** [August 2, 2019, 1:07pm UTC](https://discuss.elastic.co/t/saving-elasticsearch-backups-into-google-cloud-storage/193535/5 "2019-08-02T13:07:12Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [August 2, 2019, 1:08pm UTC](https://discuss.elastic.co/t/saving-elasticsearch-backups-into-google-cloud-storage/193535/6 "2019-08-02T13:08:58Z")

</div>

> [@Ab\_Avramidis](#):
>
> 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?

That is correct.

> [@Ab\_Avramidis](#):
>
> Furthermore, do I need to add my storage bucket url into the elasticsearch.yml config file as repo.path?

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

---

<div class="post-metadata">

**Author:** ![Ab\_Avramidis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ab_avramidis/32/51514_2.png) [@Ab\_Avramidis](https://discuss.elastic.co/u/Ab_Avramidis)\
**Post date:** [August 2, 2019, 1:09pm UTC](https://discuss.elastic.co/t/saving-elasticsearch-backups-into-google-cloud-storage/193535/7 "2019-08-02T13:09:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ab\_Avramidis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ab_avramidis/32/51514_2.png) [@Ab\_Avramidis](https://discuss.elastic.co/u/Ab_Avramidis)\
**Post date:** [August 9, 2019, 8:36am UTC](https://discuss.elastic.co/t/saving-elasticsearch-backups-into-google-cloud-storage/193535/8 "2019-08-09T08:36:15Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [August 10, 2019, 3:28pm UTC](https://discuss.elastic.co/t/saving-elasticsearch-backups-into-google-cloud-storage/193535/9 "2019-08-10T15:28:47Z")

</div>

You may execute it from any node.

---

<div class="post-metadata">

**Author:** ![Ab\_Avramidis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ab_avramidis/32/51514_2.png) [@Ab\_Avramidis](https://discuss.elastic.co/u/Ab_Avramidis)\
**Post date:** [August 16, 2019, 10:29am UTC](https://discuss.elastic.co/t/saving-elasticsearch-backups-into-google-cloud-storage/193535/10 "2019-08-16T10:29:58Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [August 16, 2019, 12:59pm UTC](https://discuss.elastic.co/t/saving-elasticsearch-backups-into-google-cloud-storage/193535/11 "2019-08-16T12:59:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ab\_Avramidis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ab_avramidis/32/51514_2.png) [@Ab\_Avramidis](https://discuss.elastic.co/u/Ab_Avramidis)\
**Post date:** [August 23, 2019, 2:15pm UTC](https://discuss.elastic.co/t/saving-elasticsearch-backups-into-google-cloud-storage/193535/12 "2019-08-23T14:15:53Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [August 23, 2019, 7:51pm UTC](https://discuss.elastic.co/t/saving-elasticsearch-backups-into-google-cloud-storage/193535/13 "2019-08-23T19:51:24Z")

</div>

> [@Ab\_Avramidis](#):
>
> I am so sorry for bothering once more, I was wondering If you can help me to troubleshooting this issue:

No worries mate 😉

> [@Ab\_Avramidis](#):
>
> (403, u'cluster\_block\_exception', u'blocked by: [FORBIDDEN/4/index closed];')

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 20, 2019, 7:51pm UTC](https://discuss.elastic.co/t/saving-elasticsearch-backups-into-google-cloud-storage/193535/14 "2019-09-20T19:51:27Z")

</div>

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