适用版本:7.4.0~7.5.0

警告:本文章仅限于学习,非商业用途。

  • 目录结构
# 先创建相关目录,具体结构如下:
/opt
|-- bulid # 编译目录
| |- src
|-- install # 存放tar.gz安装包文件
|-- src # 存放源码文件 mkdir -p /opt/build/src
mkdir -p /opt/install
mkdir -p /opt/src
  • 下载安装包
cd /opt/install
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.5.0-linux-x86_64.tar.gz
tar zxvf elasticsearch-7.5.0-linux-x86_64.tar.gz
cd .. # 返回到/opt目录
  • 下载源码
cd /opt/src
# 官方github地址:https://github.com/elastic/elasticsearch
# 国内码云地址:https://gitee.com/mirrors/elasticsearch # 建议使用国内码云地址,选择好跟安装包同版本的tags,然后clone源码
git clone https://gitee.com/mirrors/elasticsearch.git cd .. # 返回到/opt目录
  • 编译x-pack包
cd /opt/bulid

# lib module
ln -s ../install/elasticsearch-7.5.0/lib .
ln -s ../install/elasticsearch-7.5.0/modules . # License.java
find ../src -name "License.java" | xargs -r -I {} cp {} .
sed -i 's#this.type = type;#this.type = "platinum";#g' License.java
sed -i 's#validate();#// validate();#g' License.java # 编译
javac -cp "`ls lib/elasticsearch-7.5.0.jar`:`ls lib/elasticsearch-x-content-7.5.0.jar`:`ls lib/lucene-core-*.jar`:`ls modules/x-pack-core/x-pack-core-7.5.0.jar`" License.java # x-pack-core-7.5.0.jar
cd /opt/bulid/src
find ../../install -name "x-pack-core-7.5.0.jar" | xargs -r -I {} cp {} .
jar xvf x-pack-core-7.5.0.jar
rm -f x-pack-core-7.5.0.jar
\cp -f ../License*.class org/elasticsearch/license/
jar cvf x-pack-core-7.5.0.jar . cd .. # 返回到/opt目录
  • 覆盖x-pack-core-7.5.0.jar
# 把编译后的x-pack-core-7.5.0.jar文件覆盖到安装目录下
# 路径根据实际情况而定
cp /opt/build/src/x-pack-core-7.5.0.jar /usr/share/elasticsearch/modules/x-pack-core/
  • 初始化elasticsearch密码
# 前提:elasticsearch是运行状态
# 记住账号和密码,kibana配置需要用 # ./bin/elasticsearch-setup-passwords interactive Initiating the setup of passwords for reserved users elastic,apm_system,kibana,logstash_system,beats_system,remote_monitorin_user.
You will be prompted to enter passwords as the process progresses.
Please confirm that you would like to continue [y/N]y Enter password for [elastic]:
Reenter password for [elastic]:
Enter password for [apm_system]:
Reenter password for [apm_system]:
Enter password for [kibana]:
Reenter password for [kibana]:
Enter password for [logstash_system]:
Reenter password for [logstash_system]:
Enter password for [beats_system]:
Reenter password for [beats_system]:
Enter password for [remote_monitoring_user]:
Reenter password for [remote_monitoring_user]:
Changed password for user [apm_system]
Changed password for user [kibana]
Changed password for user [logstash_system]
Changed password for user [beats_system]
Changed password for user [remote_monitoring_user]
Changed password for user [elastic]
  • 配置重启elasticsearch
# 配置
# 这一步主要是操作elasticsearch.yml文件,路径根据实际情况而定 sed -i '$a\xpack.security.enabled: true\nxpack.security.transport.ssl.enabled: true\n' /usr/share/elasticsearch/config/elasticsearch.yml # 效果
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true # 重启。根据实际情况而定
systemctl restart elasticsearch
  • 配置重启kibana
# 配置
# 这一步主要是操作kibana.yml文件,路径根据实际情况而定
sed -i '$a\elasticsearch.username: kibana\nelasticsearch.password: changeme\n' /usr/share/kibana/config/kibana.yml # 效果,配置上一步的账号密码
elasticsearch.username: elastic
elasticsearch.password: elastic123 # 重启kibana
systemctl restart kibana
  • 实际效果图

最新文章

  1. Android—9.png的制作和去除黑线
  2. python datatime
  3. ing
  4. hope is a good thing!
  5. Delphi版浏览器(持续更新)
  6. 为TListBox添加水平滚动条
  7. [iOS基础控件 - 4.6] iOS开发中的长度单位
  8. 基于node/mongo的App Docker化测试环境搭建
  9. WCF默认实例的解读
  10. [hystar整理]Entity Framework 教程
  11. WTF小程序之wxs
  12. Mac下部署Ionic环境
  13. lesson4Embedding-fastai
  14. Visual Studio中设置Nuget程序包源
  15. MyEclipse WebSphere开发教程:安装和更新WebSphere 6.1, JAX-WS, EJB 3.0(五)
  16. 深入PHP内核之数组
  17. linux性能系列--内存
  18. 《深入理解Java虚拟机》笔记--第三章 、垃圾收集器与内存分配策略
  19. margin padding 图
  20. open() 函数以 r+ 模式打开文件

热门文章

  1. Linux shell awk逻辑控制语句
  2. springBoot配置druid监控报错Failed to bind properties under 'spring.datasource.druid' to javax.sql.DataSource
  3. NOIp常用的算法
  4. PAT 乙级 1021.个位数统计 C++/Java
  5. 第10节-BLE协议链路层(LL)
  6. opencart卸载语言包要记得在后台进行设置否则会出错
  7. VS 编译总是出现错误: "LC.EXE 已退出,代码为-1"
  8. Scrapy笔记09- 部署
  9. java spring框架的定时任务
  10. Json、Pickle