Elastic Stack 7.5.0白金版永不過期


適用版本: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
  • 實際效果圖


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM