--- title: "当传输层启用TLS时无法集群范围更新安全设置 - 如何解决此Elasticsearch异常" date: 2026-03-06 lastmod: 2026-03-06 description: "当传输层未启用TLS时,尝试在集群范围内更新安全设置会导致此Elasticsearch异常。" tags: ["安全设置", "TLS", "传输层", "集群配置"] summary: "版本: 7.7-7.15 简而言之,当您尝试在集群范围内更新安全设置,但传输层的传输层安全(TLS)未启用时,会出现此错误。Elasticsearch 需要 TLS 来实现安全通信。要解决此问题,您可以在 Elasticsearch 配置文件(elasticsearch.yml)中通过将 xpack.security.transport.ssl.enabled 设置为 true 来启用传输层的 TLS。或者,您也可以在每个节点上单独更新安全设置,但这效率较低且更容易出错。 日志上下文 # 日志 “Secure settings cannot be updated cluster wide when TLS for the transport layer” 的类名是 TransportNodesReloadSecureSettingsAction.java。 我们从 Elasticsearch 源代码中提取了以下内容,为那些寻求深入上下文的人提供参考: protected void doExecute(Task task; NodesReloadSecureSettingsRequest request; ActionListenerlistener) { if (request.hasPassword() && isNodeLocal(request) == false && isNodeTransportTLSEnabled() == false) { request.closePassword(); listener.onFailure( new ElasticsearchException("Secure settings cannot be updated cluster wide when TLS for the transport layer" + " is not enabled." --- > **版本:** 7.7-7.15 简而言之,当您尝试在集群范围内更新安全设置,但传输层的传输层安全(TLS)未启用时,会出现此错误。Elasticsearch 需要 TLS 来实现安全通信。要解决此问题,您可以在 Elasticsearch 配置文件(elasticsearch.yml)中通过将 `xpack.security.transport.ssl.enabled` 设置为 `true` 来启用传输层的 TLS。或者,您也可以在每个节点上单独更新安全设置,但这效率较低且更容易出错。 ## 日志上下文 日志 "Secure settings cannot be updated cluster wide when TLS for the transport layer" 的类名是 [TransportNodesReloadSecureSettingsAction.java。](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/) 我们从 Elasticsearch 源代码中提取了以下内容,为那些寻求深入上下文的人提供参考: ```java protected void doExecute(Task task; NodesReloadSecureSettingsRequest request; ActionListenerlistener) { if (request.hasPassword() && isNodeLocal(request) == false && isNodeTransportTLSEnabled() == false) { request.closePassword(); listener.onFailure( new ElasticsearchException("Secure settings cannot be updated cluster wide when TLS for the transport layer" + " is not enabled. Enable TLS or use the API with a `_local` filter on each node.")); } else { super.doExecute(task; request; ActionListener.wrap(response -> { request.closePassword(); listener.onResponse(response); ```