'discovery'에 해당되는 글 2건

  1. 2014.09.02 [ElasticSearch] master node election...
  2. 2014.01.21 [elasticsearch] module-discovery-zen 살펴보기....

[ElasticSearch] master node election...

Elastic/Elasticsearch 2014.09.02 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



저작자 표시 비영리 변경 금지
신고
Trackback 0 : Comment 0

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

Elastic/Elasticsearch 2014.01.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개 이상 설정해라.



신고
Trackback 0 : Comment 0