金融系ITストラテジストのブログ

金融とはおよそ関係のないおもにデジタルガジェットに関する記事を書きます。

Elasticsearchのpluginにpathを通す方法

このブログは以下の場所に移転しました。

 ElasticSearchのプラグインをインストール際に使用するpluginに、あらかじめpathを通しておくと便利です。その手順をご紹介します。

1.pluginの場所を確認する

 brew infoでelasticsearchの情報を表示します。
 表示されるメッセージの下方にある'plugin script'がpluginのパスになります。

$ brew info elasticsearch
elasticsearch: stable 2.3.3, HEAD
Distributed search & analytics engine
https://www.elastic.co/products/elasticsearch
/usr/local/Cellar/elasticsearch/2.3.3 (59 files, 29.4M) *
  Built from source on 2016-05-22 at 08:33:19
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/elasticsearch.rb
==> Caveats
Data:    /usr/local/var/elasticsearch/elasticsearch_nobuhiro/
Logs:    /usr/local/var/log/elasticsearch/elasticsearch_nobuhiro.log
Plugins: /usr/local/Cellar/elasticsearch/2.3.3/libexec/plugins/
Config:  /usr/local/etc/elasticsearch/
plugin script: /usr/local/Cellar/elasticsearch/2.3.3/libexec/bin/plugin

To have launchd start elasticsearch now and restart at login:
  brew services start elasticsearch
Or, if you don't want/need a background service you can just run:
  elasticsearch

2.pluginのpathを.bash_profileに記述

 .bash_profileを開き以下の内容を記述します。

export ELASTICPATH=/usr/local/Cellar/elasticsearch/2.3.3/libexec/bin
export PATH=$PATH:$ELASTICPATH

3.pathを更新する

 これを行わないとpathが更新されないようです。

$ exec $SHELL -l

4.pathを確認する

 出力に2.で記述したELASTICPATHの内容('2.3.3'のキーワード)が表示されれば成功です。

$ echo %PATH

5.pluginを実行してみる

 正常に動作したようです。

$ plugin -h

NAME
    plugin - Manages plugins

SYNOPSIS
    plugin <command>

DESCRIPTION
    Manage plugins

COMMANDS
    install    Install a plugin
    remove     Remove a plugin
    list       List installed plugins

NOTES
    [*] For usage help on specific commands please type "plugin <command> -h"