原理介绍
我们平时为es安装x-pack组件,用elasticsearch-plugin install x-pack ,安装成功后。
1.cd $es目录/pulgins/x-pack 里面有一个x-pack-5.6.2.jar ,将jar包反编译,然后将里面的licence的程序改下。再编译成jar包。
2.再对的ES存储中license配置改下就好。
!!怕有人急用,我此处免费上传我破解的两个版本jar包,可直接使用
具体操作
1.准备好替换的license文件
#vim LicenseVerifier.java
package org.elasticsearch.license; public class LicenseVerifier { public static boolean verifyLicense( final License license, final byte [] encryptedPublicKeyData) { return true ; } public static boolean verifyLicense( final License license) { return true ; } } |
再将其编译成替换的class文件
#javac -cp "/usr/share/elasticsearch/lib/elasticsearch-5.6.2.jar:/usr/share/elasticsearch/lib/lucene-core-6.6.1.jar:/usr/share/elasticsearch/plugins/x-pack/x-pack-5.6.2.jar" LicenseVerifier.java
会成了 LicenseVerifier.class文件。
2.反编译目标jar包(注意备份)
#mkdir fanbianyi
#cp $es目录/pulgins/x-pack/x-pack-5.6.2.jar ./fanbianyi/
#cd fanbianyi
#jar -xvf x-pack-5.6.2.jar
#rm x-pack-5.6.2.jar
3.替换license的class
#cp $/LicenseVerifier.class org/elasticsearch/license/
4.编译,重新打包jar包 。替换之前的jar包。
#cd fanbianyi
#jar -cvf x-pack-5.6.2.jar ./*
#mv x-pack-5.6.2.jar /usr/share/elasticsearch/plugins/x-pack
5.重启es
6.配置新的license文件
可以自己去申请一个,它会绑定uuid,申请的license为basic版,可以管一年。我们现在要将我们的basic版,改为platinum(白金版)。可以自己去申请一个
{ "license" : { "uid" : "29f88965-81a8-4a60-b0c1-c90ff107****" , "type" : "basic" , //改成"platinum" "issue_date_in_millis" : 1547424000000 , "expiry_date_in_millis" : 1579046399999 , "max_nodes" : 100 , "issued_to" : "luo zhen (an)" , "issuer" : "Web Form" , "signature" : "AAAAAwAAAA3AJ5iBwDBhQC4/ZUfRAAABmC9ZN0hjZDBGYnVyRXpCOW5Bb3FjZDAxOWpSbTVoMVZwUzRxVk1PSmkxaktJRVl5MUYvUWh3bHZVUTllbXNPbzBUemtnbWpBbmlWRmRZb25KNFlBR2x0TXc2K2p1Y1VtMG1UQU9TRGZVSGRwaEJGUjE3bXd3LzRqZ05iLzRteWFNekdxRGpIYlFwYkJiNUs0U1hTVlJKNVlXekMrSlVUdFIvV0FNeWdOYnlESDc3MWhlY3hSQmdKSjJ2ZTcvYlBFOHhPQlV3ZHdDQ0tHcG5uOElCaDJ4K1hob29xSG85N0kvTWV3THhlQk9NL01VMFRjNDZpZEVXeUtUMXIyMlIveFpJUkk2WUdveEZaME9XWitGUi9WNTZVQW1FMG1DenhZU0ZmeXlZakVEMjZFT2NvOWxpZGlqVmlHNC8rWVVUYzMwRGVySHpIdURzKzFiRDl4TmM1TUp2VTBOUlJZUlAyV0ZVL2kvVk10L0NsbXNFYVZwT3NSU082dFNNa2prQ0ZsclZ4NTltbU1CVE5lR09Bck93V2J1Y3c9PQAAAQBhFT0+og+N5QsE7RbUkNXyNdqkBrFrd1bGH2vN10/SN+zSI9kSTAZrgKTpJcUIX6A+cbxw2/j6UngHgxhsMLsjIa/EsAbL5Dm2n0d9f/oqpJj3b7iRhlgDSw3BiyQ9QAwKDF7pahB41D1L6nrgLTxJG2mP5YApCYcLSvkSpy5SNmpWp7JvUxZvVYEPcPjOfvuX4wyrAAoUqtS2EDWz7XfduLJ0L9dthO5YzdBCB4rNxnToVd+ekwFPqbgcKPyvLpvjyi0HIjS+3X2/NQWseJ++VLCysZwDrm2qSiUS4uPbdQeja6cyNjT66SlHHc5fVofLfQX/+GKq5TKAejeKylqE" , "start_date_in_millis" : 1547424000000 //改成 3107746200000,此为2068年 } } |
curl -XPUT -u 'elastic:changeme' 'http://192.168.63.11:9205/_xpack/license?acknowledge=true' -H "Content-Type: application/json" -d @lzlicense.json