8
3

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で見る検索エンジンの仕組み(1): Elasticsearchインストール編

Last updated at Posted at 2022-07-02

はじめに

数年前、全文検索システムApache SolrElasticsearchを使って以来、
検索エンジンに触れる機会がほとんどありませんでした。

薄れかけた記憶を呼び起こすため、Elasticsearch検証の旅に出ます。

Apache Lucene(アパッチ ルシーン)とは

  • Java製OSSの検索ライブラリで、Apacheのトップレベルプロジェクト
  • 強力な文書インデクシング/検索機能/スペルチェック/ハイライト/テキスト解析、機能を提供

Elasticsearchとは

検証環境

  • CPU: Intel(R) Core(TM) 3.30GHz(4コア8スレッド)
  • メモリ: 16 GB
  • OS: Windows 10

Elasticsearchをインストール

  • Windows版Elasticsearchをダウンロード

  • zipを解凍し、elasticsearch-8.3.1フォルダーを作業フォルダーに移動

    • C:\es\elasticsearch-8.3.1
  • 環境変数を設定

    • ES_HOMEを追加(上記の導入フォルダー)
      • C:\es\elasticsearch-8.3.1
    • PATH%ES_HOME%\binを追加

Elasticsearchを起動

PS C:\es> elasticsearch

image.png

  • 起動メッセージ
... ...
----------------------------------------------------------------------------------------------------------> Elasticsearch security features have been automatically configured!
-> Authentication is enabled and cluster connections are encrypted.

->  Password for the elastic user (reset with `bin/elasticsearch-reset-password -u elastic`):
  xxxxxxxxxxxxxxxxxxx

->  HTTP CA certificate SHA-256 fingerprint:
  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

->  Configure Kibana to use this cluster:
* Run Kibana and click the configuration link in the terminal when Kibana starts.
* Copy the following enrollment token and paste it into Kibana in your browser (valid for the next 30 minutes):
  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

->  Configure other nodes to join this cluster:
* On this node:
  - Create an enrollment token with `bin/elasticsearch-create-enrollment-token -s node`.
  - Uncomment the transport.host setting at the end of config/elasticsearch.yml.
  - Restart Elasticsearch.
* On other nodes:
  - Start Elasticsearch with `bin/elasticsearch --enrollment-token <token>`, using the enrollment token that you generated.
---------------------------------------------------------------------------------------------------------
  • 起動メッセージで最後の部分から、以下3点控える
    • elasticユーザのパスワード: `
      • -> Password for the elastic user
    • Kibanaの登録トークン(登録後30分有効)
      • * Copy the following enrollment token
    • HTTP CA認証SHA-256フィンガープリント
      • HTTP CA certificate SHA-256 fingerprint

ブラウザからElasticsearchに接続

  • https://localhost:9200/にアクセス
    • ユーザ: elastic
    • パスワード: 上述elasticユーザのパスワード
  • 画面に、起動中Elasticsearchの情報が表示される

image.png

おわりに

Elasticsearchを簡単にインストール/起動できました。
次回は、Kibanaをインストールします。お楽しみに。

[次回] Elasticsearchで見る検索エンジンの仕組み(2): Kibanaインストール編
8
3
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
8
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?