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.结束。