ãã®è¨äºã¯ ã¯ã©ã¦ãã¯ã¼ã¯ã¹ Advent Calendar 2024 ã·ãªã¼ãº3 11æ¥ç®ã®è¨äºã§ãã
ããã«ã¡ã¯ãã¯ã©ã¦ãã¯ã¼ã¯ã¹ SRE ãã¼ã ã®ç°ä¸ï¼@kangaechuï¼ã§ãã ã¯ã©ã¦ãã¯ã¼ã¯ã¹ ã§ã¯2024å¹´12æã« ã¯ã©ã¦ãã¯ã¼ã¯ã¹ã®ãã¹ã¿ãã¼ã¿ãã¼ã¹ãMySQL ãã Aurora ã«ç§»è¡ãã¾ãããä»åã¯ãã®ç§»è¡ã«ã¤ãã¦æ¸ãã¾ãã
ã¯ã©ã¦ãã¯ã¼ã¯ã¹ã¯ã2012å¹´ã«ãªãªã¼ã¹ãããæ¥æ¬æ大ç´ã®ã¯ã©ã¦ãã½ã¼ã·ã³ã°ãµã¼ãã¹ã§ãã ã¯ã©ã¦ãã½ã¼ã·ã³ã°ãéãã¦ãä¼æ¥ã¨ããªã¼ã©ã³ã¹ã®ãããã³ã°ãè¡ããæ¥åã®å¹çåãæ¯æ´ãããããä»äºã®å ¬éãå¿åãå注ãé²æ管çãå ±é ¬ã®æ¯æããªã©ããã¾ãã¾ãªæ©è½ãæä¾ãã¦ãã¾ãã ã¯ã©ã¤ã¢ã³ãæ°ã¯100ä¸ç¤¾ãã¯ã¼ã«ã¼æ°ã¯670ä¸äººã¨ãå¤ãã®æ¹ã«å©ç¨ãã¦ããã ãã¦ãã¾ãã
ãããªã¯ã©ã¦ãã¯ã¼ã¯ã¹ ã®ãã¼ã¿ãã¼ã¹ã¯AWSã®RDS MySQLã§éç¨ããã¦ãã¾ããã ãããAuroraã«ç§»è¡ããã®ã§ããããã移è¡ã«å¤±æããå ´åãå¤ãã®ã¦ã¼ã¶ã«å½±é¿ãä¸ãã¦ãã¾ãã¾ãã 移è¡ã«å¤±æãããã©ããããã¨ããä¸å®ãæ±ãã¦ãã¾ããã
ããã§ãã¯ã©ã¦ãã¯ã¼ã¯ã¹ã§ä½¿ç¨ãããããªã®ããã®Aurora移è¡ã®æ¹æ³ãå ±æãã¾ãã ãããè¡ããã¨ã«ãããAuroraåã失æããå ´åã§ãRDSã«æ»ããã¨ãã§ãã¾ãã
移è¡æ¦è¦
- â RDS for MySQLï¼Aurora移è¡åã®ãã¹ã¿ãã¼ã¿ãã¼ã¹ï¼
- â¡ Auroraï¼Aurora移è¡å¾ã®ãã¹ã¿ãã¼ã¿ãã¼ã¹ï¼
- ⢠Aurora Replicaï¼DMSã®ã½ã¼ã¹DBã¨ãã¦ä½¿ç¨ï¼
- ⣠RDS for MySQLï¼å¤±ææã®ãªã«ããªç¨ï¼
AWSã®ããã¥ã¡ã³ãã«ã¯ç§»è¡ã®æ¹å¼ãè¤æ°è¨è¼ããã¦ãã¾ãã ä»åã¯Aurora ãªã¼ãã¬ããªã«ã使ç¨ããAuroraãææ ¼ãããã¨ã§ç§»è¡ãè¡ãæ¹å¼ãé¸æãã¾ããã
é常ã¯â ã®RDSã«å¯¾ããâ¡ã®Auroraã®ãªã¼ãã¬ããªã«ãä½æãããã¨ã§ç§»è¡ãè¡ãã¾ãã ãã®ãããâ ã¨â¡ã®ãã¼ã¿ãã¼ã¹ã®ã¿ä½æããã°æä½éã®ç§»è¡ç°å¢ã¯æ´ãã¾ãã
ã¯ã©ã¦ãã¯ã¼ã¯ã¹ã§ã¯ãDMS (Database Migration Service)ã使ç¨ããRedshiftã¸ã®ãã¢ãªã¢ã«ã¿ã¤ã ã¬ããªã±ã¼ã·ã§ã³ãè¡ãªã£ã¦ãã¾ãã â¢ã«ã¤ãã¦ã¯ãDMSã®ã¬ããªã±ã¼ã·ã§ã³ã®ã½ã¼ã¹ãã¼ã¿ãã¼ã¹ã¨ãã¦ä½¿ç¨ããããã«ä½æãã¾ãã
ä¸è¨ã®è¨äºå ã«è©³ç´°ãããã¾ãããDMSã¿ã¹ã¯ã®åæ¢æã«DMSããã©ã³ã¶ã¯ã·ã§ã³ãèªã¿é£ã°ããã°ããããããâ¢ã®Auroraãã¼ã¿ãã¼ã¹ãæãæ§æã¨ãã¦ãã¾ãã RDSã使ç¨ãããã¨ãã§ããã®ã§ããããAuroraã®ã¹ãããã·ã§ããããRDSãä½æãããã¨ãã§ããªããã¨ããå¶ç´ã«ãããä»å¾ãã¼ã¿ãã¼ã¹ãåä½æãããã¨ããã¨ãã«å°ãå¯è½æ§ããããããAuroraã使ç¨ãã¦ãã¾ãã â¡ã®Auroraââ¢ã®Auroraã¯æ¡å¼µbinlogã使ç¨ããã¬ããªã±ã¼ã·ã§ã³ãã§ãããããâ¡ã®Auroraãã¼ã¿ãã¼ã¹ã®è¨å®ã§æ¡å¼µbinlogãæå¹åãã¦ãã¾ãã
ï¼â¢âDMSã¸ã®ã¬ããªã±ã¼ã·ã§ã³ã¯æ¡å¼µbinlogããµãã¼ããã¦ããªããããã³ãã¥ãã㣠MySQL binlogã使ç¨ãã¾ãããã®ããæ¡å¼µbinlogã®è¨å®ã¯ããã©ã«ãã®ã¾ã¾ã«ãã¦ãã¾ããï¼
AWS DMS doesn't support Aurora MySQL enhanced binary log. https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.MySQL.html
ä»åéè¦ã¨ãªããã¼ã¿ãã¼ã¹ããã®â£ã«ãªãã¾ãã â£ã¯Auroraå失ææã®ãªã«ããªç¨ã¨ãã¦ãRDSã追å ãã¦ãã¾ãã ãã¡ãã¯Auroraå失ææã«â ã®ä»£ããã«ä½¿ç¨ããããã«ä½æãã¦ãã¾ãã AuroraããRDSã®ã¬ããªã±ã¼ã·ã§ã³ãã§ããã®ããæ°ã«ãªãæ¹ãããã£ããããã¨æãã¾ãããAWSãµãã¼ãã«ã¬ããªã±ã¼ã·ã§ã³ãã§ãããã¨ã¯ç¢ºèªæ¸ã¿ã§ãã
移è¡æé ã®è©³ç´°
移è¡èªä½ã¯ã·ã¹ãã ã¡ã³ããã³ã¹ãè¡ãããµã¼ãã¹åæ¢å¾ã«â¡ã®Auroraãã¼ã¿ãã¼ã¹ãææ ¼ããã ãã§ããã¨ã¦ãç°¡åã§ããã ææ ¼å¾ã¯Webãµã¼ãã¹ã®è¨å®ãå¤æ´ããAuroraãã¼ã¿ãã¼ã¹ãåç §ããããã«ããã°ç§»è¡å®äºã§ãã ããã«ãããâ ã®RDSãã¼ã¿ãã¼ã¹ã¯ã¬ããªã±ã¼ã·ã§ã³ããåãé¢ããã¾ãã
æ£å¸¸ã«åããã¨ã確èªããããâ£ã®RDSãã¼ã¿ãã¼ã¹ãåé¤ãã¾ãã
移è¡å¤±ææã®ãªã«ããª
移è¡ã«å¤±æããå ´åã¯â£ã®RDSãã¼ã¿ãã¼ã¹ãã¬ããªã±ã¼ã·ã§ã³ããåãé¢ããWebãµã¼ãã¹ã®è¨å®ãå¤æ´ãã¦â£ã®ãã¼ã¿ãã¼ã¹ãåç §ããããã«ãã¾ãã ã¾ããDMSã¸ã®ã¬ããªã±ã¼ã·ã§ã³ãç¶ç¶ããããã«â£ââ¡ã®ã¬ããªã±ã¼ã·ã§ã³è¨å®ãè¡ãã¾ãã
移è¡ã«åããä½æ¥
0. GTIDã®æå¹å
移è¡æã«binlogã®ãã¸ã·ã§ã³ãæå®ãã¦ãªã«ããªããå¯è½æ§ããããããGTIDãæå¹åãã¾ãã
1. â ã«binlogã¬ããªã±ã¼ã·ã§ã³ç¨ã®ã¦ã¼ã¶ãä½æ
â ã®ãã¼ã¿ãã¼ã¹ã«ã¬ããªã±ã¼ã·ã§ã³ç¨ã®ã¦ã¼ã¶ãä½æãã¾ãã â èªä½ã¯ãã®ã¦ã¼ã¶ã使ç¨ãã¾ããããå¾ã å¿ è¦ã«ãªãã¾ãã
CREATE USER 'replication'@'ï¼CIDRï¼' IDENTIFIED BY '***'; GRANT REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO 'replication'@'ï¼CIDRï¼';
2. binlogã®ä¿ææéãå¤æ´
RDS for MySQLãAuroraã§ã¯binlogã®ä¿ææéãæå®ããããã®ããã·ã¼ã¸ã£ãç¨æããã¦ãã¾ãã
binlogã®ä¿ææéã®ããã©ã«ãã¯NULLï¼ãã¤ããªãã°ãä¿æããªãï¼ã§ãã æ大å¤ã¯RDSã§168ï¼7æ¥ï¼ãAuroraã§2160ï¼90æ¥ï¼ã§ãã
移è¡ä¸ã¯â£ã®binlogãä¿æããå¿ è¦ããããããâ£ã®ä¿ææéã移è¡å¤±æã¾ã§ã®æéã¾ã§ä¿æããããããé·ãã«è¨å®ãã¾ãã
-- ç¾å¨ã®ç¶æ ãç¢ºèª CALL mysql.rds_show_configuration; -- binlogã®ä¿ææéãè¨å® CALL mysql.rds_set_configuration('binlog retention hours', 168);
binlogã®ä¿ææéã伸ã°ãã¨ãRDS/Auroraã®ã¹ãã¬ã¼ã¸å®¹éãå¢ãããããå¿ è¦ã§ããã°äºåã«æ¡å¼µãã¦ããã¾ãã
3. â¡ã®Auroraãã¼ã¿ãã¼ã¹ãä½æ
Auroraãã¼ã¿ãã¼ã¹ãä½æãã¾ãã ããã¸ã¡ã³ãã³ã³ã½ã¼ã«ããã§ããã°ããã¢ã¯ã·ã§ã³âãªã¼ãã¬ããªã«ã®ä½æããé¸æãã¾ãã Terraformã§ããã°ãaws_rds_clusterãªã½ã¼ã¹ã« replication_source_identifierãæå®ãã¦ä½æãã¾ãã
resource "aws_rds_cluster" "no_2" { replication_source_identifier = "no-1" engine = "aurora-mysql" engine_version = "8.0.mysql_aurora.3.07.1" ...
4. â¢ã®Auroraãã¼ã¿ãã¼ã¹ãä½æ
â¡ã®ã¹ãããã·ã§ãããä½æããâ¢ã®Auroraãã¼ã¿ãã¼ã¹ãä½æãã¾ãã Terraformã§ããã°ãaws_rds_clusterãªã½ã¼ã¹ã« snapshot_identifierãæå®ãã¦ä½æãã¾ãã
â¢ã®Auroraãã¼ã¿ãã¼ã¹ã®ãã©ã¡ã¼ã¿ã°ã«ã¼ãã«ã¯binlogãæå¹åããè¨å®ã追å ãã¾ãã
5. â¡ââ¢ã®ã¬ããªã±ã¼ã·ã§ã³è¨å®
AuroraâAuroraã®ã¬ããªã±ã¼ã·ã§ã³è¨å®ãè¡ãã¾ãã ããã¸ã¡ã³ãã³ã³ã½ã¼ã«ããã¯å®è¡ã§ããªããããâ¢ã®ãã¼ã¿ãã¼ã¹ã«ãã°ã¤ã³ããMySQLã®ã³ãã³ãã使ç¨ãã¾ãã
-- â¢ããâ¡ã«å¯¾ããã¬ããªã±ã¼ã·ã§ã³ãè¨å® mysql> CALL mysql.rds_set_external_source_with_auto_position('ï¼â¡ã®ãã¹ãåï¼' , 3306, 'replication', '********', 0); Query OK, 0 rows affected, 6 warnings (0.17 sec) -- ã¬ããªã±ã¼ã·ã§ã³ãéå§ mysql> CALL mysql.rds_start_replication; +---------------------------+ | Message | +---------------------------+ | Replica running normally. | +---------------------------+ 1 row in set (2.26 sec) Query OK, 0 rows affected (2.26 sec) -- ã¬ããªã±ã¼ã·ã§ã³ã®ç¶æ ãç¢ºèª mysql> SHOW REPLICA STATUS\G *************************** 1. row *************************** Replica_IO_State: Waiting for source to send event (çç¥) 1 row in set (0.01 sec)
è¨å®å¾ãâ ã®ãã¼ã¿ãã¼ã¹ã§ä½ããã®å¤æ´ãçºçããããããâ¢ã«åæ ããããã¨ã確èªãã¾ãã
6. â ã®ã¹ãããã·ã§ããããâ£ã®RDSãã¼ã¿ãã¼ã¹ãä½æ
â ã®ã¹ãããã·ã§ããããâ£ã®RDSãã¼ã¿ãã¼ã¹ãä½æãã¾ãã Terraformã§ããã°ãaws_db_instanceãªã½ã¼ã¹ã« snapshot_identifierãæå®ãã¦ä½æãã¾ãã
7. â¢ââ£ã®ã¬ããªã±ã¼ã·ã§ã³è¨å®
移è¡å¤±ææã®ãªã«ããªç¨ã«ãâ¢ââ£ã®ã¬ããªã±ã¼ã·ã§ã³è¨å®ãè¡ãã¾ãã ãã¡ããããã¸ã¡ã³ãã³ã³ã½ã¼ã«ããã¯å®è¡ã§ããªããããâ£ã®ãã¼ã¿ãã¼ã¹ã«ãã°ã¤ã³ããMySQLã®ã³ãã³ãã使ç¨ãã¾ãã
-- â¢ããâ£ã«å¯¾ããã¬ããªã±ã¼ã·ã§ã³ãè¨å® mysql> CALL mysql.rds_set_external_master_with_auto_position('ï¼â¢ã®ãã¹ãåï¼' , 3306, 'replication', '********', 0); +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Message | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | rds_set_external_master_with_auto_position is deprecated and will be removed in a future release. Use rds_set_external_source_with_auto_position instead. Refer to the documentation for more information on deprecated statements | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.17 sec) Query OK, 0 rows affected, 6 warnings (0.17 sec) -- ã¬ããªã±ã¼ã·ã§ã³ãéå§ mysql> CALL mysql.rds_start_replication; +---------------------------+ | Message | +---------------------------+ | Replica running normally. | +---------------------------+ 1 row in set (2.26 sec) Query OK, 0 rows affected (2.26 sec) -- ã¬ããªã±ã¼ã·ã§ã³ã®ç¶æ ãç¢ºèª mysql> SHOW REPLICA STATUS\G *************************** 1. row *************************** Replica_IO_State: Waiting for source to send event (çç¥) 1 row in set (0.01 sec)
移è¡å¤±ææã®ãªã«ããª
ã·ã¹ãã ã¡ã³ããã³ã¹ã§ãµã¼ãã¹ãåæ¢ããDBã¸ã®ãªã¯ã¨ã¹ãããªãç¶æ ã§éå§ãã¾ãã
1. â£ã®RDSãã¼ã¿ãã¼ã¹ãã¬ããªã±ã¼ã·ã§ã³ããåãé¢ã
â£ã®RDSãã¼ã¿ãã¼ã¹ãâ ç¸å½ã¨ãã¦ä½¿ç¨ãããããã¬ããªã±ã¼ã·ã§ã³ããåãé¢ãã¾ãã â£ã®ãã¼ã¿ãã¼ã¹ã«ãã°ã¤ã³ããAWSãæºåãã mysql.rds_reset_external_master ããã·ã¼ã¸ã£ã使ç¨ãã¾ãã
mysql> CALL mysql.rds_reset_external_master; +----------------------+ | message | +----------------------+ | Slave has been reset | +----------------------+ 1 row in set (2.04 sec) Query OK, 0 rows affected, 1 warning (2.04 sec) mysql> SHOW REPLICA STATUS\G Empty set (0.01 sec)
2. Webãµã¼ãã®æ¥ç¶å ãâ£ã«å¤æ´
Webãµã¼ãã®æ¥ç¶å ãâ£ã«å¤æ´ãã¾ãã
3. â£ââ¡ã®ã¬ããªã±ã¼ã·ã§ã³è¨å®
ãã®ã¾ã¾ã§ã¯DMSã®ã¬ããªã±ã¼ã·ã§ã³ãéåãã¦ãã¾ããããâ£ââ¡ã®ã¬ããªã±ã¼ã·ã§ã³è¨å®ãè¡ãã¾ãã â¡ã®ãã¼ã¿ãã¼ã¹ã«ãã°ã¤ã³ããAWSãæºåãã mysql.rds_set_external_source_with_auto_position ããã·ã¼ã¸ã£ã使ç¨ãã¾ãã
-- ç¾å¨ã®ç¶æ ãç¢ºèª mysql> show replica status\G Empty set (0.00 sec) -- â£ããâ¡ã«å¯¾ããã¬ããªã±ã¼ã·ã§ã³ãè¨å® mysql> CALL mysql.rds_set_external_source_with_auto_position('â£ã®ãã¹ãå' , 3306, 'replication', '********', 0); Query OK, 0 rows affected (0.19 sec) -- ã¬ããªã±ã¼ã·ã§ã³ãéå§ mysql> CALL mysql.rds_start_replication; +------------------------------------------------------------------------------+ | Message | +------------------------------------------------------------------------------+ | Replica has encountered an error. Run SHOW REPLICA STATUS; to see the error. | +------------------------------------------------------------------------------+ 1 row in set (2.13 sec) Query OK, 0 rows affected (2.13 sec) -- ã¬ããªã±ã¼ã·ã§ã³ã®ç¶æ ãç¢ºèª mysql> SHOW REPLICA STATUS\G *************************** 1. row *************************** Replica_IO_State: Connecting to source (çç¥)
移è¡æã«æ³¨æãã¹ããã¤ã³ã
移è¡æã«ã¯ã¾ã£ããã¤ã³ããããã¤ãç´¹ä»ãã¾ãã
ã¬ããªã±ã¼ã·ã§ã³éå§æã«ERROR 1267 (HY000): Illegal mix of collations
ãçºçãã
ã¬ããªã±ã¼ã·ã§ã³éå§æã«ERROR 1267 (HY000): Illegal mix of collations (utf8mb3_general_ci,IMPLICIT) and (utf8mb3_unicode_ci,IMPLICIT) for operation '='
ãçºçããå ´åãããã¾ãã
ããã¯ãMySQL8.0ããæåã³ã¼ãã®ããã©ã«ããutf8mb4ã«ãªãã¾ããããMySQLã®å¤ããã¼ã¸ã§ã³ããã¢ãããã¼ãããã¤ã³ã¹ã¿ã³ã¹ã使ãç¶ãã¦ããå ´åã«çºçããå¯è½æ§ãããã¾ãã
AWSãµãã¼ãã«ä¾é ¼ãããã¨ããã·ã¼ã¸ã£ãä¿®æ£ãã¦ããã¾ãã
ãã«ãAZæã®ã¬ããªã±ã¼ã·ã§ã³ãé 延ãã
復æ§ç¨ã®ãã¼ã¿ãã¼ã¹ã¨ãã¦â£ã®RDSãã¼ã¿ãã¼ã¹ãä½æãã¾ããã復æ§æã®åãæ¿ããæ©ãããããå ã«ãã«ãAZãæå¹åããç¶æ ã§â ââ¡ââ¢ââ£ã®ã¬ããªã±ã¼ã·ã§ã³ãè¡ãã¨ãã¬ããªã±ã¼ã·ã§ã³é 延ãçºçãã¾ããã
ã·ã³ã°ã«æ§æã§ä½æãã復æ§æã«ãã«ãAZã«å¤æ´ãããã¨ã§ã¬ããªã±ã¼ã·ã§ã³é 延ãåé¿ã§ãã¾ããã ãã ããã«ãAZã«å¤æ´ããéã«ã¯20åç¨åº¦ãããããã復æ§ã«æéããããå¯è½æ§ãããã¾ãã
mysql.rds_set_external_source_with_auto_positionã«å¤±æãã
移è¡æã®æ§æã§ã¯GTIDãæå¹åãã¦ãã¾ãã
ãã®ç°å¢ã§â£ââ¡ã®ã¬ããªã±ã¼ã·ã§ã³æã« mysql.rds_set_external_source_with_auto_position
ãå®è¡ããã¨ã¬ããªã±ã¼ã·ã§ã³ã®éå§ã«å¤±æããã¨ã©ã¼ãçºçãã¾ããã
åå ã¯binlogã®ä¿ææéãçããããããGTIDã«å¯¾å¿ããbinlogãåé¤ããã¦ãããã¨ã§ããã
ã¾ããæ´æ°ãã¦ããªãRDSã®GTIDãé²ãã§ããçç±ã¯RDSã®ãã¼ããã¼ãã«ãããã®ã§ããã æ¤è¨¼ããç°å¢ã§ã¯RDSã®ã¿5åã«1åãã¼ããã¼ãã¨ãã¦ä»¥ä¸ã®ãããªã¯ã¨ãªãå®æçã«çºè¡ããã¦ãã¾ããã ããã«ãããGTIDã®ä½ç½®ãããã¦ãã¾ããã¬ããªã±ã¼ã·ã§ã³ãéå§ã§ããªãç¶æ ã«ãªãã¾ããã åèã¾ã§ã«ãã¼ããã¼ãã¯ãã®ãããªã¯ã¨ãªã§ããã
INSERT INTO mysql.rds_heartbeat2(id, value) values (1,1704034800000) ON DUPLICATE KEY UPDATE value = 1704034800000;
ãããã®ãã¼ããã¼ãã®ã¬ã³ã¼ãã¯ãªãã¦ãè¯ããããã¬ããªã±ã¼ã·ã§ã³å ã®ãã¼ã¿ãã¼ã¹ã§ãã®GTIDãã¹ããããããã¨ã§è§£æ±ºãã¾ããã
-- ç¾å¨ã®GTIDãç¢ºèª mysql> SELECT * FROM mysql.gtid_executed; +--------------------------------------+----------------+--------------+ | source_uuid | interval_start | interval_end | +--------------------------------------+----------------+--------------+ | 11111111-1111-1111-1111-111111111111 | 1 | 100 | +--------------------------------------+----------------+--------------+ 1 rows in set (0.00 sec) -- â£ââ¡ã®ã¬ããªã±ã¼ã·ã§ã³è¨å® mysql> CALL mysql.rds_set_external_source_with_auto_position('â£ã®ãã¹ãå' , 3306, 'replication', '********', 0, 0); Query OK, 0 rows affected, 7 warnings (0.05 sec) -- ã¬ããªã±ã¼ã·ã§ã³ãéå§ï¼ã¨ã©ã¼ï¼ mysql> CALL mysql.rds_start_replication; ERROR 1644 (45000): Slave has encountered an error. Run SHOW SLAVE STATUSG; to see the error. mysql> SHOW REPLICA STATUS\G (çç¥) Last_IO_Error: Got fatal error 1236 from source when reading data from binary log: 'Cannot replicate because the source purged required binary logs. Replicate the missing transactions from elsewhere, or provision a new replica from backup. Consider increasing the source's binary log expiration period. The GTID set sent by the replica is '11111111-1111-1111-1111-111111111111:1-100, and the missing transactions are '44444444-4444-4444-4444-444444444444:1' (çç¥) 1 row in set (0.00 sec) -- ã½ã¼ã¹å´ã®ãã¼ã¿ãã¼ã¹ã«44444444-4444-4444-4444-444444444444:1ã®GTIDãããããbinlogãåé¤ããã¦ããããã¬ããªã±ã¼ã·ã§ã³ãéå§ã§ããªãç¶æ -- â£ã®ãã¼ã¿ãã¼ã¹ã«44444444-4444-4444-4444-444444444444:1ã®GTIDã追å mysql> SET GTID_NEXT='44444444-4444-4444-4444-444444444444:1'; Query OK, 0 rows affected (0.00 sec) mysql> BEGIN;COMMIT; Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.01 sec) -- GTIDã追å ããããã¨ãç¢ºèª mysql> SELECT * FROM mysql.gtid_executed; +--------------------------------------+----------------+--------------+ | source_uuid | interval_start | interval_end | +--------------------------------------+----------------+--------------+ | 11111111-1111-1111-1111-111111111111 | 1 | 100 | | 44444444-4444-4444-4444-444444444444 | 1 | 1 | +--------------------------------------+----------------+--------------+ 2 rows in set (0.00 sec) -- GTIDã追å ããããã¨ã確èªï¼show master statusã®æ¹ãåæ ãæ©ãï¼ mysql> show master status; +-----------------------------+----------+--------------+------------------+------------------------------------------------------------------------------------------------------------------------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +-----------------------------+----------+--------------+------------------+------------------------------------------------------------------------------------------------------------------------------------+ | mysql-bin-changelog.1481979 | 111 | | | 11111111-1111-1111-1111-111111111111:1-100, 44444444-4444-4444-4444-444444444444:1| +-----------------------------+----------+--------------+------------------+------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec) -- GTIDã®è¨å®ãæ»ã mysql> SET GTID_NEXT='AUTOMATIC'; Query OK, 0 rows affected (0.00 sec) -- ã¬ããªã±ã¼ã·ã§ã³ã®ç¶æ³ãç¢ºèª -- GTIDã追å ããã¦ããã°èªåã§ã¬ããªã±ã¼ã·ã§ã³ãéå§ããã mysql> show replica status\G *************************** 1. row *************************** Replica_IO_State: Waiting for master to send event
ã¾ã¨ã
ã¯ã©ã¦ãã¯ã¼ã¯ã¹ã§ã¯ãRDS for MySQLããAuroraã¸ã®ç§»è¡ãè¡ãã¾ããã 移è¡èªä½ã¯Auroraãã¼ã¿ãã¼ã¹ãææ ¼ããã ãã§ç°¡åã§ããã移è¡å¤±ææã®ãªã«ããªãèæ ®ããã¨è¤éã«ãªãã¾ãã ããããªããããä¸è¨ã®æé ã§ãªã«ããªã®æé ã使ããã¨ãªã移è¡ãçµãããã¨ãã§ãã¾ããã
ã¯ã©ã¦ãã¯ã¼ã¯ã¹ã§ã¯SREãå«ãã¨ã³ã¸ãã¢ãåéãã¦ãã¾ããèå³ã®ããæ¹ã¯ä»¥ä¸ã®ãªã³ã¯ãããå¿åãã ããã https://crowdworks.co.jp/careers/mid_career/