ゴール
Elasticsearchのヘルスチェック
はじめに
- elasticsearchの導入
.sh
$ brew install elasticsearch
$ echo "export ELASTICPATH=/usr/local/Cellar/elasticsearch/5.5.1/libexec/bin" >> .bashrc
# 起動
$ elasticsearch
# 確認
$ curl localhost:9200
{
"name" : "MDffy-a",
"cluster_name" : "elasticsearch_naopon",
"cluster_uuid" : "Dzj28enNSkyAig0sZkyQZQ",
"version" : {
"number" : "5.5.1",
"build_hash" : "19c13d0",
"build_date" : "2017-07-18T20:44:24.823Z",
"build_snapshot" : false,
"lucene_version" : "6.6.0"
},
"tagline" : "You Know, for Search"
}
# cluster nameはここで設定されている
$ vim /usr/local/Cellar/elasticsearch/5.5.1/libexec/config/elasticsearch.yml
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: elasticsearch_naopon
# clusterの確認
$ curl localhost:9200/_cat/health?v
epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1501895954 10:19:14 elasticsearch_naopon yellow 1 1 1 1 0 0 1 0 - 50.0%
# indexの確認
$ curl localhost:9200/_cat/indices?v
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open .kibana oFN9CZzIRASC5Eww1FFW0Q 1 1 1 0 3.1kb 3.1kb
- clusterのstatus
The cluster health status is: green, yellow or red. On the shard level, a red status indicates that the specific shard is not allocated in the cluster, yellow means that the primary shard is allocated but replicas are not, and green means that all shards are allocated.
- kibana導入
.sh
$ mkdir ~/kibana && cd $_
$ wget https://artifacts.elastic.co/downloads/kibana/kibana-5.5.1-darwin-x86_64.tar.gz
$ tar zxvf kibana-5.5.1-darwin-x86_64.tar.gz
$ cd kibana-5.5.1-darwin-x86_64
$ bin/kibana
http://localhost:5601/ でアクセス