- 离线下载安装包地址https://artifacts.elastic.co/downloads/packs/x-pack/x-pack-5.6.4.zip
- 默认kibana登录账号密码:elastic/changeme
操作步骤
- /opt/elasticsearch-5.6.4/bin/elasticsearch-plugin install file:///opt/x-pack-5.6.4.zip
- 如果不需要该插件,也可以通过非常简单的方式删除 bin/elasticsearch-plugin remove x-pack
- 安装后找到/opt/elasticsearch-5.6.4/plugins/x-pack/x-pack-5.6.4.jar
- 直接在linux上机器上操作解压(jar -xvf x-pack-5.6.4.jar),在windows机器上使用Luyten(下载地址:https://github.com/deathmarine/Luyten/releases/tag/v0.5.0)进行反编译
- 使用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;
}
}
-
上传文件到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 -
替换原有文件并重新打包
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 ./* -
替换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 -
申请一个免费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配置文件索引需加上用户名密码


860

被折叠的 条评论
为什么被折叠?



