主要參考了 Elasticsearch許可證過期導致ES用不了的問題
1.註冊elasticsearch賬號,註冊地址 https://register.elastic.co/
根據你填寫的郵箱,會收到一封郵件
對於linux系統 執行下列命令
curl -XPUT -u <user> 'http://<host>:<port>/_xpack/license' -H "Content-Type: application/json" -d @license.json
對於windows系統(我的就是window10)
gc .\license.json | Invoke-WebRequest -uri http://<host>:<port>/_xpack/license -Credential elastic -Method Put -ContentType "application/json"
我的樣例,注意這裏加上了 ?acknowledge=true,否則會報錯
curl -XPUT -u elastic ‘http://127.0.0.1:9200/_xpack/license?acknowledge=true’ -H “Content-Type: application/json” -d @wang-haipeng-efd72514-cf4c-401f-90ea-95c31a21c150-v5.json
<user> is a user ID with the appropriate authority. 這裏的替換爲 elastic (這裏是默認用戶)
<host> is the hostname of the Elasticsearch node (localhost if executing locally) 我的就是127.0.0.1
<port> is the http port (defaults to 9200) 我的是9200
license.json is the license JSON file (第一步下載的 許可證文件)
注意這裏url加上了 acknowledge=true,否則會報錯
如果成功,就會彈框 要求 輸入 elastic ,默認密碼 爲 changeme