DEV Community

Cover image for #001: Iniciando no Elasticsearch
Bruno Flegler Dal'Col
Bruno Flegler Dal'Col

Posted on • Edited on

#001: Iniciando no Elasticsearch

1 - Instale e inicie Docker Desktop.

2 - Crie o arquivo docker-compose.yml e adicione:

  version: '3.3'

  services:
    cluster-elasticsearch:
      image: docker.elastic.co/elasticsearch/elasticsearch:7.14.0
      container_name: cluster-elasticsearch
      ports:
        - "9202:9200"
      environment:
        - discovery.type=single-node
Enter fullscreen mode Exit fullscreen mode

3 - Inicie o cluster:

$ docker-compose up --build -d
Enter fullscreen mode Exit fullscreen mode

4 - Use o curl para acessar o status do cluster:

$ curl -X GET http://localhost:9202/_cluster/health?pretty
Enter fullscreen mode Exit fullscreen mode

O status do cluster é definido pelo funcionamento da shards primárias e réplica. Os status são:

green: Todos as shards foram iniciadas.

yellow: Todas shards primárias foram iniciadas, mas uma ou mais réplicas não foi iniciada. Se um nó falhar, alguns dados podem ficar indisponíveis até que o nó seja reparado.

red: Uma ou mais shards primárias não foi iniciada, portanto os dados estão indisponíveis.

{
  "cluster_name" : "docker-cluster",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 1,
  "active_shards" : 1,
  "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
}

Enter fullscreen mode Exit fullscreen mode

O intuito desse artigo não é detalhar todas as propriedades, durante os próximos artigos veremos com mais detalhes. Te vejo até lá.

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay