본문 바로가기

TroubleShooting/Elasticsearch

Elasticsearch cluster 테스트

728x90

Elasticsearch 의 클러스터 기능 테스트를 위해 같은 네트워크인 두대의 서버에서 같은 버전의 ES(Elasticsearch) 를 실행했다.

config/elasticsearch.yml 에서 cluster.name 을 기본값은 elasticsearch 으로 설정했다.


- Primary : 192.168.1.230/255.255.254.0

/Users/firstboos/Downloads/elasticsearch-1.4.0/bin$ ./elasticsearch

[2014-11-25 16:01:48,245][INFO ][node                     ] [Prodigy] version[1.4.0], pid[16096], build[bc94bd8/2014-11-05T14:26:12Z]

[2014-11-25 16:01:48,245][INFO ][node                     ] [Prodigy] initializing ...

[2014-11-25 16:01:48,250][INFO ][plugins                  ] [Prodigy] loaded [], sites []

[2014-11-25 16:01:50,626][INFO ][node                     ] [Prodigy] initialized

[2014-11-25 16:01:50,626][INFO ][node                     ] [Prodigy] starting ...

[2014-11-25 16:01:50,716][INFO ][transport                ] [Prodigy] bound_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish_address {inet[/192.168.1.230:9300]}

[2014-11-25 16:01:50,731][INFO ][discovery                ] [Prodigy] elasticsearch/037oyt_kRaKk7QaTrs8szA

[2014-11-25 16:01:54,504][INFO ][cluster.service          ] [Prodigy] new_master [Prodigy][037oyt_kRaKk7QaTrs8szA][Jeon-ui-iMac.local][inet[/192.168.1.230:9300]], reason: zen-disco-join (elected_as_master)

[2014-11-25 16:01:54,524][INFO ][http                     ] [Prodigy] bound_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish_address {inet[/192.168.1.230:9200]}

[2014-11-25 16:01:54,524][INFO ][node                     ] [Prodigy] started

[2014-11-25 16:01:55,080][INFO ][gateway                  ] [Prodigy] recovered [3] indices into cluster_state

[2014-11-25 16:02:21,370][INFO ][cluster.service          ] [Prodigy] added {[Ares][XOY6u9L3S_u1Rcxmn2x9mA][localhost.localdomain][inet[/192.168.0.138:9300]],}, reason: zen-disco-receive(join from node[[Ares][XOY6u9L3S_u1Rcxmn2x9mA][localhost.localdomain][inet[/192.168.0.138:9300]]])

 node.name 이 "Prodigy" 가 초기화 과정을 거치고, 192.168.0.138 서버의 "Ares" node(elasticsearch/XOY6u9L3S_u1Rcxmn2x9mA 의 ID 를 가진 node)가 연결된 것을 확인할 수 있다. 


- Secondary : 192.168.0.138/255.255.254.0

[root@localhost elasticsearch-1.4.0]# ./bin/elasticsearch

[2014-11-25 16:02:15,077][INFO ][node                     ] [Ares] version[1.4.0], pid[27797], build[bc94bd8/2014-11-05T14:26:12Z]

[2014-11-25 16:02:15,078][INFO ][node                     ] [Ares] initializing ...

[2014-11-25 16:02:15,083][INFO ][plugins                  ] [Ares] loaded [], sites []

[2014-11-25 16:02:18,174][INFO ][node                     ] [Ares] initialized

[2014-11-25 16:02:18,174][INFO ][node                     ] [Ares] starting ...

[2014-11-25 16:02:18,305][INFO ][transport                ] [Ares] bound_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish_address {inet[/192.168.0.138:9300]}

[2014-11-25 16:02:18,343][INFO ][discovery                ] [Ares] elasticsearch/XOY6u9L3S_u1Rcxmn2x9mA

[2014-11-25 16:02:21,393][INFO ][cluster.service          ] [Ares] detected_master [Prodigy][037oyt_kRaKk7QaTrs8szA][Jeon-ui-iMac.local][inet[/192.168.1.230:9300]], added {[Prodigy][037oyt_kRaKk7QaTrs8szA][Jeon-ui-iMac.local][inet[/192.168.1.230:9300]],}, reason: zen-disco-receive(from master [[Prodigy][037oyt_kRaKk7QaTrs8szA][Jeon-ui-iMac.local][inet[/192.168.1.230:9300]]])

[2014-11-25 16:02:21,543][INFO ][http                     ] [Ares] bound_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish_address {inet[/192.168.0.138:9200]}

[2014-11-25 16:02:21,544][INFO ][node                     ] [Ares] started

master 노드(192.168.1.230 / "Prodigy")를 확인하고 연결한 메시지가 출력된다.


- master 해제 : 클러스터의 master 인 "Prodigy" 노드를 해제(프로세스 kill, ctrl+C)하고, 다른 서버 상태를 확인한다.

^C[2014-11-25 16:03:37,910][INFO ][node                     ] [Prodigy] stopping ...

[2014-11-25 16:03:37,955][INFO ][node                     ] [Prodigy] stopped

[2014-11-25 16:03:37,956][INFO ][node                     ] [Prodigy] closing ...

[2014-11-25 16:03:37,959][INFO ][node                     ] [Prodigy] closed


- secondary 노드("Ares")가 이제 새로운 master 가 되었다.

[2014-11-25 16:03:37,951][INFO ][discovery.zen            ] [Ares] master_left [[Prodigy][037oyt_kRaKk7QaTrs8szA][Jeon-ui-iMac.local][inet[/192.168.1.230:9300]]], reason [shut_down]

[2014-11-25 16:03:37,952][WARN ][discovery.zen            ] [Ares] master left (reason = shut_down), current nodes: {[Ares][XOY6u9L3S_u1Rcxmn2x9mA][localhost.localdomain][inet[/192.168.0.138:9300]],}

[2014-11-25 16:03:37,952][INFO ][cluster.service          ] [Ares] removed {[Prodigy][037oyt_kRaKk7QaTrs8szA][Jeon-ui-iMac.local][inet[/192.168.1.230:9300]],}, reason: zen-disco-master_failed ([Prodigy][037oyt_kRaKk7QaTrs8szA][Jeon-ui-iMac.local][inet[/192.168.1.230:9300]])

[2014-11-25 16:03:41,737][INFO ][cluster.service          ] [Ares] new_master [Ares][XOY6u9L3S_u1Rcxmn2x9mA][localhost.localdomain][inet[/192.168.0.138:9300]], reason: zen-disco-join (elected_as_master)


 elasticsearch/data 폴더에는 두 서버간에 통신을 통해 샤드(shard) 데이터들이 복사된 것을 확인할 수 있다.