24
28

More than 5 years have passed since last update.

Elasticsearchのローカル環境構築メモ

Last updated at Posted at 2015-09-01

Elasticsearchのローカル環境構築

前提条件
javaがインストールされていること

Elasticsearchをダウンロード
今回はバージョン1.7.1を使用しました。

Elasticsearchをサービス登録&起動

コマンドプロンプトを開き、Elasticsearchを保存したフォルダに移動し
下記のコマンドを実行
例)
D:\Program Files\elasticsearch\bin\service install
上記のコマンドでサービス登録が完了します。

起動する際は管理ツールのサービスから起動できます。

サービスの起動に失敗する場合は、Javaのパスとポート「9200」が使用済みではないか確認してください。

下記コマンドプロンプトから起動する場合
例)
D:/Program Files/elasticsearch/bin start

セットアップ関連コマンドはこちらから確認できます。

起動が完了したら、ブラウザでhttp://localhost:9200/にアクセスし下記の内容が表示されればOKです。

{
  "status" : 200,
  "name" : "Wrath",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "1.7.1",
    "build_hash" : "b88f43fc40b0bcd7f173a1f9ee2e97816de80b19",
    "build_timestamp" : "2015-07-29T09:54:16Z",
    "build_snapshot" : false,
    "lucene_version" : "4.10.4"
  },
  "tagline" : "You Know, for Search"
}

ElasticSearch Headのインストール

ElasticSearch Headはブラウザで動くelasticsearchのGUIになります。
インデックスの中身を表示できたり、検索クエリの作成や結果JSONの表示が行えます。

最新のソースコードはこちらで公開されています。

elasticsearchがインストールされていればプラグインコマンドでインストールができます。

例)
D:/Program Files/elasticsearch/bin/plugin -install mobz/elasticsearch-head

Windowsプロキシ環境でプラグインを入れる為のコマンドは下記のコマンドを実行する。
1.
set JAVA_OPTS="-DproxyHost=ホスト名 -DproxyPort=ポート番号"
2.例)
D:/Program Files/elasticsearch/bin/plugin --install mobz/elasticsearch-head

Linuxプロキシ環境でのプラグイン入れる際のコマンドは下記のコマンドを実行する。
/plugin -DproxyPort=ポート番号 -DproxyHost=ホスト名 -install mobz/elasticsearch-head

手動インストール

下記のコマンド実行
例)
D:/Program Files/elasticsearch/bin/plugin --install mobz/elasticsearch-head --url file:///D:/plugin/elasticsearch-head-master.zip

インストール後Elasticsearchを再起動後、下記のURLから
ElasticSearch Headが動作することを確認
http://localhost:9200/_plugin/head/


Kuromojiアナライザーのインストール

日本語辞書を備えた形態素解析プラグイン

こちらのサイトで確認すると1.7系はKuromoji2.7.0が使えるようなので2.7.0を試してみる

Windowsプロキシ環境でプラグインを入れる為のコマンドは下記のコマンドを実行する。

1.
set JAVA_OPTS="-DproxyHost=ホスト名 -DproxyPort=ポート番号"
2.例)
D:/Program Files/elasticsearch/bin/plugin --install elasticsearch/elasticsearch-analysis-kuromoji/2.7.0

Linuxプロキシ環境でのプラグイン入れる際のコマンドは下記コマンドを実行する。
/plugin -DproxyPort=ポート番号 -DproxyHost=ホスト名 --install elasticsearch/elasticsearch-analysis-kuromoji/2.7.0

手動インストール

例)
D:/Program Files/elasticsearch/bin/plugin --install elasticsearch/elasticsearch-analysis-kuromoji --url file:///D:/plugin/elasticsearch-analysis-kuromoji-2.7.0.zip

インストール確認
コマンド:plugin -l
下記のプラグインが表示されていれば正常にインストール完了
-analysis-kuromoji


inquisitorのインストール

web画面上でQueryやAnalyzerを試せるプラグイン
こちらのサイトに詳しく紹介されています

Windowsプロキシ環境でプラグインを入れる為のコマンドは下記のコマンドを実行する。

1.
set JAVA_OPTS="-DproxyHost=ホスト名 -DproxyPort=ポート番号"
2.
例)
D:/Program Files/elasticsearch/bin/bin/plugin -install polyfractal/elasticsearch-inquisitor

Linuxプロキシ環境でのプラグイン入れる際のコマンドは下記コマンドを実行する。
/plugin -DproxyPort=ポート番号 -DproxyHost=ホスト名 --install polyfractal/elasticsearch-inquisitor

インストール後Elasticsearchを再起動後、下記のURLから
ElasticSearch inquisitorが動作することを確認
http://localhost:9200/_plugin/inquisitor/#/

24
28
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
24
28