1. 任意位置创建文件LicenseVerifier.java
package org.elasticsearch.license;
import java.nio.*;
import java.util.*;
import java.security.*;
import org.elasticsearch.common.xcontent.*;
import org.apache.lucene.util.*;
import org.elasticsearch.common.io.*;
import java.io.*;
public class LicenseVerifier{
public static boolean verifyLicense(final License license, final byte[] encryptedPublicKeyData) {
return true;
}
public static boolean verifyLicense(final License license) {
return true;
}
}
2. 编译文件(5.x不同版本根据版本不同进行改动):
如:es版本5.6.16:
javac -cp "/home/elasticsearch/elasticsearch-5.6.16/lib/elasticsearch-5.6.16.jar:/home/elasticsearch/elasticsearch-5.6.16/lib/lucene-core-6.6.1.jar:/home/elasticsearch/elasticsearch-5.6.16/plugins/x-pack/x-pack-5.6.16.jar" LicenseVerifier.java
3. 替换重现编译后的文件
(1)5.6.x版本:
a.解压5.6.x版本的x-pack-5.6.16.jar,替换编译文件
b.替换编译后的 LicenseVerifier.class文件 到x-pack-5.6.16.jar 解压后的目录下:
C. 替换压缩后的x-pack-5.6.16.jar 到es安装目录:
D. 重启elasticsearch
4申请新的license
a.根据版本选择对应的license:
https://license.elastic.co/registration
b.从邮箱下载license
更改json文件里的这两个参数
c.更新license:
curl -XPUT -u elastic 'http://127.0.0.1:9200/_xpack/license' -H "Content-Type: application/json" -d @你的json
D.重启elasticsearch