1.es下載地址
https://www.elastic.co/cn/downloads/past-releases#elasticsearch
2.編寫elasticsearch-6.8.18\modules\x-pack-core內x-pack-core-6.8.18.jar的class文件
LicenseVerifier.class內方法改為返回true,
import org.elasticsearch.license.License;
public class LicenseVerifier
{
public static boolean verifyLicense(License paramLicense, byte[] paramArrayOfByte) { return true; }
public static boolean verifyLicense(License paramLicense) { return true; }
}
XPackBuild.class內方法修改對jar包的認證。
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Path;
import org.elasticsearch.common.SuppressForbidden;
import org.elasticsearch.common.io.PathUtils;
import org.elasticsearch.xpack.core.XPackBuild;
public class XPackBuild
{
public static final XPackBuild CURRENT;
private String shortHash;
private String date;
@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 uRISyntaxException) {
throw new RuntimeException(uRISyntaxException);
}
}
XPackBuild(String paramString1, String paramString2) {
this.shortHash = paramString1;
this.date = paramString2;
}
public String shortHash() { return this.shortHash; }
public String date() { return this.date; }
static {
Path path = getElasticsearchCodebase();
String str1 = null;
String str2 = null;
str1 = "Unknown";
str2 = "Unknown";
CURRENT = new XPackBuild(str1, str2);
}
}
3.解壓jar包替換class后重新打包
jar uvf x-pack-core-6.8.18.jar -C x-pack-core-6.8.18/ .
4.官網申請授權json,郵箱填對,要收郵件
https://license.elastic.co/registration
5.下載並修改拿到的授權json
****“type”:“basic” 替換為 “type”:"platinum"
“expiry_date_in_millis”:1662163199999替換為 “expiry_date_in_millis”:3208416321000
也就是2022年的授權到2071年
5.配置es並啟動
elasticsearch.yml內新增一行內容 xpack.security.enabled: false
6.訪問es查看_license
7.導入修改后的license的json
8.再次查看_license
授權到2071年
9.配置yml文件內容
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
10.設置密碼項
bin下執行elasticsearch-setup-passwords interactive
11.頁面訪問輸入用戶名密碼
12.配置dbeaver訪問es(注意驅動版本一致)
13.結束。