'discovery'에 해당되는 글 4건

  1. 2020.12.11 [Elasticsearch] Discovery Mode 정리.
  2. 2020.09.10 [Elasticsearch+Docker] 로컬 클러스터 구성 시 흔한 실수.
  3. 2014.09.02 [ElasticSearch] master node election...
  4. 2014.01.21 [elasticsearch] module-discovery-zen 살펴보기....

[Elasticsearch] Discovery Mode 정리.

Elastic/Elasticsearch 2020. 12. 11. 11:34

참고문서)

www.elastic.co/guide/en/elasticsearch/reference/7.x/modules-discovery.html

 

 

1. 단독 구성

discovery.type=single-node

 

2. 클러스터 구성

discovery.seed_hosts=e1,e2,e3

cluster.initial_master_nodes=e1,e2,e3

 

1번과 같이 단독 구성은 어떤 형태로든 클러스터 환경 구성이 안됩니다.

또한, 단독 구성 노드를 동일 인스턴스, 로컬 환경에서 여러 개 실행이 되지 않습니다.

 

2번과 같은 클러스터 구성에서는 최소 2대 이상의 구성이 필요 하며,

Master 노드에 대한 자격을 가지는 노드도 또한 2대 이상 필요 합니다.

 

3개 노드 구성 시)
Master 노드가 죽게 되면, Master 노드 자격 노드가 Master 로 선출 되며 서비스가 가능 합니다.

2개 노드 구성 시)
Master 노드가 죽게 되면 서비스가 불가능 합니다.

Master 노드 이외 다른 노드가 죽어도 서비스는 불가능 합니다.

 

간혹, 클러스터 구성 시 Master 노드에 대한 쿼럼 구성을 오해 하시는 경우가 있어서 작성해 보았습니다.

 

:

[Elasticsearch+Docker] 로컬 클러스터 구성 시 흔한 실수.

Elastic/Elasticsearch 2020. 9. 10. 08:54

Elasticsearch 가 각 노드들과 discovery 를 하기 위해서는 Transport 통신이 이루어져야 합니다.

문서에 정확하게 나와 있으나 놓치기 쉬운 부분이라 기록해 봅니다.

 

[참고문서]

https://www.elastic.co/guide/en/elasticsearch/reference/current/discovery-settings.html
https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery-bootstrap-cluster.html
https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery-settings.html

 

[Content Snippet]

[discovery.seed_hosts]

Provides a list of the addresses of the master-eligible nodes in the cluster.

1. transport.profiles.default.port
2. transport.port
If neither of these is set then the default port is 9300.

[Example Configuration]

[Node 1 - docker-compose.yml]
version: '3.7'

services:
  docker-es:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.9.1
    container_name: e1
    environment:
      - cluster.name=e3k1
      - node.name=e1
...중략...
      - discovery.seed_hosts=host.docker.internal:9300,host.docker.internal:9301,host.docker.internal:9302
      - cluster.initial_master_nodes=e1,e2,e3
...중략...

[Node 2 - docker-compose.yml]
version: '3.7'

services:
  docker-es:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.9.1
    container_name: e2
    environment:
      - cluster.name=e3k1
      - node.name=e2
...중략...
      - discovery.seed_hosts=host.docker.internal:9300,host.docker.internal:9301,host.docker.internal:9302
      - cluster.initial_master_nodes=e1,e2,e3
...중략...

[Node 3 - docker-compose.yml]
version: '3.7'

services:
  docker-es:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.9.1
    container_name: e3
    environment:
      - cluster.name=e3k1
      - node.name=e3
...중략...
      - discovery.seed_hosts=host.docker.internal:9300,host.docker.internal:9301,host.docker.internal:9302
      - cluster.initial_master_nodes=e1,e2,e3
...중략...

 

위에 작성된 설정 예제는 로컬에서 3개의 Elasticsearch 컨테이너를 실행 시켜서 클러스터링 시키는 예제 입니다.

이 방법 말고도 하나의 docker-compose.yml 에 구성을 하셔도 됩니다. (단, 설정이 조금 달라 집니다.)

 

주의 점은,

위에 언급된 내용처럼 Transport 통신을 한다는 것을 잊으면 안된다는 것입니다.

:

[ElasticSearch] master node election...

Elastic/Elasticsearch 2014. 9. 2. 11:00

그냥 또 까먹을까봐.. 대충 적어 봅니다.


기본적으로 zen discovery 를 통해서 cluster 구성 및 node 간 통신을 위해서 사용이 됩니다.

그럼 master node  가 죽었을 때 어떻게 선출이 될까요?


es 가 실행 되면서 zen discovery module 도 등록이 됩니다.

ZenDiscovery 가 binding 되면서 MasterFaultDetection 과 ElectMasterService 도 등록이 되지요.

MasterFaultDetection 에서 master node 를 감시하다가 에러가 나면 ElectMasterService 에서 master node 를 선출하게 되는 구조가 되는 것입니다.


참 쉽죠 ^^;


ZenDiscovery 에서 하는 역할은 더 있지만 여기서는 그냥 단순 master election 에 대해서만 살펴 봤습니다.


ZenDiscovery

        

MasterFaultDetection

        

ElectMasterService



:

[elasticsearch] module-discovery-zen 살펴보기....

Elastic/Elasticsearch 2014. 1. 21. 16:09

elasticsearch 에서 클러스터 설정과 노드간의 통신에 대한 기본 정책을 설정 하는 역할을 discovery 라 보면 됩니다.

그럼 원문을 아래 살펴 볼까요?

원문 path : /elasticsearch/docs/reference/modules/discovery/zen.asciidoc

