Today
Total
KoreanEnglishFrenchGermanJapaneseSpanishChinese (Simplified)
관리 메뉴

DB & AWS Knowledge

Aurora Cluster 의 리더 엔드포인트 특성 본문

AWS 및 클라우드 지식/AWS RDS, Aurora 및 관련 지식

Aurora Cluster 의 리더 엔드포인트 특성

`O` 2023. 5. 9. 02:49
728x90
반응형

해당 페이지에서는 Aurora Cluster 에서 사용되는 리더 엔드포인트 특성에 대하여 다룬다.

 

해당 내용은 이전 게시글과 연관된 내용이다.

 

[1]  2022.10.14 - [AWS 및 클라우드 지식/AWS RDS, Aurora 및 관련 지식] - Aurora Cluster 의 엔드포인트 (endpoint) 유형 및 의의

 

또한 이 내용은 아래의 Document 와도 연관되어 있다.

 

[2] https://docs.aws.amazon.com/whitepapers/latest/amazon-aurora-mysql-db-admin-handbook/load-balancing-with-the-reader-endpoint.html

 

[3] https://repost.aws/knowledge-center/aurora-mysql-postgresql-reader-nodes

 

리더 엔드포인트 특성 - Load Balancing

 

Aurora Cluster 의 리더 엔드포인트는 기본적으로 Load Balancing 을 기본으로 지원 한다.

이는 DNS 기반의 round robin 방식으로 이루어진다. 

 

하지만, 이는 모든 상황에서 100% 정확한 분배는 아니며, reader instance 및 connection 수가 많아 질수록 100% 에 가까운 분포를 보이게 된다.

 

리더 엔드포인트 특성 -  outage 발생 시, 세션 자동 재접속 유도

 

Aurora Cluster 의 리더 엔드포인트는 특정 reader 의 사용 불가 혹은 삭제등의 갑작스러운 outage 발생 시, 해당 reader 를 사용하던 세션들이 다른 reader 를 사용 할 수 있도록 유도 해 준다. 이는 Aurora MySQL, PostgreSQL 에서 동일하게 적용하고 아래의 테스트를 통해서도 확인 할 수 있다.

 

[MySQL 테스트]

현재 aurora-test-instance-1, aurora-test-instance-2 reader 가 있으며, connection 이 aurora-test-instance-2 에 유지 중일 시.

- aurora-test-instance-2 를 삭제전 현재 connection 이 어디에 있는지 확인

MySQL [(none)]> select @@aurora_server_id;
+----------------------------+
| @@aurora_server_id         |
+----------------------------+
| aurora-test-instance-2     |
+----------------------------+
1 row in set (0.00 sec)

- aurora-test-instance-2 삭제 후

MySQL [(none)]> select @@aurora_server_id;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    2584
Current database: *** NONE ***

+----------------------------+
| @@aurora_server_id         |
+----------------------------+
| aurora-test-instance-1     |
+----------------------------+
1 row in set (0.01 sec)

 

[PostgreSQL 테스트]

현재 aurora-test-instance-1 (172.31.21.214), aurora-test-instance-2 (172.31.60.81) reader 가 있으며, connection 이 aurora-test-instance-1 (172.31.21.214) 에 유지 중일 시.

- aurora-test-instance-1 을 삭제전 현재 connection 이 어디에 있는지 확인

postgres=> SELECT inet_server_addr();
 inet_server_addr
------------------
 172.31.21.214
(1 row)

postgres=> SELECT :'HOST' host;
                                    host
---------------------------------------------------------------------------------
 aurora-postgresql-test.cluster-ro-csssomh1rwkc.ap-northeast-2.rds.amazonaws.com 
(1 row)

- aurora-test-instance-1 을 삭제 후

postgres=> SELECT inet_server_addr();
SSL SYSCALL error: EOF detected
The connection to the server was lost. Attempting reset: Succeeded.
psql (14.2, server 12.8)
SSL connection (protocol: TLSv1.2, cipher: DHE-RSA-AES128-SHA, bits: 128, compression: off)

postgres=> SELECT inet_server_addr();
 inet_server_addr
------------------
 172.31.60.81
(1 row)

postgres=> SELECT :'HOST' host;
                                    host
---------------------------------------------------------------------------------
 aurora-postgresql-test.cluster-ro-csssomh1rwkc.ap-northeast-2.rds.amazonaws.com 
(1 row)
반응형
Comments