Search

SingleStore HA(High Availability) 설정 (선택사항)

문서번호 : 11-234059
더 많은 정보는 SingleStore Docs의 Managing High Availability를 참고하시기 바랍니다.

HA 구성시 유의 사항

안정적인 HA 구성을 위해 MA(Master Aggregator) 노드는 단독 호스트에 배치하고, CA 노드도 함께 구성할 것을 권장합니다.
HA를 활성화하려면 짝수개의 Leaf 노드가 있어야 합니다. (단, 활성화 이후에는 노드 변경 가능)
기존 Leaf 노드 구성 그대로 HA를 활성화하는 경우, 해당 과정은 Offline 작업으로 진행됩니다.
HA가 동작되려면 MA 노드는 반드시 Online 상태여야 합니다.
MA와 Leaf 노드가 동일한 호스트에 존재하면, 해당 호스트에 장애가 발생할 경우 HA가 동작할 수 없습니다. 그러나 CA 노드가 있어 관리자가 이를 수동으로 승격(AGGREGATOR SET AS MASTER)하면 HA가 즉시 동작하게 됩니다.

HA 상태 확인

HA 모드 확인

SingleStore는 최대 2개의 가용그룹(Availability Group)을 지원하며, 각 그룹은 서로의 복제본(Slave)을 가집니다. 복제본 파티션 배치를 지정하는 엔진 변수와 설정값은 다음과 같습니다.
엔진 변수 : leaf_failover_fanout
설정 값
paired (기본값) : 가용그룹 1과 2는 상대 그룹의 Leaf노드와 쌍(pair)을 맺어, 각 쌍 끼리 복제본을 배치
load_balanced : 각 Leaf노드의 복제 파티션들을 상대 가용그룹의 Leaf노드에 골고루 배치
확인 방법
singlestore> show variables like 'leaf_failover_fanout'; +----------------------+--------+ | Variable_name | Value | +----------------------+--------+ | leaf_failover_fanout | paired | +----------------------+--------+
Bash
복사

HA 활성화 확인 - 방법 #1

노드 목록에서 가용그룹(Availability Group)이 1, 2 로 나눠졌는지 확인합니다.
$ sdb-admin list-nodes +------------+------------+------+------+---------------+--------------+---------+----------------+--------------------+--------------+ | MemSQL ID | Role | Host | Port | Process State | Connectable? | Version | Recovery State | Availability Group | Bind Address | +------------+------------+------+------+---------------+--------------+---------+----------------+--------------------+--------------+ | CA4A5F8A37 | Master | ma | 3306 | Running | True | 8.5.16 | Online | | 0.0.0.0 | | A557CFC555 | Aggregator | ca | 3306 | Running | True | 8.5.16 | Online | | 0.0.0.0 | | 7660E2E74C | Leaf | lf1 | 3306 | Running | True | 8.5.16 | Online | 1 | 0.0.0.0 | | 0EC9E69070 | Leaf | lf2 | 3306 | Running | True | 8.5.16 | Online | 2 | 0.0.0.0 | +------------+------------+------+------+---------------+--------------+---------+----------------+--------------------+--------------+
Bash
복사

HA 활성화 확인 - 방법 #2

생성된 데이터베이스(예: test)의 파티션 정보가 Master/Slave 로 나눠져 있는지 확인합니다.
singlestore> show partitions on test; +---------+------+------+--------+--------+ | Ordinal | Host | Port | Role | Locked | +---------+------+------+--------+--------+ | 0 | lf1 | 3306 | Master | 0 | | 0 | lf2 | 3306 | Slave | 0 | … 중략 … | 7 | lf1 | 3306 | Slave | 0 | | 7 | lf2 | 3306 | Master | 0 | +---------+------+------+--------+--------+
Bash
복사

참고 : Leaf노드 상태 확인