ec2 참고 : /elasticsearch/docs/reference/modules/discovery/ec2.asciidoc


[[modules-discovery-zen]]
=== Zen Discovery

The zen discovery is the built in discovery module for elasticsearch and
the default. It provides both multicast and unicast discovery as well
being easily extended to support cloud environments.

▶ multicast, unicast, cloud 환경을 지원 하내요.

The zen discovery is integrated with other modules, for example, all
communication between nodes is done using the
<<modules-transport,transport>> module.

It is separated into several sub modules, which are explained below:

[float]
[[ping]]
==== Ping

This is the process where a node uses the discovery mechanisms to find
other nodes. There is support for both multicast and unicast based
discovery (can be used in conjunction as well).

▶ 노드를 찾거나 찔러 볼때 사용하내요.


[float]
[[multicast]]
===== Multicast
▶ 이건 사실 추천 하고 있지 않습니다. 불필요한 트래픽을 양산 한다고 해서요..
Multicast ping discovery of other nodes is done by sending one or more
multicast requests where existing nodes that exists will receive and
respond to. It provides the following settings with the
`discovery.zen.ping.multicast` prefix:

[cols="<,<",options="header",]
|=======================================================================
|Setting |Description
|`group` |The group address to use. Defaults to `224.2.2.4`.

|`port` |The port to use. Defaults to `54328`.

|`ttl` |The ttl of the multicast message. Defaults to `3`.

|`address` |The address to bind to, defaults to `null` which means it
will bind to all available network interfaces.
|=======================================================================

Multicast can be disabled by setting `multicast.enabled` to `false`.

[float]
[[unicast]]
===== Unicast
▶ 이걸 추천 하고 있죠.. ^^ 딱 보시면 아시겠지만 불특정 다수(?)에 보내는 multicast 방식과 다르게 지정한 노드로만 통신 하게 되니까 효율적이겠죠.
The unicast discovery allows to perform the discovery when multicast is
not enabled. It basically requires a list of hosts to use that will act
as gossip routers. It provides the following settings with the
`discovery.zen.ping.unicast` prefix:

[cols="<,<",options="header",]
|=======================================================================
|Setting |Description
|`hosts` |Either an array setting or a comma delimited setting. Each
value is either in the form of `host:port`, or in the form of
`host[port1-port2]`.
|=======================================================================

The unicast discovery uses the
<<modules-transport,transport>> module to
perform the discovery.

[float]
[[master-election]]
==== Master Election
▶ 이건 master node 가 장애가 났을 때 node.master: true 로 설정 되어 있는 노드들에서 선출 하는 기능 입니다.

▶ 전체 코디네이션 역할을 마스터 노드가 하기 떄문에 중요한 기능입니다.
As part of the initial ping process a master of the cluster is either
elected or joined to. This is done automatically. The
`discovery.zen.ping_timeout` (which defaults to `3s`) allows to
configure the election to handle cases of slow or congested networks
(higher values assure less chance of failure). Note, this setting was
changed from 0.15.1 onwards, prior it was called
`discovery.zen.initial_ping_timeout`.

Nodes can be excluded from becoming a master by setting `node.master` to
`false`. Note, once a node is a client node (`node.client` set to
`true`), it will not be allowed to become a master (`node.master` is
automatically set to `false`).

The `discovery.zen.minimum_master_nodes` allows to control the minimum
number of master eligible nodes a node should "see" in order to operate
within the cluster. Its recommended to set it to a higher value than 1
when running more than 2 nodes in the cluster.
▶ brain split 즉 네트웍 상에서 발생 가능한 단절로 인하여 데이터가 깨졌을 때를 방지 하기 위해 최소한 마스터 노드 역할을 수행 할 수 있는 노드를 2개 이상 설정 하라는 내용입니다.
[float]
[[fault-detection]]
==== Fault Detection
▶  이건 뭐 그냥 봐도 아시겠죠..
There are two fault detection processes running. The first is by the
master, to ping all the other nodes in the cluster and verify that they
are alive. And on the other end, each node pings to master to verify if
its still alive or an election process needs to be initiated.

The following settings control the fault detection process using the
`discovery.zen.fd` prefix:

[cols="<,<",options="header",]
|=======================================================================
|Setting |Description
|`ping_interval` |How often a node gets pinged. Defaults to `1s`.

|`ping_timeout` |How long to wait for a ping response, defaults to
`30s`.

|`ping_retries` |How many ping failures / timeouts cause a node to be
considered failed. Defaults to `3`.
|=======================================================================

[float]
==== External Multicast

The multicast discovery also supports external multicast requests to
discover nodes. The external client can send a request to the multicast
IP/group and port, in the form of:

[source,js]
--------------------------------------------------
{
    "request" : {
        "cluster_name": "test_cluster"
    }
}
--------------------------------------------------

And the response will be similar to node info response (with node level
information only, including transport/http addresses, and node
attributes):

[source,js]
--------------------------------------------------
{
    "response" : {
        "cluster_name" : "test_cluster",
        "transport_address" : "...",
        "http_address" : "...",
        "attributes" : {
            "..."
        }
    }
}
--------------------------------------------------

Note, it can still be enabled, with disabled internal multicast
discovery, but still have external discovery working by keeping
`discovery.zen.ping.multicast.enabled` set to `true` (the default), but,
setting `discovery.zen.ping.multicast.ping.enabled` to `false`.


이상 살펴 봤습니다.

뭐 별거 없죠.. ^^


[세 줄 요약]

1. unicast 를 사용해라.

2. multicast 는 disable 해라.

3. minimum master node 는 2개 이상 설정해라.



: