Elasticsearch环境准备

Elasticsearch是开源分布式搜索引擎,提供搜集、分析、存储数据三大功能。它的特点有:分布式,零配置,自动发现,索引自动分片,索引副本机制,restful风格接口,多数据源,自动搜索负载等。官方文档https://www.elastic.co/guide/en/elasticsearch/reference/6.6/index.html

这里为了便于本地学习和验证,都基于docker (https://www.docker.com/)

Prepare

  • install docker , see the document with docker https://www.docker.com/

  • register on https://hub.docker.com/ for free

  • login with commond line. Notice: YOUR_ID is not the e-mail


docker login -u YOUR_ID -p YOUR_PWD

Install & Run

pull image (current version is 6.6.1)


docker pull docker.elastic.co/elasticsearch/elasticsearch:6.6.1

run docker for dev or test mode


docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:6.6.1

inspect status

 curl -X GET "http://127.0.0.1:9200/_cluster/health?pretty=true"

result may like this

{
  "cluster_name" : "docker-cluster",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 0,
  "active_shards" : 0,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 100.0
}

Reference

https://www.elastic.co/guide/en/elasticsearch/reference/6.6/index.html

https://www.elastic.co/guide/en/elasticsearch/reference/6.6/docker.html

你可能感兴趣的:(Elasticsearch环境准备)