「Elasticsearch」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(同期)
 
(同じ利用者による、間の7版が非表示)
2行目: 2行目:
 
[[Category:検索]]
 
[[Category:検索]]
 
[[en:Elasticsearch]]
 
[[en:Elasticsearch]]
[[Wikipedia:ja:Elasticsearch]] より:
+
[[Wikipedia:Elasticsearch]] より:
:''[https://www.elastic.co/products/elasticsearch Elasticsearch] は [http://lucene.apache.org/ Lucene] 基盤の分散処理マルチテナント対応全文検索エンジンである。HTTP ウェブインターフェイスと自由な JSON ドキュメントを使用。Elasticsearch は Java で開発されており、Apache ライセンスで公開されているオープンソースソフトウェアである。''
+
:''[https://www.elastic.co/products/elasticsearch Elasticsearch] は [http://lucene.apache.org/ Lucene] 基盤の検索エンジンである。HTTP ウェブインターフェイスとスキーマフリーな JSON ドキュメントを備えた、分散処理マルチテナント対応全文検索エンジンを提供します。Elasticsearch は Java で開発されており、Apache ライセンスで公開されているオープンソースソフトウェアである。''
   
 
== インストール ==
 
== インストール ==
Elasticsearch は最低でも OpenJDK 7 を必要とします。[[Java]] を見てください。
+
Elasticsearch は最低でも OpenJDK 10 を必要とします。[[Java]] を見てください。
   
 
{{Pkg|elasticsearch}} パッケージを[[インストール]]してください。
 
{{Pkg|elasticsearch}} パッケージを[[インストール]]してください。
   
 
== 実行 ==
 
== 実行 ==
  +
  +
If you do not have a keystore at {{ic|/usr/share/elasticsearch/config/elasticsearch.keystore}}, you need to create one before starting Elasticsearch:
  +
  +
# elasticsearch-keystore create
   
 
{{ic|elasticsearch.service}} を[[起動]]・[[有効化]]してください。
 
{{ic|elasticsearch.service}} を[[起動]]・[[有効化]]してください。
44行目: 48行目:
 
http.port: 9200
 
http.port: 9200
   
  +
{{Warning|1=elasticsearch.service can be terminated because of memory overuse: "A process of this unit has been killed by the OOM killer."}}
* デフォルトの初期・最大メモリ使用量は以下の設定で変えられます:
 
   
  +
デフォルトの初期・最大メモリ使用量は以下の設定で変えられます:
{{hc|/etc/elasticsearch/jvm.options|2=<nowiki>
 
  +
  +
{{hc|/etc/elasticsearch/jvm.options|2=
  +
<nowiki>
 
# Xms represents the initial size of total heap space
 
# Xms represents the initial size of total heap space
 
# Xmx represents the maximum size of total heap space
 
# Xmx represents the maximum size of total heap space
   
 
-Xms128m # e.g. 256m, 1g, 2g, ..
 
-Xms128m # e.g. 256m, 1g, 2g, ..
-Xmx512m # e.g. 256m, 1g, 2g, ..</nowiki>}}
+
-Xmx512m # e.g. 256m, 1g, 2g, ..
  +
</nowiki
  +
>}}
   
  +
Reduce from 4g to 2g if you get the Linux Out-Of-Memory error.
{{Note|{{Pkg|elasticsearch}} をインストールすると {{ic|/usr/lib/sysctl.d/elasticsearch.conf}} で {{ic|vm.max_map_count}} が引き上げられます。}}
 
   
 
[https://www.elastic.co/guide/en/elasticsearch/reference/5.2/vm-max-map-count.html vm.max_map_count] のシステム上限を更新する必要があります:
 
[https://www.elastic.co/guide/en/elasticsearch/reference/5.2/vm-max-map-count.html vm.max_map_count] のシステム上限を更新する必要があります:
   
 
# sysctl -w vm.max_map_count=262144
 
# sysctl -w vm.max_map_count=262144
  +
  +
{{Note|{{Pkg|elasticsearch}} をインストールすると {{ic|/usr/lib/sysctl.d/elasticsearch.conf}} で {{ic|vm.max_map_count}} が引き上げられます。}}
   
 
== 使用方法 ==
 
== 使用方法 ==
67行目: 78行目:
   
 
ElasticSearch インスタンスやクラスタを管理する便利なツールとして [http://www.elastichq.org ElasticHQ], [https://github.com/jettro/elasticsearch-gui Elasticsearch GUI], [https://www.elastic.co/jp/products/kibana Kibana] が存在します。[[Adminer]] を使って管理することもできます。
 
ElasticSearch インスタンスやクラスタを管理する便利なツールとして [http://www.elastichq.org ElasticHQ], [https://github.com/jettro/elasticsearch-gui Elasticsearch GUI], [https://www.elastic.co/jp/products/kibana Kibana] が存在します。[[Adminer]] を使って管理することもできます。
  +
  +
== 基本的なセキュリティ ==
  +
  +
Elasticsearch 8.0 以降では、セキュリティはデフォルトで有効化・設定されています。
  +
Elasticsearch は、必須の基本的なセキュリティ機能をセットアップするための[https://www.elastic.co/guide/en/elasticsearch/reference/8.1/security-basic-setup.html ドキュメンテーション]を提供しています。

2023年8月19日 (土) 19:59時点における最新版

Wikipedia:Elasticsearch より:

ElasticsearchLucene 基盤の検索エンジンである。HTTP ウェブインターフェイスとスキーマフリーな JSON ドキュメントを備えた、分散処理マルチテナント対応全文検索エンジンを提供します。Elasticsearch は Java で開発されており、Apache ライセンスで公開されているオープンソースソフトウェアである。

インストール

Elasticsearch は最低でも OpenJDK 10 を必要とします。Java を見てください。

elasticsearch パッケージをインストールしてください。

実行

If you do not have a keystore at /usr/share/elasticsearch/config/elasticsearch.keystore, you need to create one before starting Elasticsearch:

# elasticsearch-keystore create

elasticsearch.service起動有効化してください。

curl を使って Elasticsearch にアクセスできることを確認してください: curl -X GET '<protocol>://<host>:<port>'。例:

$ curl -X GET http://127.0.0.1:9200
{
  "name" : "Sunder",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "*cluster-uuid*",
  "version" : {
    "number" : "2.4.1",
    "build_hash" : "c67dc32e24162035d18d6fe1e952c4cbcbe79d16",
    "build_timestamp" : "2016-09-27T18:57:55Z",
    "build_snapshot" : false,
    "lucene_version" : "5.5.2"
  },
  "tagline" : "You Know, for Search"
}

設定

Elasticsearch のメインの設定ファイルは /etc/elasticsearch/elasticsearch.yml です。

  • デフォルトでは Elasticsearch は誰からでもアクセスできる状態になっています。特定のホストからのアクセスだけを許可するようにすることを推奨します:
network.host: 127.0.0.1
  • デフォルトの 9200 の代わりにカスタムポートを使うことができます:
http.port: 9200
警告: elasticsearch.service can be terminated because of memory overuse: "A process of this unit has been killed by the OOM killer."

デフォルトの初期・最大メモリ使用量は以下の設定で変えられます:

/etc/elasticsearch/jvm.options
# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space

-Xms128m # e.g. 256m, 1g, 2g, ..
-Xmx512m # e.g. 256m, 1g, 2g, ..

Reduce from 4g to 2g if you get the Linux Out-Of-Memory error.

vm.max_map_count のシステム上限を更新する必要があります:

# sysctl -w vm.max_map_count=262144
ノート: elasticsearch をインストールすると /usr/lib/sysctl.d/elasticsearch.confvm.max_map_count が引き上げられます。

使用方法

Elasticsearch は REST API を使用します。詳しくは Wikipedia:ja:REST を見てください。

Talking to ElasticsearchGetting started ガイドに基本的な情報と詳しい使い方が載っています。

Elasticsearch サーバーの管理 (ドキュメントのメンテナンスや検索の実行など) は基本的に クライアント を使用して行います。お好きなプログラミング言語とのシームレスな統合が可能です。

ElasticSearch インスタンスやクラスタを管理する便利なツールとして ElasticHQ, Elasticsearch GUI, Kibana が存在します。Adminer を使って管理することもできます。

基本的なセキュリティ

Elasticsearch 8.0 以降では、セキュリティはデフォルトで有効化・設定されています。 Elasticsearch は、必須の基本的なセキュリティ機能をセットアップするためのドキュメンテーションを提供しています。