Elasticsearch集群验证(2): 引入Elasticsearch 8.x

[上次] Elasticsearch集群验证(1): 在Hyper-V上构建3台AlmaLinux服务器

首先

我們將使用相同的步驟,在之前準備好的三台AlmaLinux伺服器上安裝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を登録
[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自動作成設定を最終行に追加
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(节点2)上安装Elasticsearch。

步骤与上述相同。

在阿尔马Linux8-3节点3的虚拟机上安装Elasticsearch。

步骤与上述相同。

结束时

我在三台服务器上分别安装了Elasticsearch。
下次会进行集群设置。敬请期待。

下一次,Elasticsearch集群验证(3): Elasticsearch 8.x的集群化(不支持HTTPS)。