'REPLICA'에 해당되는 글 3건

  1. 2014.07.17 [ElasticSearch] primary / replica shard 활용 팁.
  2. 2014.04.07 [Elasticsearch] replica & shard 이해하기. 2
  3. 2013.04.19 [Elasticsearch] node 별 색인 shard 와 replicas flow.

[ElasticSearch] primary / replica shard 활용 팁.

Elastic/Elasticsearch 2014. 7. 17. 16:49

ElasticSearch 발표 자료들 중에서 괜찮은 내용이 있어서 올려 봅니다.


- More primary shards

- faster indexing

- scalability

- More replicas

- faster searching

- more failover


원본은 https://speakerdeck.com/asm89/elasticsearch

:

[Elasticsearch] replica & shard 이해하기.

Elastic/Elasticsearch 2014. 4. 7. 23:16

es 를 다루면서 기본이 되는 내용인데 잘못 이해 하고 계시는 분들을 위해서 글 올려 봅니다.

제 책에도 언급이 되어 있습니다. ^^;

http://www.hanbit.co.kr/ebook/look.html?isbn=9788968486913



replica 는 말 그대로 index 에 대한 복제를 의미 합니다.

이 복제에 대한 의미를 active, standby 로 표현 하는 것은 잘 못된 표현 입니다.

replica 는 물리적인 index 의 shard 를 복제 하여 분산처리를 가능하게 해주고 SPOF(single point of failure) 에 대한 failover 개념으로 사용 되는 것입니다.


replica 와 shard 에 대해서는 인터넷 검색해 보시면 그림을 잘 그려 주신 분들이 너무나 많습니다.

그리고 slideshare 나 elasticsearch.org 에 들어가 보시면 많은 문서들이 있기 때문에 보시면 될 것 같습니다.


replica 는 기본적으로 primary 를 기반으로 복제를 하게 됩니다.

shard 에는 primary shard 와 replica shard 이렇게 두 가지가 존재 합니다.

모든 색인은 기본 primary shard 에서 이루어 지고 이것을 가지고 복제를 하게 되는 것이구요.


또한 검색 시 이 shard d 들은 성능에 많은 영향을 주게 됩니다.

0.90.x 제 기억으로는 0.90.5 까지만 해도 3가지 type 만 있었는데 1.x 또는 제가 확인 안한 0.90.5 이상 부터.. 

아래 유형들이 추가 되었습니다.


`_primary`:: 

The operation will go and be executed only on the primary

shards.


`_primary_first`:: 

The operation will go and be executed on the primary

shard, and if not available (failover), will execute on other shards.


`_local`:: 

The operation will prefer to be executed on a local

allocated shard if possible.


`_only_node:xyz`:: 

Restricts the search to execute only on a node with

the provided node id (`xyz` in this case).


`_prefer_node:xyz`:: 

Prefers execution on the node with the provided

node id (`xyz` in this case) if applicable.


`_shards:2,3`:: 

Restricts the operation to the specified shards. (`2`

and `3` in this case). This preference can be combined with other

preferences but it has to appear first: `_shards:2,3;_primary`


이 옵션들은 검색 요청 시 성능 또는 기능 요구사항에 따라 다양하게 활용을 할 수 있습니다.

기본 설정 값은 random 입니다.

이전까지 유효했던 설정은 _local, _primary 였구요. 위에 있는 옵션들은 추가 된건데 기능이 동작 하는지은 테스트 해보지는 않았습니다.


정리 하면, 

replica)

primary shard 에 대한 복제 기능 설정을 하는 것이다.

replica shard 를 의미 한다.

기본 설정은 1 이다.

full replica 설정은 node size - 1 이다.

 SPOF 대응을 위한 설정이다.


shard)

primary shard 와 replica shard 가 있다.

primary shard 에 기본적으로 색인이 되며, 이를 기준으로 replica shard 를 생성하게 된다.

shard 는 lucene 에서 사용하는 index 기준이다. ( 루씬 기준의 물리적인 인덱스 라고 보시면 됩니다. )



추가로, unassigned shard 도 여러가지 상황에 따라 발생을 하게 됩니다.

- 할당한 노드가 없을 때도 발생을 하고

- recovery 가 실패 했을 떄도 발생을 합니다.

- 그 외 여러가지 상황이 있을 수 있구요.


기본적으로 정상적인 shard 인데 unassigned shard 로 남아 있는 경우 수동으로 할당을 시켜 줄 수 있습니다.

shard reroute 를 통해서 할당해 주면 됩니다. (http://jjeong.tistory.com/909)

그리고 sharding 알고리즘은 기본적으로 각 노드에 순차적으로 shard 를 할당하는 구조 입니다. (http://jjeong.tistory.com/926)


요정도 까지만 정리하도록 하겠습니다.

es 의 기본 개념은 elasticsearch.org 의 glossary 를 참고하세요.

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/glossary.html

:

[Elasticsearch] node 별 색인 shard 와 replicas flow.

Elastic/Elasticsearch 2013. 4. 19. 16:27

쉽게 개념을 잡기 위해 Document 색인 요청 시 어떤 flow 로 색인 및 복제를 하는지 간단하게 표현해 봤습니다.


  

 
Find Primary Shard






                                    ↓


 
Perform Index into the Primary Shard






                                    ↓


 
Perform Replica to another Node (using async)



: