5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Elasticsearchクラスタ検証(2): Elasticsearch 8.xを導入

Last updated at Posted at 2022-08-07
[前回] Elasticsearchクラスタ検証(1): Hyper-VにAlmaLinuxサーバー3台構築

はじめに

前回用意した、AlmaLinuxサーバー3台に、
同じ手順でElasticsearch 8.xを導入します。

  • AlmaLinux8-1(node1)
  • AlmaLinux8-2(node2)
  • AlmaLinux8-3(node3)

仮想マシンAlmaLinux8-1(node1)に、Elasticsearchパッケージ導入

端末を開き、管理者権限で以下実行。

  • EslasticsearchリポジトリのGPG keyをインポート
# rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
  • rpm repositoryを登録
/etc/yum.repos.d/elasticsearch.repo
[elasticsearch]
name=Elasticsearch repository for 8.x packages
baseurl=https://artifacts.elastic.co/packages/8.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=0
autorefresh=1
type=rpm-md
  • Elasticsearchパッケージをインストール
# dnf check-update --enablerepo=elasticsearch
# dnf install elasticsearch --enablerepo=elasticsearch -y

Elasticsearchの設定

  • Elasticsearchをサービスとして有効化
# systemctl enable elasticsearch
Created symlink /etc/systemd/system/multi-user.target.wants/elasticsearch.service → /usr/lib/systemd/system/elasticsearch.service.
  • Elasticsearch設定ファイルを開き、index自動作成設定を最終行に追加
/etc/elasticsearch/elasticsearch.yml
action.auto_create_index: .monitoring*,.watches,.triggered_watches,.watcher-history*,.ml*

Elasticsearchのユーザーパスワードをリセット

  • Elasticsearchを起動
# systemctl start elasticsearch
  • elasticユーザーのパスワードをリセット
# /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic -i
This tool will reset the password of the [elastic] user.
You will be prompted to enter the password.
Please confirm that you would like to continue [y/N]y
Enter password for [elastic]:
Re-enter password for [elastic]:
Password for the [elastic] user successfully reset.

Elasticsearchの起動確認

# curl -k -u elastic https://localhost:9200
Enter host password for user 'elastic':
{
  "name" : "node1",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "ksn5SqyVRQK4I1RWKKp95w",
  "version" : {
    "number" : "8.3.3",
    "build_flavor" : "default",
    "build_type" : "rpm",
    "build_hash" : "801fed82df74dbe537f89b71b098ccaff88d2c56",
    "build_date" : "2022-07-23T19:30:09.227964828Z",
    "build_snapshot" : false,
    "lucene_version" : "9.2.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

仮想マシンAlmaLinux8-2(node2)に、Elasticsearch導入

手順は上記と同じ。

仮想マシンAlmaLinux8-3(node3)に、Elasticsearch導入

手順は上記と同じ。

おわりに

Elasticsearchを、サーバー3台にそれぞれ導入しました。
次回はクラスタ設定を行います。お楽しみに。

[次回] Elasticsearchクラスタ検証(3): Elasticsearch 8.xのクラスタ化(HTTPS未対応)
5
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?