kibana+elasticsearchをインストールしてみる

なにやらログを可視化してくれるらしい。とりあえず自機(ubuntu)へインストールしてみる。

javaをバージョンアップする

elasticsearchがjavaを使うようで、しかもjdk8以上とのこと。ubuntuディストリビューションだとjdk7なのでバージョンアップ。ここの通りに。ありがとうございます。

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer

elasticsearchをインストール

まぁインストールというか、ダウンロードして起動するだけ。
ダウンロードはここから。展開して、起動。

$ tar -zxvf ~/download/elasticsearch-1.6.0.tar.gz
$ cd elasticsearch-1.6.0/bin
$ ./elasticsearch

ちゃんと起動できるとこんなのが画面にでてくる。

[2015-06-24 11:30:57,160][INFO ][node                     ] [Centurious] version[1.6.0], pid[26291], build[cdd3ac4/2015-06-09T13:36:34Z]
[2015-06-24 11:30:57,191][INFO ][node                     ] [Centurious] initializing ...
[2015-06-24 11:30:57,220][INFO ][plugins                  ] [Centurious] loaded [], sites []
[2015-06-24 11:30:57,499][INFO ][env                      ] [Centurious] using [1] data paths, mounts [[/ (/dev/mapper/ubuntu-root)]], net usable_space [99.9gb], net total_space [225gb], types [ext4]
Java HotSpot(TM) Server VM warning: You have loaded library /home/hoge/elasticsearch/elasticsearch-1.6.0/lib/sigar/libsigar-x86-linux.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
[2015-06-24 11:31:00,832][INFO ][node                     ] [Centurious] initialized
[2015-06-24 11:31:00,833][INFO ][node                     ] [Centurious] starting ...
[2015-06-24 11:31:00,937][INFO ][transport                ] [Centurious] bound_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish_address {inet[/10.231.1.21:9300]}
[2015-06-24 11:31:01,000][INFO ][discovery                ] [Centurious] elasticsearch/oN9x7vyTRn2-komL4q7VBQ
[2015-06-24 11:31:04,808][INFO ][cluster.service          ] [Centurious] new_master [Centurious][oN9x7vyTRn2-komL4q7VBQ][sheryl][inet[/10.231.1.21:9300]], reason: zen-disco-join (elected_as_master)
[2015-06-24 11:31:04,841][INFO ][http                     ] [Centurious] bound_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish_address {inet[/10.231.1.21:9200]}
[2015-06-24 11:31:04,841][INFO ][node                     ] [Centurious] started
[2015-06-24 11:31:04,954][INFO ][gateway                  ] [Centurious] recovered [0] indices into cluster_state

CenturiousとかNew Goblinとかってのはノード名。起動毎に違うみたい。よくわからん。

確認

ブラウザでelasticsearchを起動したサーバの9200をHTTPでGETしてみる。
こんなjsonがでてくればOK。

{
  "status" : 200,
  "name" : "Centurious",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "1.6.0",
    "build_hash" : "cdd3ac4dde4f69524ec0a14de3828cb95bbb86d0",
    "build_timestamp" : "2015-06-09T13:36:34Z",
    "build_snapshot" : false,
    "lucene_version" : "4.10.4"
  },
  "tagline" : "You Know, for Search"
}

kibanaをインストール

ここからダウンロードして展開。

$ tar -zxvf kibana-4.1.0-linux-x86.tar.gz
$ cd kibana-4.1.0-linux-x86/

config/kibana.ymlを編集

elastitcsearchがlistenしているURIを elasticsearch_url: へ書く。

elasticsearch_url: "http://localhost:9200"

ブラウザでブラウズ

kibanaを起動したサーバの TCP/5601 をブラウズ。
インストールといっても、それぞれ単体で起動するだけですね。

使い方などはこれから。