Hello!
I'm trying to configure the service auth of my Google Cloud bucket on Elasticsearch. My intention is to create a snapshot of my cluster in the bucket.
I'm following this tutorial from the Elastic documentation.
But I'm getting stuck on the part that I must store the .json file with elasticsearch keystore. I have created a custom elasticsearch docker image to install the gcs plugin and also copy the credential file to my container.
On my docker file, I call a custom script to perform the process describe above. So my .sh file has this peace of code:
/usr/share/elasticsearch/bin/elasticsearch-plugin install repository-gcs
cat /usr/share/elasticsearch/config/my_certificate_gcs.json | /usr/share/elasticsearch/bin/elasticsearch-keystore add --stdin gcs.client.default.credentials_file
The second part is related to the tutorial I'm following to... But when I try to run the pod (I'm using Kubernetes), I gives me the following error:
[2018-08-02T23:27:12,608][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [es-data-6f7797fcb5-wqvr8] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: failed to load plugin class [org.elasticsearch.repositories.gcs.GoogleCloudStoragePlugin]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:125) ~[elasticsearch-6.1.3.jar:6.1.3]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:112) ~[elasticsearch-6.1.3.jar:6.1.3]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.1.3.jar:6.1.3]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.1.3.jar:6.1.3]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.1.3.jar:6.1.3]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-6.1.3.jar:6.1.3]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:85) ~[elasticsearch-6.1.3.jar:6.1.3]
Caused by: java.lang.IllegalStateException: failed to load plugin class [org.elasticsearch.repositories.gcs.GoogleCloudStoragePlugin]
at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:452) ~[elasticsearch-6.1.3.jar:6.1.3]
at org.elasticsearch.plugins.PluginsService.loadBundles(PluginsService.java:392) ~[elasticsearch-6.1.3.jar:6.1.3]
at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:142) ~[elasticsearch-6.1.3.jar:6.1.3]
at org.elasticsearch.node.Node.<init>(Node.java:302) ~[elasticsearch-6.1.3.jar:6.1.3]
at org.elasticsearch.node.Node.<init>(Node.java:245) ~[elasticsearch-6.1.3.jar:6.1.3]
at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:212) ~[elasticsearch-6.1.3.jar:6.1.3]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:212) ~[elasticsearch-6.1.3.jar:6.1.3]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:322) ~[elasticsearch-6.1.3.jar:6.1.3]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) ~[elasticsearch-6.1.3.jar:6.1.3]
... 6 more
Caused by: java.lang.IllegalStateException: Secret setting gcs.client.default.credentials_file is not a file
at org.elasticsearch.common.settings.KeyStoreWrapper.getFile(KeyStoreWrapper.java:365) ~[elasticsearch-6.1.3.jar:6.1.3]
at org.elasticsearch.common.settings.SecureSetting$SecureFileSetting.getSecret(SecureSetting.java:192) ~[elasticsearch-6.1.3.jar:6.1.3]
at org.elasticsearch.common.settings.SecureSetting$SecureFileSetting.getSecret(SecureSetting.java:182) ~[elasticsearch-6.1.3.jar:6.1.3]
at org.elasticsearch.common.settings.SecureSetting.get(SecureSetting.java:93) ~[elasticsearch-6.1.3.jar:6.1.3]
at org.elasticsearch.repositories.gcs.GoogleCloudStorageService.loadClientCredentials(GoogleCloudStorageService.java:168) ~[?:?]
at org.elasticsearch.repositories.gcs.GoogleCloudStoragePlugin.<init>(GoogleCloudStoragePlugin.java:118) ~[?:?]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:?]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_161]
at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:445) ~[elasticsearch-6.1.3.jar:6.1.3]
at org.elasticsearch.plugins.PluginsService.loadBundles(PluginsService.java:392) ~[elasticsearch-6.1.3.jar:6.1.3]
at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:142) ~[elasticsearch-6.1.3.jar:6.1.3]
at org.elasticsearch.node.Node.<init>(Node.java:302) ~[elasticsearch-6.1.3.jar:6.1.3]
at org.elasticsearch.node.Node.<init>(Node.java:245) ~[elasticsearch-6.1.3.jar:6.1.3]
at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:212) ~[elasticsearch-6.1.3.jar:6.1.3]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:212) ~[elasticsearch-6.1.3.jar:6.1.3]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:322) ~[elasticsearch-6.1.3.jar:6.1.3]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) ~[elasticsearch-6.1.3.jar:6.1.3]
... 6 more
If I remove cat /usr/share/elasticsearch/config/my_certificate_gcs.json | /usr/share/elasticsearch/bin/elasticsearch-keystore add --stdin gcs.client.default.credentials_file
, the service starts with no problem.
Does anyone know how I can solve this problem or point me to a solution in the docs?