秒速でElasticsearchをインストールするメモ

Elasticsearchのインストールメモです。
そもそもElasticSearchとは

Elasticsearch とはひと言で言うと、マルチテナント、スキーマレスでクラウドに最適化された Lucene ベースのサーチエンジン サーバーです。
http://kwstaff.tumblr.com/post/62778588447/elasticsearch

というものらしいです。
なるほど~知識が無さ過ぎてうまく理解できないです!
ただ、最終的な目標はFluentd + ElasticSearch + Kibana3でログを可視化をすることなので
理解するのは後回しにして一旦ElasticSearchのインストールします。
OSはRHEL5.7です。

■■■Elasticsearchインストール■■■
[root@ONEDARI01 work]# wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.10.tar.gz
--2014-02-01 10:02:52--  https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.10.tar.gz
Resolving download.elasticsearch.org... 174.129.36.224, 54.225.135.194, 2406:da00:ff00::36e1:87c2, ...
Connecting to download.elasticsearch.org|174.129.36.224|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 18426339 (18M) [application/x-tar]
Saving to: `elasticsearch-0.90.10.tar.gz'

100%[=======================================================================================================>] 18,426,339  1.42M/s   in 15s

2014-02-01 10:03:08 (1.20 MB/s) - `elasticsearch-0.90.10.tar.gz' saved [18426339/18426339]

[root@ONEDARI01 work]#
[root@ONEDARI01 work]# tar zxvf elasticsearch-0.90.10.tar.gz
elasticsearch-0.90.10/README.textile
elasticsearch-0.90.10/LICENSE.txt
elasticsearch-0.90.10/NOTICE.txt
elasticsearch-0.90.10/lib/lucene-core-4.6.0.jar
elasticsearch-0.90.10/lib/lucene-codecs-4.6.0.jar
elasticsearch-0.90.10/lib/lucene-analyzers-common-4.6.0.jar
elasticsearch-0.90.10/lib/lucene-queries-4.6.0.jar
elasticsearch-0.90.10/lib/lucene-memory-4.6.0.jar
elasticsearch-0.90.10/lib/lucene-highlighter-4.6.0.jar
elasticsearch-0.90.10/lib/lucene-queryparser-4.6.0.jar
elasticsearch-0.90.10/lib/lucene-sandbox-4.6.0.jar
elasticsearch-0.90.10/lib/lucene-suggest-4.6.0.jar
elasticsearch-0.90.10/lib/lucene-misc-4.6.0.jar
elasticsearch-0.90.10/lib/lucene-expressions-4.6.0.jar
elasticsearch-0.90.10/lib/antlr-runtime-3.5.jar
elasticsearch-0.90.10/lib/asm-4.1.jar
elasticsearch-0.90.10/lib/asm-commons-4.1.jar
elasticsearch-0.90.10/lib/lucene-join-4.6.0.jar
elasticsearch-0.90.10/lib/lucene-grouping-4.6.0.jar
elasticsearch-0.90.10/lib/lucene-spatial-4.6.0.jar
elasticsearch-0.90.10/lib/spatial4j-0.3.jar
elasticsearch-0.90.10/lib/jts-1.12.jar
elasticsearch-0.90.10/lib/log4j-1.2.17.jar
elasticsearch-0.90.10/lib/jna-3.3.0.jar
elasticsearch-0.90.10/lib/elasticsearch-0.90.10.jar
elasticsearch-0.90.10/bin/elasticsearch
elasticsearch-0.90.10/bin/elasticsearch.in.sh
elasticsearch-0.90.10/bin/plugin
elasticsearch-0.90.10/lib/sigar/
elasticsearch-0.90.10/lib/sigar/libsigar-sparc-solaris.so
elasticsearch-0.90.10/lib/sigar/libsigar-ia64-linux.so
elasticsearch-0.90.10/lib/sigar/libsigar-x86-freebsd-6.so
elasticsearch-0.90.10/lib/sigar/sigar-1.6.4.jar
elasticsearch-0.90.10/lib/sigar/libsigar-amd64-freebsd-6.so
elasticsearch-0.90.10/lib/sigar/libsigar-universal64-macosx.dylib
elasticsearch-0.90.10/lib/sigar/libsigar-x86-freebsd-5.so
elasticsearch-0.90.10/lib/sigar/libsigar-x86-solaris.so
elasticsearch-0.90.10/lib/sigar/libsigar-amd64-linux.so
elasticsearch-0.90.10/lib/sigar/libsigar-sparc64-solaris.so
elasticsearch-0.90.10/lib/sigar/libsigar-universal-macosx.dylib
elasticsearch-0.90.10/lib/sigar/libsigar-amd64-solaris.so
elasticsearch-0.90.10/lib/sigar/libsigar-x86-linux.so
elasticsearch-0.90.10/config/elasticsearch.yml
elasticsearch-0.90.10/config/logging.yml
[root@ONEDARI01 work]# ls -ltr
-rw-r--r-- 1 root root 18426339 Jan 10 19:28 elasticsearch-0.90.10.tar.gz
drwxr-xr-x 5 root root     4096 Feb  1 10:03 elasticsearch-0.90.10
[root@ONEDARI01 work]#
[root@ONEDARI01 work]# mv elasticsearch-0.90.10 /usr/local/elasticsearch
[root@ONEDARI01 work]# cd /usr/local/elasticsearch/config/
[root@ONEDARI01 config]# ls -ltr
total 28
-rw-rw-r-- 1 1002 1002  1512 Jan 10 18:18 logging.yml
-rw-rw-r-- 1 1002 1002 12611 Jan 10 18:40 elasticsearch.yml
[root@ONEDARI01 config]# vi elasticsearch.yml

 http.port: 9200

