准备使用Elasticsearch
目标
Elasticsearch的健康检查
首先
- elasticsearchの導入
$ 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
集群健康状态有:绿色、黄色或红色。在分片层面上,红色状态表示特定分片未分配在集群中,黄色意味着主分片已分配但副本尚未分配,绿色表示所有分片都已分配。
- kibana導入
$ 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/ 访问