「Elasticsearch」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(→‎設定: add Warning.)
(→‎設定: 記事を追加。)
50行目: 50行目:
 
{{Warning|1=elasticsearch.service can be terminated because of memory overuse: "A process of this unit has been killed by the OOM killer."}}
 
{{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}} が引き上げられます。}}
   
 
== 使用方法 ==
 
== 使用方法 ==

2022年4月1日 (金) 10:09時点における版

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 を使って管理することもできます。

Basic Security

Security is enabled and configured by default in Elasticsearch 8.0 and later. Elasticsearch provides documentation to set up the mandatory basic security feature.