1. 程式人生 > 實用技巧 >elasticsearch-keystore 命令簡單解釋

elasticsearch-keystore 命令簡單解釋

elasticsearch-keystore 命令解釋

命令用途

有一些比較敏感的ES配置引數僅僅通過檔案系統的許可權保護是不夠的,ES推出了keystore來做進一步的加密保護。

命令用法

  • 新建

    • 高版本的可以通過 -p 引數指定keystore的加密密碼
    # keystore的儲存檔案放在elasticsearch.yml的同級目錄
    # 如:/elasticsearch-7.2.0/config/elasticsearch.keystore
    
    ./elasticsearch-keystore create
    
  • 新增配置引數

    ./elasticsearch-keystore add s3.client.default.secret_key
    
  • 刪除配置引數

    ./elasticsearch-keystore remove s3.client.default.secret_key
    
  • 列出配置引數

    ./elasticsearch-keystore list
    

哪些引數可以新增到keystore

Elasticseach官方文件引數配置項明確添加了Secure 備註的,如:

s3.client.default.secret_key(Secure,reloadable)

如何使keystore中的引數生效

  • 重啟Elasticsearch

  • 對於reloadable的引數使用reloadapi:

    POST _nodes/reload_secure_settings
    {
      # 如果create 時用-p 指定了密碼,否則不用寫
      "secure_settings_password": "s3cr3t" 
    }
    

注意事項

使用keystore新增引數時,keystore沒對新增的引數做校驗,對於不合法的(沒有plugin或者es本身用到的引數)會導致Elasticsearch啟動失敗。