一分钟开启Elastic白金版

前提:假设你已经通过deb的方式部署了elasticsearch

下载源码文件

curl -o LicenseVerifier.java -s https://raw.githubusercontent.com/elastic/elasticsearch/8.3/x-pack/plugin/core/src/main/java/org/elasticsearch/license/LicenseVerifier.java
curl -o XPackBuild.java -s https://raw.githubusercontent.com/elastic/elasticsearch/8.3/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackBuild.java

根据自己的版本进行修改,如 8.3 -> 8.4, 忽略小版本

修改LicenseVerifier.java

public static boolean verifyLicense(final License license, PublicKey publicKey) {
    return true;
}

修改XPackBuild.java

Path path = getElasticsearchCodebase();
shortHash = "Unknown";
date = "Unknown";
CURRENT = new XPackBuild(shortHash, date);

编译:

/usr/share/elasticsearch/jdk/bin/javac  -cp "/usr/share/elasticsearch/lib/*:/usr/share/elasticsearch/modules/x-pack-core/*" LicenseVerifier.java
/usr/share/elasticsearch/jdk/bin/javac  -cp "/usr/share/elasticsearch/lib/*:/usr/share/elasticsearch/modules/x-pack-core/*" XPackBuild.java

替换:

cp /usr/share/elasticsearch/modules/x-pack-core/x-pack-core-8.3.3.jar x-pack-core-8.3.3.jar
unzip x-pack-core-8.3.3.jar -d ./x-pack-core-8.3.3
cp LicenseVerifier.class ./x-pack-core-8.3.3/org/elasticsearch/license/
cp XPackBuild.class ./x-pack-core-8.3.3/org/elasticsearch/xpack/core/
/usr/share/elasticsearch/jdk/bin/jar -cvf x-pack-core-8.3.3.crack.jar -C x-pack-core-8.3.3 .
cp x-pack-core-8.3.3.crack.jar /usr/share/elasticsearch/modules/x-pack-core/x-pack-core-8.3.3.jar

申请证书: https://register.elastic.co/marvel_register

{
	"license": {
		"uid": "cd5c2258-7422-4f9a-a7c9-cb8d29a25361",
		"type": "platinum",
		"issue_date_in_millis": 1678665600000,
		"expiry_date_in_millis": 3207746200000,
		"max_nodes": 10000,
		"issued_to": "azi",
		"issuer": "Web Form",
		"signature": "AAAAAwAAAA1a8PJsIPdFZHe4WLkDAAABmC9ZN0hjZDBGYnVyRXpCOW5Bb3FjZDAxOWpSbTVoMVZwUzRxVk1PSmkxaktJRVl5MUYvUWh3bHZVUTllbXNPbzBUemtnbWpBbmlWRmRZb25KNFlBR2x0TXc2K2p1Y1VtMG1UQU9TRGZVSGRwaEJGUjE3bXd3LzRqZ05iLzRteWFNekdxRGpIYlFwYkJiNUs0U1hTVlJKNVlXekMrSlVUdFIvV0FNeWdOYnlESDc3MWhlY3hSQmdKSjJ2ZTcvYlBFOHhPQlV3ZHdDQ0tHcG5uOElCaDJ4K1hob29xSG85N0kvTWV3THhlQk9NL01VMFRjNDZpZEVXeUtUMXIyMlIveFpJUkk2WUdveEZaME9XWitGUi9WNTZVQW1FMG1DenhZU0ZmeXlZakVEMjZFT2NvOWxpZGlqVmlHNC8rWVVUYzMwRGVySHpIdURzKzFiRDl4TmM1TUp2VTBOUlJZUlAyV0ZVL2kvVk10L0NsbXNFYVZwT3NSU082dFNNa2prQ0ZsclZ4NTltbU1CVE5lR09Bck93V2J1Y3c9PQAAAQA+fZ30LicFouBamUw0wXUkbOsUP8p1bevJ+JsC4hWsed4ouqqJFipCa0bJJFISWzssU8BpxWQcnNE4WSSbZlSNuxzo2kGUuyE4wWyJyI7kfVpg8dm8POG0ugsIFLfgQISaFxI0MukpmGVyaukQONC9nqKSGgQ7xX2mOrnEC1tRwvBuiJT4aGulM2yMNxOB49DufwfR6w6KVZtpbbC/9BQtRVLl5Vyy/2I8F/il9q+U2J9EdGS4Gt6bW8N2GvZK4rqaPVSTxyh7YNar4IzErpfea9nYkdcgCJ9yOcZw4dCcwaTC90RTYqDIyIQ5h7ET+1Gpr9NemrrbYqfxUR2oIEmX",
		"start_date_in_millis": 1678665600000
	}
}

修改type为platinum, 修改expiry_date_in_millis过期时间

上传许可证

image-20230313173302661