官網下載壓縮包解壓後就能夠使用bin\elasticsearch.bat
運行了,可是運行時有諸多限制,好比jdbc的部分,開源版本還不能正常使用,查看不一樣版本的功能對比。java
注意:D:\develop\
是我本機路徑,你在操做時應該修改爲你的路徑。node
1,將 D:\develop\elasticsearch-7.5.0\modules\x-pack-core\
目錄下的x-pack-core-7.5.0.jar
文件賦值一份,json
2,手動建立XPackBuild.java
和LicenseVerifier.java
兩個文件,app
LicenseVerifier.java
內容爲:curl
package org.elasticsearch.xpack.core; import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.io.PathUtils; import java.io.IOException; import java.net.URISyntaxException; import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.util.jar.JarInputStream; import java.util.jar.Manifest; public class XPackBuild { public static final XPackBuild CURRENT; static { CURRENT = new XPackBuild("Unknown", "Unknown"); } /** * Returns path to xpack codebase path */ @SuppressForbidden(reason = "looks up path of xpack.jar directly") static Path getElasticsearchCodebase() { URL url = XPackBuild.class.getProtectionDomain().getCodeSource().getLocation(); try { return PathUtils.get(url.toURI()); } catch (URISyntaxException bogus) { throw new RuntimeException(bogus); } } private String shortHash; private String date; XPackBuild(String shortHash, String date) { this.shortHash = shortHash; this.date = date; } public String shortHash() { return shortHash; } public String date() { return date; } }
LicenseVerifier.java
文件的內容爲:elasticsearch
package org.elasticsearch.license; /** * Responsible for verifying signed licenses */ public class LicenseVerifier { /** * verifies the license content with the signature using the packaged * public key * @param license to verify * @return true if valid, false otherwise */ public static boolean verifyLicense(final License license, byte[] publicKeyData) { return true; } public static boolean verifyLicense(final License license) { return true; } }
3,使用javac 編譯這兩個java文件,須要引入import的依賴,使用-cp參數,須要依賴本來的x-pack-core-7.5.0.jar
,lucene-core-8.3.0.jar
,elasticsearch-7.5.0.jar
,elasticsearch-core-7.5.0.jar
這四個jar包,對應的文件都在安裝目錄,有的在lib目錄下,有的在modules目錄下。編譯命令:ui
javac -cp "D:\develop\elasticsearch-7.5.0\modules\x-pack-core\x-pack-core-7.5.0.jar;D:\develop\elasticsearch-7.5.0\lib\lucene-core-8.3.0.jar;D:\develop\elasticsearch-7.5.0\lib\elasticsearch-7.5.0.jar;D:\develop\elasticsearch-7.5.0\lib\elasticsearch-core-7.5.0.jar" C:\Users\baibook\Desktop\XPackBuild.java javac -cp "D:\develop\elasticsearch-7.5.0\modules\x-pack-core\x-pack-core-7.5.0.jar;D:\develop\elasticsearch-7.5.0\lib\lucene-core-8.3.0.jar;D:\develop\elasticsearch-7.5.0\lib\elasticsearch-7.5.0.jar;D:\develop\elasticsearch-7.5.0\lib\elasticsearch-core-7.5.0.jar" C:\Users\baibook\Desktop\LicenseVerifier.java
而後就會在桌面產生對應的class文件。用壓縮軟件打開第1步中複製的x-pack-core-7.5.0.jar
this
將本身編譯的class文件覆蓋到上圖對應的目錄後,將該jar包與安裝目錄的進行替換,而後重啓Elasticsearch。url
4,更新許可證spa
官方申請地址: https://register.elastic.co/marvel_register
公司地址什麼課以隨便填寫,郵箱要填好,而後收到郵件,進行文件下載。 下載下來,修改裏面的內容,主要是把 "basic" 改成 "platinum" 即白金版,"expiry_date_in_millis" 這個時間戳改大點,就夠用了。
{"license":{"uid":"21213675-4eee-41fe-a3db-f0f6eb731ac0","type":"platinum","issue_date_in_millis":1578009600000,"expiry_date_in_millis":16097183999990,"max_nodes":100,"issued_to":"test bai (test)","issuer":"Web Form","signature":"AAAAAwAAAA3aGeigKUwHJNzBe9K5AAABmC9ZN0hjZDBGYnVyRXpCOW5Bb3FjZDAxOWpSbTVoMVZwUzRxVk1PSmkxaktJRVl5MUYvUWh3bHZVUTllbXNPbzBUemtnbWpBbmlWRmRZb25KNFlBR2x0TXc2K2p1Y1VtMG1UQU9TRGZVSGRwaEJGUjE3bXd3LzRqZ05iLzRteWFNekdxRGpIYlFwYkJiNUs0U1hTVlJKNVlXekMrSlVUdFIvV0FNeWdOYnlESDc3MWhlY3hSQmdKSjJ2ZTcvYlBFOHhPQlV3ZHdDQ0tHcG5uOElCaDJ4K1hob29xSG85N0kvTWV3THhlQk9NL01VMFRjNDZpZEVXeUtUMXIyMlIveFpJUkk2WUdveEZaME9XWitGUi9WNTZVQW1FMG1DenhZU0ZmeXlZakVEMjZFT2NvOWxpZGlqVmlHNC8rWVVUYzMwRGVySHpIdURzKzFiRDl4TmM1TUp2VTBOUlJZUlAyV0ZVL2kvVk10L0NsbXNFYVZwT3NSU082dFNNa2prQ0ZsclZ4NTltbU1CVE5lR09Bck93V2J1Y3c9PQAAAQBe9NVefXJFn90DlQlM/EEFWO0MQ+uqXnzyfZ0GlK1dArPd22pTCy6muKo0F8s9fA3iJVczxucdHs5g99vRX4x4cNsQSzFeOIc+Xx/d94ZRIfd92jEelpgjrg9zQMVbVg6It4BMboHMQGePBVleSEpXHpdBeRw+WdeyIlnatxPiDSF3wltagAzpy/ZLjcl0ihG6iV0lW+e0QlG0Xzf4c1/4wSv2Tjq3PU8DDqIvfQZN/GitS2GsnNsCtqqH5WC2oXaIKBGi3q6NoCuBI4QxJbsXhYJcPEFgUj5Fq7Xm/8Ga3c5gOUqNT4xiEtHjSQjRJd2s7kZ2dKNdU1wAJHuwiPoA","start_date_in_millis":1578009600000}}
能夠在Kibana上上傳許可證激活,也能夠用命令的方式
curl -XPUT 'http://localhost:9200/_xpack/license' -H "Content-Type: application/json" -d @license.json
命令方式 返回 {"acknowledged":true,"license_status":"valid"} 就表示續命成功了 。
在Kibana上能夠看到