Elastic Stackのバージョン7.4.0から7.5.0までの白金ライセンスを無期限にする方法について説明します。本記事は学習目的のみに使用してください。
- ディレクトリ構造
# 必要なディレクトリを作成します。 /opt |-- build # コンパイル用ディレクトリ | |- src |-- install # インストールパッケージの保存先 |-- 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 # 国内ミラーサイトを使用し、インストールパッケージと同じバージョンのタグを選択してソースコードをクローンします。 git clone https://gitee.com/mirrors/elasticsearch.git cd .. # /optディレクトリに戻る- x-packのビルド
cd /opt/build
# libモジュール
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/build/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_monitoring_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