Leaf노드가 클러스터에서 제거된 상태
상태 정보 : Role = Unknown, Recovery State = Recovering
+------------+------------+------+------+---------------+--------------+---------+----------------+--------------------+--------------+ | MemSQL ID | Role | Host | Port | Process State | Connectable? | Version | Recovery State | Availability Group | Bind Address | +------------+------------+------+------+---------------+--------------+---------+----------------+--------------------+--------------+ | CA4A5F8A37 | Master | ma | 3306 | Running | True | 7.8.2 | Online | | 0.0.0.0 | | A557CFC555 | Aggregator | ca | 3306 | Running | True | 8.5.16 | Online | | 0.0.0.0 | | 7660E2E74C | Leaf | lf1 | 3306 | Running | True | 8.5.16 | Online | 1 | 0.0.0.0 | | 0EC9E69070 | Unknown | lf2 | 3306 | Running | True | 8.5.16 | Recovering | | 0.0.0.0 | +------------+------------+------+------+---------------+--------------+---------+----------------+--------------------+--------------+
Bash
복사
Leaf노드가 클러스터의 가용그룹 2에 추가된 상태
상태 정보 : Role = Leaf, Recovery State = Recovering, Availability Group = 2
+------------+------------+------+------+---------------+--------------+---------+----------------+--------------------+--------------+ | MemSQL ID | Role | Host | Port | Process State | Connectable? | Version | Recovery State | Availability Group | Bind Address | +------------+------------+------+------+---------------+--------------+---------+----------------+--------------------+--------------+ | CA4A5F8A37 | Master | ma | 3306 | Running | True | 8.5.16 | Online | | 0.0.0.0 | | A557CFC555 | Aggregator | ca | 3306 | Running | True | 8.5.16 | Online | | 0.0.0.0 | | 7660E2E74C | Leaf | lf1 | 3306 | Running | True | 8.5.16 | Online | 1 | 0.0.0.0 | | 0EC9E69070 | Leaf | lf2 | 3306 | Running | True | 8.5.16 | Recovering | 2 | 0.0.0.0 | +------------+------------+------+------+---------------+--------------+---------+----------------+--------------------+--------------+
Bash
복사

HA 활성화 절차

기존 Leaf노드에서 HA 활성화

기존 Leaf 노드 구성을 그대로 두고 HA를 활성화하려면, sdb-admin enable-high-availability 명령을 한 번 실행하는 것만으로 자동으로 진행됩니다.
유의 사항
클러스터의 Leaf 노드 중 절반이 가용그룹 2로 이동하며, 이 과정은 Offline 작업입니다.
데이터의 복제복이 생성되므로, 이를 위한 메모리 또는 디스크 여유 공간이 필요합니다.
$ sdb-admin enable-high-availability -y Toolbox will perform the following actions to upgrade the cluster to redundancy 2 · Configure the cluster to enable redundancy · Remove leaf nodes that need to be re-assigned to availability group 2 - remove leaf node lf2:3306 · Add back existing leaf nodes and reassign them to availability group 2 - add leaf node lf2:3306 into availability group 2 · Restore redundancy on each database - Restore redundancy on database "test" Would you like to continue? [Y/n]: Automatically selected yes, non-interactive mode enabled ✓ Set cluster redundancy level to 2 ✓ Removed leaf lf2:3306 from cluster ✓ Re-added lf2:3306 to cluster ✓ Executed `RESTORE REDUNDANCY ON "test"` Operation completed successfully
Bash
복사
참고 : sdb-admin enable-high-availability의 세부 절차
세부 절차는 비공식적으로 이해를 돕기 위해 정리된 것으로, v8.5.16에서만 시험되었습니다. HA 활성화를 위해서는 클러스터 버전에 맞는 공식 절차(link iconEnabling High Availability · SingleStore Documentation)를 따르시기 바랍니다.
1.
Leaf노드 제거 (--force 옵션 사용)
2.
redundancy_ level값 2로 설정
3.
제거했던 Leaf노드 다시 추가
4.
복제(slave) 파티션 생성
# 1) Leaf노드 제거 $ sdb-admin remove-leaf --memsql-id 0EC9E69070 --force -y # 2) redundancy_ level 변경 (1->2) $ sdb-admin update-config --key redundancy_level --value 2 --set-global -y # 3) 제거했던 Leaf노드 다시 추가 $ sdb-admin add-leaf --memsql-id 0EC9E69070 -y # 4) 복제(slave) 파티션 생성 # 방법 1 : 각 database별로 복제본 생성 $ singlestore -p -e "restore redundancy on test" # 방법 2 : 일괄 수행 $ singlestore -p -e "rebalance all databases"
Bash
복사

새 Leaf노드를 추가하고 HA 활성화

