elasticsearch证书过期进行更换

es配置文件

xpack.security.enabled: true
xpack.security.enrollment.enabled: true
cluster.initial_master_nodes: ["iZ8vb6tda6e8mwssfo6usfZ"]
http.host: 0.0.0.0
path:
  data: /usr/sftp/file/es-data  #数据路径
  logs: /usr/sftp/file/es-data/logs   #日志路径


# ====== CERT FIX START (自动生成于 2025年 06月 17日 星期二 09:32:38 CST) ======
# 传输层SSL配置
xpack.security.transport.ssl:
  enabled: true
  verification_mode: certificate
  keystore.path: certs/elasticsearch-cert.p12
  truststore.path: certs/truststore.jks
  keystore.type: PKCS12
  truststore.type: JKS
  truststore.password: changeit
# HTTP层SSL配置
xpack.security.http.ssl:
  enabled: true
  verification_mode: certificate
  keystore.path: certs/elasticsearch-cert.p12
  truststore.path: certs/truststore.jks
  keystore.type: PKCS12
  truststore.type: JKS
  truststore.password: changeit
# ====== CERT FIX END ======

一键生成脚本

#!/bin/bash

# =============================================================================
# Elasticsearch 单机版 SSL 证书修复工具 (适用于 OpenSSL 1.0)
# 版本:3.4 | 日期:2025-06-17
# ============================================================================= 

# --------------------------------------
# 颜色输出函数(必须放在最前)
# --------------------------------------
function status_msg() {
   
    echo -e "\e[1;32m[✓] $1\e[0m"; }
function warning_msg() {
   
    echo -e "\e[1;33m[!] $1\e[0m"; }
function error_msg() {
   
    echo -e "\e[1;31m[✗] $1\e[0m"
### 解决Elasticsearch证书过期问题 对于Elasticsearch 7.x版本,在遇到证书过期的情况下,可以采取一系列措施来更新或替换已过期证书。具体操作如下: #### 删除原有许可证 当面对证书失效的情况时,第一步应当移除旧有的许可文件。这可以通过发送DELETE请求到`_license`端点实现: ```bash curl -X DELETE "localhost:9200/_license?pretty" ``` 此命令会清除当前节点上的现有许可证配置[^1]。 #### 启动基础版许可证 如果只是希望重新激活基本功能而无需处理复杂的SSL/TLS设置,则可以直接启动内置的基础版许可证: ```bash curl -X POST "localhost:9200/_license/start_basic" ``` 该指令能够立即启用Basic级别的服务权限,并自动延长至下一个默认期限结束前[^4]。 #### 使用API提交新许可证 针对更高级别的需求或是自定义签发的新证书,可通过POST请求向集群上传新的许可证JSON对象。注意这里的字段需依据实际情况调整,特别是`uid`, `issue_date_in_millis`, 和 `expiry_date_in_millis`等时间戳参数应反映最新的颁发日期和有效期范围: ```json { "licenses": [ { "uid":"<your_unique_identifier>", "type":"basic", "issue_date_in_millis":<current_time>, "expiry_date_in_millis":<future_expiry_time>, "max_nodes":1, "issued_to":"<entity_name>", "issuer":"<issuing_entity>", "signature":"<digital_signature>" } ] } ``` 上述过程中的某些细节可能依赖于特定部署环境下的差异,因此建议参照官方指南完成最终实施[^3]。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值