[root@ONEDARI01 config]# cd /usr/local
[root@ONEDARI01 local]# wget https://github.com/elasticsearch/elasticsearch-servicewrapper/archive/master.zip --no-check-certificate
--2014-02-01 10:09:14--  https://github.com/elasticsearch/elasticsearch-servicewrapper/archive/master.zip
Resolving github.com... 192.30.252.129
Connecting to github.com|192.30.252.129|:443... connected.
WARNING: cannot verify github.com's certificate, issued by `/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance EV CA-1':
  Unable to locally verify the issuer's authority.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/elasticsearch/elasticsearch-servicewrapper/zip/master [following]
--2014-02-01 10:09:15--  https://codeload.github.com/elasticsearch/elasticsearch-servicewrapper/zip/master
Resolving codeload.github.com... 192.30.252.146
Connecting to codeload.github.com|192.30.252.146|:443... connected.
WARNING: cannot verify codeload.github.com's certificate, issued by `/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance CA-3':
  Unable to locally verify the issuer's authority.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/zip]
Saving to: `master'

    [                <=>                                                                                     ] 2,054,023    577K/s   in 3.5s

2014-02-01 10:09:20 (577 KB/s) - `master' saved [2054023]

[root@ONEDARI01 local]# ls -ltr
drwxr-xr-x  5 root root    4096 Feb  1 10:03 elasticsearch
-rw-r--r--  1 root root 2054023 Feb  1 10:09 master
[root@ONEDARI01 local]# unzip master
[root@ONEDARI01 local]# ls -ltr
drwxr-xr-x  3 root root    4096 Jul 29  2013 elasticsearch-servicewrapper-master
drwxr-xr-x  5 root root    4096 Feb  1 10:03 elasticsearch
-rw-r--r--  1 root root 2054023 Feb  1 10:09 master
[root@ONEDARI01 local]#
[root@ONEDARI01 local]#
[root@ONEDARI01 local]#
[root@ONEDARI01 local]# mv elasticsearch-servicewrapper-master/service/ elasticsearch/bin/
[root@ONEDARI01 local]# cd elasticsearch/bin/
[root@ONEDARI01 bin]# ls -ltr
total 36
drwxr-xr-x 4 root root 4096 Jul 29  2013 service
-rwxr-xr-x 1 1002 1002 1064 Jan 10 19:19 plugin
-rwxr-xr-x 1 1002 1002 2024 Jan 10 19:19 elasticsearch.in.sh
-rwxr-xr-x 1 1002 1002 6273 Jan 10 19:19 elasticsearch
[root@ONEDARI01 local]# cd elasticsearch/bin/
[root@ONEDARI01 bin]# ls -ltr
total 36
drwxr-xr-x 4 root root 4096 Jul 29  2013 service
-rwxr-xr-x 1 1002 1002 1064 Jan 10 19:19 plugin
-rwxr-xr-x 1 1002 1002 2024 Jan 10 19:19 elasticsearch.in.sh
-rwxr-xr-x 1 1002 1002 6273 Jan 10 19:19 elasticsearch
[root@ONEDARI01 bin]# cd service
[root@ONEDARI01 service]# ls -ltr
total 116
drwxr-xr-x 2 root root  4096 Jul 29  2013 lib
drwxr-xr-x 2 root root  4096 Jul 29  2013 exec
-rw-r--r-- 1 root root  4754 Jul 29  2013 elasticsearch.conf
-rw-r--r-- 1 root root  2610 Jul 29  2013 elasticsearch.bat
-rwxr-xr-x 1 root root    64 Jul 29  2013 elasticsearch64
-rwxr-xr-x 1 root root    64 Jul 29  2013 elasticsearch32
-rwxr-xr-x 1 root root 55710 Jul 29  2013 elasticsearch
[root@ONEDARI01 service]# ./elasticsearch install
Detected RHEL or Fedora:
Installing the ElasticSearch daemon..
[root@ONEDARI01 service]# /etc/init.d/elasticsearch start
Starting ElasticSearch...
Waiting for ElasticSearch......................
WARNING: ElasticSearch may have failed to start.