1.
redundancy_ level값 2로 설정
a.
방법 1 : 쉘에서 toolbox 명령어 사용
$ sdb-admin update-config --key redundancy_level --value 2 --set-global -y
Bash
복사
b.
방법 2 : DB 세션에서 서버 설정 명령어 실행
singlestore> set global redundancy_level = 2; -- 또는 singlestore> set @@global.redundancy_level = 2;
Bash
복사
2.
새 Leaf노드 추가
다음 명령어들을 사용하여 새로운 Leaf노드를 추가합니다.
# 1) 새 호스트 등록 예시 $ sdb-toolbox-config register-host --host lf2 -y # 2) 새 노드 생성 및 추가 예시 $ sdb-admin create-node --role leaf --host lf2 --port 3306 --password <비번> --base-install-dir /data/nodes/LF2 -y
Bash
복사
3.
클러스터의 파티션 균형 재조정(rebalance)
-- 모든 database rebalance singlestore> rebalance all databases; -- 특정 database 하나씩 rebalance singlestore> rebalance partitions on <database_name>;
SQL
복사

HA 비 활성화 절차

1.
노드 제거 (가용그룹 2 전체)
sdb-admin remove-leaf 명령을 통해 가용그룹(Availability Group) 2에 속해 있는 모든 Leaf 노드를 제거합니다.
# 가용그룹 2의 lf2:3306 제거 $ sdb-admin remove-leaf --yes --memsql-id 0EC9E69070 Toolbox will perform the following actions on host lf2: · Run 'memsqlctl remove-leaf --host lf2 --port 3306' Would you like to continue? [Y/n]: Automatically selected yes, non-interactive mode enabled ✓ Successfully ran 'memsqlctl remove-leaf' Operation completed successfully
Bash
복사
2.
redundancy_level 값 1 로 설정
$ sdb-admin update-config --key redundancy_level --value 1 --set-global -y Toolbox is about to run 'memsqlctl update-config --key redundancy_level --value 1 --set-global' on the following nodes: - On host ma: + CA4A5F8A37D8FA229A58ED77F6EC94E35895826E Would you like to continue? [Y/n]: Automatically selected yes, non-interactive mode enabled ✓ Updated configuration on host ma +------------------------------------------+----------------------------------+---------+ | MemsqlID | Message | Result | +------------------------------------------+----------------------------------+---------+ | CA4A5F8A37D8FA229A58ED77F6EC94E35895826E | Updated configuration on host ma | changed | +------------------------------------------+----------------------------------+---------+
Bash
복사
3.
제거된 노드를 다시 가용그룹 1에 추가 (선택사항)
# 가용그룹 2의 lf2:3306 $ sdb-admin add-leaf --yes --password <비번> --memsql-id 0EC9E69070 Toolbox will perform the following actions on host lf2: · Run 'memsqlctl add-leaf --host lf2 --port 3306 --user root --password ●●●●●●' Would you like to continue? [Y/n]: Automatically selected yes, non-interactive mode enabled ✓ Successfully ran 'memsqlctl add-leaf'
Bash
복사
4.
클러스터의 파티션 균형 재조정 및 고아 파티션 정리
singlestore> clear orphan databases; Query OK, 0 rows affected (2.48 sec) singlestore> rebalance all databases; Query OK, 1 row affected (3.92 sec)
Bash
복사
5.
클러스터의 노드 확인
$ sdb-admin list-nodes +------------+------------+------+------+---------------+--------------+---------+----------------+--------------------+--------------+ | MemSQL ID | Role | Host | Port | Process State | Connectable? | Version | Recovery State | Availability Group | Bind Address | +------------+------------+------+------+---------------+--------------+---------+----------------+--------------------+--------------+ | CA4A5F8A37 | Master | ma | 3306 | Running | True | 8.5.16 | Online | | 0.0.0.0 | | A557CFC555 | Aggregator | ca | 3306 | Running | True | 8.5.16 | Online | | 0.0.0.0 | | 7660E2E74C | Leaf | lf1 | 3306 | Running | True | 8.5.16 | Online | 1 | 0.0.0.0 | | 0EC9E69070 | Leaf | lf2 | 3306 | Running | True | 8.5.16 | Online | 1 | 0.0.0.0 | +------------+------------+------+------+---------------+--------------+---------+----------------+--------------------+--------------+
Bash
복사
일자
작성자
비고
2022.04.27
min
2022.04.29
min
leaf node 2개 추가
2022.07.27
kkh
주의 사항 추가
2022.08.18
kkh
rebalance 내용 변경
2022.09.01
wee
orphan, rebalance 순서 변경
2025.02.03
kkh
유의 사항 정리, HA모드, HA 활성화 2가지 유형 추가 등