16
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

elasticsearchが動かなかった時の調査メモ

Last updated at Posted at 2014-05-07

fluentd+elasticsearch+kibanaを構築したが、kibana上にelasticsearchが空っぽだよてきなバナーが表示されていたので、elasticsearchが上手く動いていなかった気がした。基本的な使い方から調査する

動いているか確認

$ curl localhost:9200
{
  "status" : 200,
  "name" : "Wilson Fisk",
  "version" : {
    "number" : "1.1.1",
    "build_hash" : "f1585f096d3f3985e73456debdc1a0745f512bbc",
    "build_timestamp" : "2014-04-16T14:27:12Z",
    "build_snapshot" : false,
    "lucene_version" : "4.7"
  },
  "tagline" : "You Know, for Search"
}

中身が入っているか確認したい。イメージ的にはmongoでいうとdb.User.find()みたいな感じ。というかshow tablesみたいなのってどうやるんだろう。

Elasticsearch API 一覧
これがかなりわかりやすかった。特にcat apiを使えば、状態の確認とかができそう。

nodeの確認

$ curl -X GET http://localhost:9200/_cat/nodes
<hostname> 100.67.120.153 4 17 0.00 d * Wilson Fisk

shardの配置ノード情報の取得

$ curl -X GET http://localhost:9200/_cat/shards
apache_access-201405 0 p STARTED 271 115.4kb 100.67.120.153 Wilson Fisk
kibana-int           0 p STARTED   1  12.1kb 100.67.120.153 Wilson Fisk

これっぽい。このapache_access-201405ってやつがindexぽいので、これを使って中身になにが入っているかを確認。

$ curl -X GET http://localhost:9200/_cat/count/apache_access-201405
1399435877 13:11:17 271

なんかはいっているっぽい?
そもそも、kibanaのエラーでググると
elasticsearch - LogStash: kibana Alert - No results There were no results because no indices were found that match your selected time span - Stack Overflow
これが出てくる。

bin/elasticsearch -f

これやってみたら

$ ./elasticsearch -f
which: no java in (/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin)
Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME

JAVA_HOMEが設定されていないとかで怒られた。
そういや、大人の事情でJAVA_HOME設定してなかったんだった。
これ、面倒だからなんとかしないと

16
15
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
16
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?