sifeimeng 2020-01-23
Elasticsearch X-PACK 白金版只有 30 天试用,为了可以经常使用,特出以下教程,
特别强调,仅作学习使用!!!
官方下载页
https://www.elastic.co/cn/downloads/elasticsearch
开源仓库地址
GitHub
https://github.com/elastic/elasticsearch
Gitee(推荐,国内网速你懂的)
https://gitee.com/mirrors/elasticsearch
package org.elasticsearch.license; /** * Responsible for verifying signed licenses */ public class LicenseVerifier { /** * verifies the license content with the signature using the packaged * public key * @param license to verify * @return true if valid, false otherwise */ public static boolean verifyLicense(final License license, byte[] publicKeyData) { return true; } public static boolean verifyLicense(final License license) { return true; } }
package org.elasticsearch.xpack.core; import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.io.PathUtils; import java.io.IOException; import java.net.URISyntaxException; import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.util.jar.JarInputStream; import java.util.jar.Manifest; public class XPackBuild { public static final XPackBuild CURRENT; static { CURRENT = new XPackBuild("Unknown", "Unknown"); } /** * Returns path to xpack codebase path */ @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 bogus) { throw new RuntimeException(bogus); } } private String shortHash; private String date; XPackBuild(String shortHash, String date) { this.shortHash = shortHash; this.date = date; } public String shortHash() { return shortHash; } public String date() { return date; } }
javac -cp "/elasticsearch-7.4.1/lib/elasticsearch-7.4.1.jar:/elasticsearch-7.4.1/lib/lucene-core-8.2.0.jar:/elasticsearch-7.4.1/modules/x-pack-core/x-pack-core-7.4.1.jar" LicenseVerifier.java javac -cp "/elasticsearch-7.4.1/lib/elasticsearch-7.4.1.jar:/elasticsearch-7.4.1/lib/lucene-core-8.2.0.jar:/elasticsearch-7.4.1/modules/x-pack-core/x-pack-core-7.4.1.jar:/elasticsearch-7.4.1/lib/elasticsearch-core-7.4.1.jar" XPackBuild.java
docker cp ./x-pack-core-7.4.0.jar 6ead3863ae82:/usr/share/elasticsearch/modules/x-pack-core
官方申请地址
https://register.elastic.co/marvel_register
收到邮件后,里面有个地址,进去后可以下载 json 格式的许可证文件。下载下来,修改里面的内容,主要是把 "basic" 改为 "platinum" 即白金版,"expiry_date_in_millis" 这个时间戳改大点,就够用了。
这是我的许可证,一直续到了 9999年12月31日:
{"license":{"uid":"4000d1b5-a06b-4d18-8501-ca3754b2c6c7","type":"platinum","issue_date_in_millis":1571875200000,"expiry_date_in_millis":253402271999000,"max_nodes":100,"issued_to":"bob mike (mikebob)","issuer":"Web Form","signature":"AAAAAwAAAA3CvX09J7V8T5tT0i55AAABmC9ZN0hjZDBGYnVyRXpCOW5Bb3FjZDAxOWpSbTVoMVZwUzRxVk1PSmkxaktJRVl5MUYvUWh3bHZVUTllbXNPbzBUemtnbWpBbmlWRmRZb25KNFlBR2x0TXc2K2p1Y1VtMG1UQU9TRGZVSGRwaEJGUjE3bXd3LzRqZ05iLzRteWFNekdxRGpIYlFwYkJiNUs0U1hTVlJKNVlXekMrSlVUdFIvV0FNeWdOYnlESDc3MWhlY3hSQmdKSjJ2ZTcvYlBFOHhPQlV3ZHdDQ0tHcG5uOElCaDJ4K1hob29xSG85N0kvTWV3THhlQk9NL01VMFRjNDZpZEVXeUtUMXIyMlIveFpJUkk2WUdveEZaME9XWitGUi9WNTZVQW1FMG1DenhZU0ZmeXlZakVEMjZFT2NvOWxpZGlqVmlHNC8rWVVUYzMwRGVySHpIdURzKzFiRDl4TmM1TUp2VTBOUlJZUlAyV0ZVL2kvVk10L0NsbXNFYVZwT3NSU082dFNNa2prQ0ZsclZ4NTltbU1CVE5lR09Bck93V2J1Y3c9PQAAAQCQmJJzPPt4L/B3VQzRKxSp3Krg6sDfnsnoxSW4Tp2YeH19wfa8fpKaEifYlLTT8PvpExGLyR+STnYv1qI5D9Uhi9jT4THDR5mKasfYvqk/Mz5MLedNCw+Yt/r4u7EC5bFMA0uZis4B+3VqTDrWEvcc1fRyOvjzh2tE29vYDhfUaqTJGXp9VXMooXGx7ZaNy9mIxP4J2ywgtfvj4qFFZeg8ZYUsvAki3Mk4QTiTcSZc3OT9+ZVtO1/3OXpHANmy69ENqpayoJOm3UvRaWkR0ksIzgZkGF5m0S/2iNeFs5OfoBvbjpNcsGRxo/uqIi4fW3J2b/gfaP3DFh1IINK+5Md4","start_date_in_millis":1571875200000}}
你可以在 Kibana UI 上传许可证激活,也可以用命令的方式:
# 建一个文件命名为 license.json,里面放上面的 json 字符串 curl -XPUT 'http://localhost:9200/_xpack/license' -H "Content-Type: application/json" -d @license.json
返回 {"acknowledged":true,"license_status":"valid"} 就表示续命成功了。
为了避免有的童鞋激活失败,另附绿色文件下载地址
https://files-cdn.cnblogs.com/files/James-1024/elasticsearchxpack.rar
另外一部分,则需要先做聚类、分类处理,将聚合出的分类结果存入ES集群的聚类索引中。数据处理层的聚合结果存入ES中的指定索引,同时将每个聚合主题相关的数据存入每个document下面的某个field下。