ありゃー失敗したー
いや、そういえばJavaは??
と調べると無かったので導入。

■■■JAVAのインストール■■■
[root@ONEDARI01 service]# java -version
-bash: java: command not found
[root@ONEDARI01 service]#
[root@ONEDARI01 service]# rpm -qa | grep -E 'jre|jdk' | xargs rpm -e
rpm: no packages given for erase
[root@ONEDARI01 service]#cd /home/work/
[root@ONEDARI01 work]# rpm -ivh jdk-7u51-linux-i586.rpm
[root@ONEDARI01 work]# vi /etc/profile.d/java.sh

JAVA_HOME=/usr/java/default
export JAVA_HOME
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar

[root@ONEDARI01 work]# source /etc/profile.d/java.sh
[root@ONEDARI01 work]# java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode, sharing)
[root@ONEDARI01 work]#
[root@ONEDARI01 work]# /etc/init.d/elasticsearch start
Starting ElasticSearch...
Waiting for ElasticSearch......
running: PID:11554
[root@ONEDARI01 work]# 

うまくいったようです。

■■■確認方法■■■
[root@ONEDARI01 work]# curl -X GET http://localhost:9200
{
  "ok" : true,
  "status" : 200,
  "name" : "La Nuit",
  "version" : {
    "number" : "0.90.10",
    "build_hash" : "0a5781f44876e8d1c30b6360628d59cb2a7a2bbb",
    "build_timestamp" : "2014-01-10T10:18:37Z",
    "build_snapshot" : false,
    "lucene_version" : "4.6"
  },
  "tagline" : "You Know, for Search"
}

ついでに停止方法も。

■■■停止方法■■■
[root@ONEDARI01 work]# /etc/init.d/elasticsearch stop
Stopping ElasticSearch...
Stopped ElasticSearch.
[root@ONEDARI01 work]#

●●●参考にしたもの
CentOSに全文検索エンジンelasticsearchをインストールする
http://qiita.com/hilotter/items/b3038be41605775bcf69

elasticsearchのインストール
http://yuheikagaya.hatenablog.jp/entry/2013/07/14/181415

次はFluentdのインストールと設定をしてみます。

以上

関連する投稿:

コメントを残す

メールアドレスが公開されることはありません。

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください