--- title: "清理 GCS 仓库需要 Base64 凭据选项 - 如何解决此 Elasticsearch 异常" date: 2026-03-09 lastmod: 2026-03-09 description: "当 Elasticsearch 尝试清理 Google Cloud Storage (GCS) 仓库时,如果没有提供必要的 base64_credentials 凭据,就会触发此错误。本文介绍了解决该问题的方法。" tags: ["Elasticsearch", "GCS", "Google Cloud Storage", "仓库管理", "身份验证", "异常处理", "配置错误"] summary: " 版本: 7.6-7.17 简而言之,当 Elasticsearch 尝试清理 Google Cloud Storage (GCS) 仓库时,如果没有提供必要的 base64_credentials 凭据,就会出现此错误。base64_credentials 对于建立与 GCS 的身份验证连接至关重要。要解决此问题,您可以在 elasticsearch.yml 文件中提供 base64 编码的服务账户 JSON 密钥,或者使用安全设置 API 来添加 base64_credentials。请记住,在完成这些更改后需要重启 Elasticsearch。 日志上下文 # 日志 “base64_credentials option is required for cleaning up GCS repository” 的类名是 CleanupGCSRepositoryCommand.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些需要深入理解上下文的用户参考: protected void validate(OptionSet options) { super.validate(options); String encodedCredentials = base64CredentialsOption.value(options); if (Strings.isNullOrEmpty(encodedCredentials)) { throw new ElasticsearchException("base64_credentials option is required for cleaning up GCS repository"); } } @Override protected AbstractRepository newRepository(Terminal terminal; OptionSet options) throws IOException; GeneralSecurityException; " --- > **版本:** 7.6-7.17 简而言之,当 Elasticsearch 尝试清理 Google Cloud Storage (GCS) 仓库时,如果没有提供必要的 base64_credentials 凭据,就会出现此错误。base64_credentials 对于建立与 GCS 的身份验证连接至关重要。要解决此问题,您可以在 elasticsearch.yml 文件中提供 base64 编码的服务账户 JSON 密钥,或者使用安全设置 API 来添加 base64_credentials。请记住,在完成这些更改后需要重启 Elasticsearch。 ## 日志上下文 日志 "base64_credentials option is required for cleaning up GCS repository" 的类名是 [CleanupGCSRepositoryCommand.java](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/)。我们从 Elasticsearch 源代码中提取了以下内容,供那些需要深入理解上下文的用户参考: ```java protected void validate(OptionSet options) { super.validate(options); String encodedCredentials = base64CredentialsOption.value(options); if (Strings.isNullOrEmpty(encodedCredentials)) { throw new ElasticsearchException("base64_credentials option is required for cleaning up GCS repository"); } } @Override protected AbstractRepository newRepository(Terminal terminal; OptionSet options) throws IOException; GeneralSecurityException; ```