Loading...
MySQL 9.5 Reference Manual 9.5의 19 Replication의 한국어 번역본입니다.
아래의 경우에 피드백에서 신고해주신다면 반영하겠습니다.
감사합니다 :)
Table of Contents
19.1 Configuring Replication
19.1.1 Binary Log File Position Based Replication Configuration Overview
19.1.2 Setting Up Binary Log File Position Based Replication
19.1.3 Replication with Global Transaction Identifiers
19.1.4 Changing GTID Mode on Online Servers
19.1.5 MySQL Multi-Source Replication
19.1.6 Replication and Binary Logging Options and Variables
19.1.7 Common Replication Administration Tasks
19.2 Replication Implementation
19.2.1 Replication Formats
19.2.2 Replication Channels
19.2.3 Replication Threads
19.2.4 Relay Log and Replication Metadata Repositories
19.2.5 How Servers Evaluate Replication Filtering Rules
19.3 Replication Security
19.3.1 Setting Up Replication to Use Encrypted Connections
19.3.2 Encrypting Binary Log Files and Relay Log Files
19.3.3 Replication Privilege Checks
19.4 Replication Solutions
19.4.1 Using Replication for Backups
19.4.2 Handling an Unexpected Halt of a Replica
19.4.3 Monitoring Row-based Replication
19.4.4 Using Replication with Different Source and Replica Storage Engines
19.4.5 Using Replication for Scale-Out
19.4.6 Replicating Different Databases to Different Replicas
19.4.7 Improving Replication Performance
19.4.8 Switching Sources During Failover
19.4.9 Switching Sources and Replicas with Asynchronous Connection Failover
19.4.10 Semisynchronous Replication
19.4.11 Delayed Replication
19.5 Replication Notes and Tips
19.5.1 Replication Features and Issues
19.5.2 Replication Compatibility Between MySQL Versions
19.5.3 Upgrading or Downgrading a Replication Topology
19.5.4 Troubleshooting Replication
19.5.5 How to Report Replication Bugs or Problems
Replication은 한 MySQL 데이터베이스 서버(소스로 알려짐)의 데이터를 하나 이상의 MySQL 데이터베이스 서버(Replica로 알려짐)로 복사할 수 있게 해 줍니다. Replication은 기본적으로 비동기식이며, Replica는 소스로부터 업데이트를 받기 위해 항상 연결되어 있을 필요는 없습니다. 설정에 따라 모든 데이터베이스, 선택된 데이터베이스, 또는 하나의 데이터베이스 내에서 선택된 테이블만 복제할 수 있습니다.
MySQL에서 Replication의 장점은 다음과 같습니다:
Scale-out 솔루션 - 여러 Replica에 부하를 분산하여 성능을 향상합니다. 이 환경에서 모든 write와 update는 source 서버에서 수행되어야 합니다. 그러나 read는 하나 이상의 Replica에서 수행될 수 있습니다. 이 모델은 (source가 update에 전념하므로) write의 성능을 향상시키는 동시에, 증가하는 수의 Replica 전반에 걸쳐 read 속도를 극적으로 증가시킬 수 있습니다.
데이터 보안 - Replica가 replication 프로세스를 일시 중지할 수 있으므로, 해당 source 데이터에 손상을 주지 않고 Replica에서 백업 서비스를 실행할 수 있습니다.
분석 - 실시간 데이터는 source에서 생성되는 동안, 해당 정보의 분석은 source의 성능에 영향을 주지 않고 Replica에서 수행될 수 있습니다.
장거리 데이터 분산 - source에 대한 지속적인 액세스 없이, 원격 사이트에서 사용할 수 있도록 데이터의 로컬 복사본을 생성하기 위해 Replication을 사용할 수 있습니다.
이러한 시나리오에서 Replication을 사용하는 방법에 대한 정보는 Section 19.4, “Replication Solutions”을 참조하십시오.
MySQL 9.5는 서로 다른 방식의 Replication을 지원합니다. 전통적인 방식은 source의 binary log에서 이벤트를 복제하는 것에 기반하며, source와 Replica 간에 로그 파일 및 그 안의 위치가 동기화되어야 합니다. Global transaction identifiers(GTID)에 기반한 새로운 방식은 트랜잭션 기반이며, 따라서 로그 파일이나 그 안의 위치로 작업할 필요가 없어, 많은 일반적인 Replication 작업을 크게 단순화합니다.
GTID를 사용하는 Replication은 source에서 커밋된 모든 트랜잭션이 Replica에도 적용되기만 하면 source와 Replica 간의 일관성을 보장합니다. MySQL에서 GTID 및 GTID 기반 Replication에 대한 더 자세한 정보는 Section 19.1.3, “Replication with Global Transaction Identifiers”를 참조하십시오. Binary log file position 기반 Replication 사용에 대한 정보는 Section 19.1, “Configuring Replication”을 참조하십시오.
MySQL의 Replication은 서로 다른 유형의 동기화를 지원합니다. 원래의 동기화 유형은 단방향, 비동기식 Replication으로, 하나의 서버가 source 역할을 하고 하나 이상의 다른 서버가 Replica 역할을 합니다. 이는 NDB Cluster의 특성인 synchronous Replication과는 대조적입니다( Chapter 25, MySQL NDB Cluster 9.5 참조).
MySQL 9.5에서는 기본 제공 비동기식 Replication에 더해 반동기식 Replication도 지원됩니다. 반동기식 Replication에서 source에서 수행된 커밋은, 트랜잭션을 실행한 세션으로 제어를 반환하기 전에, 적어도 하나의 Replica가 해당 트랜잭션의 이벤트를 수신하고 로그에 기록했음을 확인할 때까지 블록됩니다. 자세한 내용은 Section 19.4.10, “Semisynchronous Replication”을 참조하십시오.
MySQL 9.5는 또한 Replica가 의도적으로 source보다 최소 지정된 시간만큼 뒤처지도록 하는 지연 Replication도 지원합니다. 자세한 내용은 Section 19.4.11, “Delayed Replication”을 참조하십시오. synchronous Replication이 필요한 시나리오에서는 NDB Cluster를 사용하십시오( Chapter 25, MySQL NDB Cluster 9.5 참조).
서버 간 Replication을 설정하기 위한 다양한 솔루션이 존재하며, 사용하기에 가장 좋은 방법은 데이터의 존재 여부와 사용 중인 엔진 타입에 따라 달라집니다. 사용 가능한 옵션에 대한 자세한 정보는 Section 19.1.2, “Setting Up Binary Log File Position Based Replication”을 참조하십시오.
Replication format에는 두 가지 핵심 유형이 있습니다. 전체 SQL statement를 복제하는 Statement Based Replication(SBR)과 변경된 row만 복제하는 Row Based Replication(RBR)입니다. 세 번째 유형인 Mixed Based Replication(MBR)을 사용할 수도 있습니다. 서로 다른 Replication format에 대한 더 자세한 정보는 Section 19.2.1, “Replication Formats”을 참조하십시오.
Replication은 여러 가지 다른 옵션과 변수들을 통해 제어됩니다. 자세한 내용은 Section 19.1.6, “Replication and Binary Logging Options and Variables”을 참조하십시오. 추가적인 보안 조치는 Section 19.3, “Replication Security”에 설명된 대로 Replication 토폴로지에 적용될 수 있습니다.
Replication은 성능, 서로 다른 데이터베이스의 백업 지원, 그리고 시스템 장애를 완화하기 위한 더 큰 솔루션의 일부 등 다양한 문제를 해결하는 데 사용할 수 있습니다. 이러한 이슈를 해결하는 방법에 대한 정보는 Section 19.4, “Replication Solutions”을 참조하십시오.
서로 다른 데이터 타입과 statement가 Replication 중에 어떻게 처리되는지, Replication 기능, 버전 호환성, 업그레이드, 잠재적인 문제와 그 해결 방법의 세부 사항을 포함한 참고 사항과 팁에 대해서는 Section 19.5, “Replication Notes and Tips”을 참조하십시오. MySQL Replication을 처음 접하는 사용자들이 자주 묻는 몇 가지 질문에 대한 답변은 Section A.14, “MySQL 9.5 FAQ: Replication”을 참조하십시오.
Replication의 구현, Replication이 작동하는 방식, binary log의 프로세스와 내용, 백그라운드 스레드 및 statement를 기록하고 복제하는 방법을 결정하는 데 사용되는 규칙에 대한 자세한 정보는 Section 19.2, “Replication Implementation”을 참조하십시오.
18.11.2 The Common Database Server Layer
19.1 Configuring Replication