LoginSignup
48
48

More than 5 years have passed since last update.

Elasticsearch を yumでインストール (CentOS)

Last updated at Posted at 2015-12-27

https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html
ここに書いてあることやるだけですがメモ。

1. yum レポジトリの設定

# rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch
# vim /etc/yum.repos.d/elasticsearch.repo


[elasticsearch-2.x]
name=Elasticsearch repository for 2.x packages
baseurl=http://packages.elastic.co/elasticsearch/2.x/centos
gpgcheck=1
gpgkey=http://packages.elastic.co/GPG-KEY-elasticsearch
enabled=1

2. インストール

# yum install elasticsearch

3. 起動

# /etc/init.d/elasticsearch start

Starting elasticsearch:                                    [  OK  ]

4. 自動起動設定

# chkconfig --add elasticsearch

5. 設定変更

設定ファイルは、/etc/elasticsearch/elasticsearch.yml にある模様。
今回はローカルのVagrantのIPを設定。port はそのまま。

 # network.host: 192.168.0.1
+network.host: 192.168.33.10
# /etc/init.d/elasticsearch restart

http://192.168.33.10:9200/ にアクセスして確認

$ curl 'http://192.168.33.10:9200/'
{
  "name" : "Obituary",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "2.1.1",
    "build_hash" : "40e2c53a6b6c2972b3d13846e450e66f4375bd71",
    "build_timestamp" : "2015-12-15T13:05:55Z",
    "build_snapshot" : false,
    "lucene_version" : "5.3.1"
  },
  "tagline" : "You Know, for Search"
}

6. kuromoji のインストール

Japanese (kuromoji) Analysis Plugin に書いてあるのを実行

$ cd /usr/share/elasticsearch
$ sudo bin/plugin install analysis-kuromoji

インストールされているか確認

$ curl -X GET 'http://192.168.33.10:9200/_nodes/plugins?pretty'

{
  "cluster_name" : "elasticsearch",
  "nodes" : {
    "t3aQ5-NMTmGUno7vqRYVgg" : {
      "name" : "Aleksander Lukin",
      "transport_address" : "192.168.33.10:9300",
      "host" : "192.168.33.10",
      "ip" : "192.168.33.10",
      "version" : "2.1.1",
      "build" : "40e2c53",
      "http_address" : "192.168.33.10:9200",
      "plugins" : [ {
        "name" : "analysis-kuromoji",
        "version" : "2.1.1",
        "description" : "The Japanese (kuromoji) Analysis plugin integrates Lucene kuromoji analysis module into elasticsearch.",
        "jvm" : true,
        "classname" : "org.elasticsearch.plugin.analysis.kuromoji.AnalysisKuromojiPlugin",
        "isolated" : true,
        "site" : false
      } ]
    }
  }
}

その他

データとかログは、デフォルトでは下記にある模様

path.home=/usr/share/elasticsearch
default.path.logs=/var/log/elasticsearch
default.path.data=/var/lib/elasticsearch
default.path.conf=/etc/elasticsearch

48
48
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
48
48