-
2024.03.31 MMM galera clusterTIL 2024. 3. 31. 16:20
회사에서 DB이중화 구조로 MMM을 사용 중임.
galera cluster를 통해 구현되어 있음.
문제
많은 양의 row 업데이트가 일어난 트랜잭션이 다른 노드에게 전파되는데 좀 오래걸리는 거 같음.
해당 기능은 순차적으로 일어남 (1트랜잭션이 끝나고 2트랜잭션 시작 [트랜잭션은 각자 5000개 row를 CUD함])
다른 노드에 업데이트가 오래걸리니 읽기 시에 노든간의 데이터가 일치하지 않음. (어쩔때는 일치함)
테스트 DB는 단일 DB여서 이런 문제가 발생하지 않았지만 실DB는 이중화가 되어 있기 때문에 이런 문제가 발견되었음.
galera cluster는 논리적으로 동기화 구조이지만 실제로는 동기적으로 동작하지 않는다고함.https://dba.stackexchange.com/questions/203956/mysql-galera-cluster-mass-update-delay
MySQL Galera Cluster mass update delay
I have migrated my single MariaDB setup to a 3 node Galera cluster. I am currently in staging and most of normal operations run fine. I have one issue though: if I do a mass update of one column o...
dba.stackexchange.com
(여기도 대규모 업데이트가 다른 노드까지 복제되는데 몇 초가 걸린다고 함. 해결로는 작은 청크 단위로 많은 요청을 할 것을 추천하고 있음 또는 wsrep_causal_reads 설정을 켜서 트랜잭션 커밋이 될 때의 복제가 이뤄지는 이벤트를 다른 노드가 기다릴 수 있음. 다만 이것은 응답의 속도를 저하시킴)
궁금한 점은 MMM구조이지만 쓰기는 한대의 마스터에게만 될 텐데 쓰기가 있는 트랜잭션에서 읽기가 달라지는 이유가 궁금함. active-active 구조라서 모든 노드가 읽기 쓰기가 가능함인증 기반의 복제를 설명도 함
Products | Galera Cluster for MySQL
Use case Read Master Traditional MySQL master-slave topology, but with Galera all “slave” nodes are capable masters at all times, it is just the application who treats them as slaves. Galera replication can guarantee 0 slave lag for such installations
galeracluster.com
문서나 읽어보면서 더 원인 파악을 해봐야할 거 같음.
mysql 이중화 도움 동영상
master이지만 stand by일 경우 양방향 복제라고 불리는 이유는?
- failover 시 active로 변하게 되기 때문에 양방향이라고 봐야한다.
master slave와 active stand by의 차이점은 무엇인가
- active: 요청을 처리할 수 있는 시스템
- stand by (=passive = backup): active 장애 시 요청을 대신 처리하는 시스템
- master: write를 처리하는 active 시스템
- slave: master를 복제하며 read를 처리하는 active 시스템
master인데 stand by이면 read write가 가능한데 대기 상태
MySQL Replication
https://serverfault.com/questions/30605/how-fast-is-mysql-replication
How fast is MySQL replication?
I'm considering setting up replication of our mysql db to be able to have local slaves in each of our branch offices, while having the master in the main office to improve application performance (
serverfault.com
기존 master slave구조의 mysql replication에서는 master의 빈로그를 보고 slave가 replayed되는 것으로 알고 있다. master와 slave가 socket으로 연결되어 있고. mysql의 mmm에서도 같은 구조로 된다고 한다.
많은 양의 CUD는 재동기화를 유발할 수 있고 복제까지 시간이 걸릴 수 있다.
active-active 구조에서 pk 순번은?노드끼리 pk는 곂칠 수 있으니 다르게 해야한다.
1번 노드는 1,3,5,7로 증가한다면 2번 노드는 2,4,6,8로 증가해야한다
galera cluster에서는 pk값이 모든 테이블에 필요하다고 한다.
복제때문이라는데 auto increament 값을 추천하고 있다.
Write-Set Replication API란?
MySQL/MariaDB 환경에서 다중 마스터 복제를 지원하는 Galera Cluster 알아보기
MySQL/MariaDB 환경에서 다중 마스터 복제를 지원하는 Galera Cluster 알아보기 l Version : MySQL, MariaDB, Galera Cluster Galera Cluster (이하 “갈레라 클러스터”)는 다중 마스터 동기 복제를 제공하는 솔루션으로
sungwookkang.com
많은 양의 update transaction이 여러 노드로 들어갈 때 dead lock이 발생하는 이유도 있다.
old mysql 과 무엇이 다를까?https://galeracluster.com/2015/09/support-for-mysql-transaction-isolation-levels-in-galera-cluster/
Support for MySQL Transaction Isolation Levels in Galera Cluster | Galera Cluster for MySQL
This post was written by Seppo Jaakola, CEO of Codership. There appears to be great misunderstanding as to what MySQL transaction isolation levels Galera CLuster actually supports and how. This blog post tries to give answer to those uncertainties. Galera
galeracluster.com
https://sightstudio.tistory.com/59
Galera Cluster에 대해 알아보자
도입 현재 다니는 회사에서 RDBMS로 MariaDB를 사용하고 있습니다. 서비스가 규모가 있다보니 단일 DB로는 버틸 수 없기 때문에 Galera Cluster로 클러스터를 구성하여 사용하고있습니다. 오늘은 MariaDB/M
sightstudio.tistory.com
write-set이란?
Waits for InnoDB lock .. 의 의미?
https://galeracluster.com/library/training/tutorials/supporting-transaction-isolation-levels.html
Support for Transaction Isolation Levels — Galera Cluster Documentation
Support for Transaction Isolation Levels Length: 1009 words; Writer: Seppo Jaakola; Published: September 21, 2015; Topic: General; Level: Intermediate There appears to be great misunderstanding as to what MySQL transaction isolation levels Galera Cluster a
galeracluster.com
MMM이지만 하나만 write하게 하는 방법 중 하나는 lb를 사용하는 방법이 있을 수 있다.
https://scoutapm.com/blog/from-mysql-mmm-to-mariadb-galera-cluster-a-high-availability-makeover
From MySQL+MMM to MariaDB+Galera Cluster: A High Availability Makeover | Scout APM Blog
From MySQL+MMM to MariaDB+Galera Cluster: A High Availability Makeover Doug Breaker on September 24, 2013 Kevin Lawver, President @ Rails Machine, is our guest author for this post. Few things feel worst than rolling out a High Availability (HA) system,
scoutapm.com
[ MARIA ] Galera Cluster 구성
'TIL' 카테고리의 다른 글
2024.04.16 Multitenancy환경에서의 auth gateway (0) 2024.04.17 2024.04.06 spring kafka transaction isolation level, L4L7 (0) 2024.04.06 2024.02.25 AuthorizationManager (0) 2024.02.25 2024.02.23 DLT logging custom (0) 2024.02.23 2024.02.03 spring security Authorization Manager Method Security (0) 2024.02.03