elk之x-pack破解

  • 离线下载安装包地址https://artifacts.elastic.co/downloads/packs/x-pack/x-pack-5.6.4.zip
  • 默认kibana登录账号密码:elastic/changeme

操作步骤

  1. /opt/elasticsearch-5.6.4/bin/elasticsearch-plugin install file:///opt/x-pack-5.6.4.zip
  2. 如果不需要该插件,也可以通过非常简单的方式删除 bin/elasticsearch-plugin remove x-pack
  3. 安装后找到/opt/elasticsearch-5.6.4/plugins/x-pack/x-pack-5.6.4.jar
  4. 直接在linux上机器上操作解压(jar -xvf x-pack-5.6.4.jar),在windows机器上使用Luyten(下载地址:https://github.com/deathmarine/Luyten/releases/tag/v0.5.0)进行反编译
  5. 使用Luyten打开org.elasticsearch/license/LicenseVerifier.class先保存为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;
}
}

  1. 上传文件到linux机器,执行此命令编译得到LicenseVerifier.class文件
    javac -cp “/opt/elasticsearch-5.6.4/lib/elasticsearch-5.6.4.jar:/opt/elasticsearch-5.6.4/lib/lucene-core-6.6.1.jar:/opt/elasticsearch-5.6.4/plugins/x-pack/x-pack-5.6.4.jar” LicenseVerifier.java

  2. 替换原有文件并重新打包
    mkdir /opt/123
    cd /opt/123
    cp /opt/elasticsearch-5.6.4/plugins/x-pack/x-pack-5.6.4.jar /opt/123/
    jar -xvf x-pack-5.6.4.jar
    mv … /LicenseVerifier.class org/elasticsearch/license/
    jar -cvf x-pack-5.6.4.jar ./*

  3. 替换elasticsearch安装包 并重启es
    cp x-pack-5.6.4.jar /opt/elasticsearch-5.6.4/plugins/x-pack/
    /opt/elasticsearch-5.6.4/bin/elasticsearch -d

  4. 申请一个免费license
    https://register.elastic.co/xpack_register
    收到邮件 下载对应的 json文件,修改如下type为 platinum表示白金版,可以使用所有功能。其他的如expiry_date_in_millis、max_nodes等根据自己需要修改即可
    在这里插入图片描述
    10.导入证书,集群中的每台 Elasticsearch 都是需要执行,同时记得文件前面的 @ 符号,因为是免费授权,才需要加上 acknowledge=true 参数
    curl -XPUT -u ‘elastic:changeme’ ‘http://192.168.10.6:9200/_xpack/license?acknowledge=true’ -H “Content-Type: application/json” -d @/opt/xxx-b13dabfa-e6d3-46a6-af2d-b5f59d2beb8a-v5.json

11.修改elasticsearch密码:

curl -XPUT -u elastic ‘192.168.10.6:9200/_xpack/security/user/elastic/_password’ -d ‘{
“password” : “elastic”
}’

常见故障

启动kibana时,会使得本来已启动的elasticsearch给关闭!而且报空指针异常’

  • jar包替换错误,不要下载到window中利用好压进行替换

logstash 启动日志显示 exception=>#<LogStash::Json::ParserError: Unrecognized character escape ‘x’ (code 120)报错信息说明:Unrecognized character escape ‘x’,意思:无法识别的字符转义 ‘x’

  • 使用mutte对\x字符串进行替换,在json化之前,使用$uri 可以在nginx对URL进行更改或重写,但是用于日志输出可以使用$request_uri代替
  • filter {
    mutate {
    gsub => [“message”, “\x”, “\\x”]
    }

安装x-pack重启后发现 Logstash 无法连接 ES,日志显示
[2017-02-22T17:55:01,157][INFO ][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=>http://logstash_system:xxxxxx@localhost:9200/, :path=>"/"}
[2017-02-22T17:55:01,160][WARN ][logstash.outputs.elasticsearch] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>#<URI::HTTP:0x100f9cb3 URL:http://logstash_system:xxxxxx@localhost:9200/_xpack/monitoring/?system_id=logstash&system_api_version=2&interval=1s>, :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :error=>“Elasticsearch Unreachable: [http://logstash_system:xxxxxx@localhost:9200/][Manticore::SocketException] Connection refused”}

  • 尝试确认 ES 是否可用:curl -u elastic:changeme http://172.16.134.2:9200
    如果OK,则是没有通过 Logstash 的 X-Pack 验证 Monitoring Logstash,所以需要修改配置 logstash.yml:
    xpack.monitoring.elasticsearch.url: “http://192.168.10.6:9200
    xpack.monitoring.elasticsearch.username: “elastic”
    xpack.monitoring.elasticsearch.password: “changeme”
    重启 Logstash 后问题解决。
  • 安装x-pack后原有的logstash配置文件索引需加上用户名密码
  • 在这里插入图片描述
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小白正在飞

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值