[Amazon RDS] AWS PiTR Backup ์ ์šฉ ์‹œ, ์žฌ๋ถ€ํŒ…๋˜๋Š” ํ˜„์ƒ

2024. 1. 28. 23:29ใ†AWS

๊ฐœ์š”

RDS Intsance ์ƒ์„ฑ ํ›„, AWS ๋ฐฑ์—… ์ ์šฉ ์‹œ ์žฌ๋ถ€ํŒ… ํ˜„์ƒ ๋ฐœ์ƒ

 

ํ˜„์ƒ

(1) 2024-01-19 ์˜คํ›„

1. MariaDB RDS ์ƒ์„ฑ

  • Disable Automated Backup

2. AWS Backup ์„ค์ • (์ผ๋ฐ˜ ๋ฐฑ์—… & PiTR ๋ฐฑ์—…)

  • ์ผ๋ฐ˜ ๋ฐฑ์—…: Daily ๋ฐฑ์—…, ์˜ค์ „ 4์‹œ ๋ฐฑ์—… ์ˆ˜ํ–‰ ์‹œ์ž‘, 4์ฃผ ๋ณด๊ด€, Continuous Backup Disabled
  • PiTR ๋ฐฑ์—…: Daily ๋ฐฑ์—…, ์˜ค์ „ 4์‹œ ๋ฐฑ์—… ์ˆ˜ํ–‰ ์‹œ์ž‘, 4์ฃผ ๋ณด๊ด€, Continuous Backup Enabled

(2) 2024-01-20 ์˜ค์ „ 4์‹œ๊ฐ€๋Ÿ‰

1. Backup start

2. RDS Reboot

3. Backup Finished

 

 

๐Ÿ”ซ ์žฌ๋ถ€ํŒ… ์›์ธ ๋ถ„์„ 

RDS ์ƒ์„ฑ ์‹œ, ์ž๋™ ๋ฐฑ์—…์„ ๋น„ํ™œ์„ฑํ™”ํ•˜์˜€๊ธฐ ๋•Œ๋ฌธ์— Backup Retention Period(๋ฐฑ์—… ๋ณด๊ด€ ๊ธฐ๊ฐ„)์ด 0์ธ ์ฑ„๋กœ RDS ์ธ์Šคํ„ด์Šค๊ฐ€ ์ƒ์„ฑ๋˜์—ˆ๋‹ค. ์ดํ›„, AWS ๋ฐฑ์—… ์ค‘ PiTR ๋ฐฑ์—… ๊ด€๋ จ ํƒœ๊ทธ๋ฅผ RDS์— ์ ์šฉํ•˜๊ฒŒ ๋˜๋ฉด์„œ, RDS ์ธ์Šคํ„ด์Šค์˜ ๋ฐฑ์—… ๋ณด๊ด€ ๊ธฐ๊ฐ„์ด 28์ผ๋กœ ๋ณ€๊ฒฝ๋˜์—ˆ๋‹ค. ๋ฐฑ์—… ๋ณด๊ด€ ๊ธฐ๊ฐ„์„ 0์—์„œ 0์ด ์•„๋‹Œ ์ˆ˜ ํ˜น์€ 0์ด ์•„๋‹Œ ์ˆ˜์—์„œ 0์œผ๋กœ ๋ณ€๊ฒฝํ•˜๋ฉด ์žฌ๋ถ€ํŒ…์ด ๋ฐœ์ƒํ•˜๊ฒŒ ๋œ๋‹ค. PiTR ๋ฐฑ์—…์€ AWS Backup์„ ํ†ตํ•ด ์„ค์ •ํ•œ ๋ฐฑ์—… ์ •์ฑ…์ด์ง€๋งŒ, PiTR์„ ์ ์šฉํ•˜๋ฉด RDS์˜ ์ž๋™ ๋ฐฑ์—…์ด ํ™œ์„ฑํ™”๋˜๋ฉฐ, ์ด์— ๋”ฐ๋ผ ์ƒ์„ฑ ์‹œ ์„ค์ •ํ•ด ๋†“์€ ์ž๋™ ๋ฐฑ์—… ๋ณด์กด ๊ธฐ๊ฐ„์ด 0 → 28์ผ๋กœ ๋ณ€๊ฒฝ๋˜์—ˆ๋‹ค. (์ฐธ๊ณ : Amazon RDS DB ์ธ์Šคํ„ด์Šค ์ˆ˜์ • > ๋ฐฑ์—… ๋ณด๊ด€ ๊ธฐ๊ฐ„)

์‹ค์ œ๋กœ Cloudtrail์„ ํ™•์ธํ•ด ๋ณด๋ฉด, ModifyDBInstance event๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ,

   "eventTime": "2024-01-19T19:25:04Z",
    "eventSource": "rds.amazonaws.com",
    "eventName": "ModifyDBInstance",
    "awsRegion": "{region}",
    "sourceIPAddress": "backup.amazonaws.com",
    "userAgent": "backup.amazonaws.com",
    "requestParameters": {
        "allowMajorVersionUpgrade": false,
        "awsBackupRecoveryPointArn": "arn:aws:backup:{region}:{account-id}:recovery-point:continuous:db-{recovery-point-id}",
        "dBInstanceIdentifier": "{db-identifier}",
        "backupRetentionPeriod": 28,
        "preferredBackupWindow": "14:32-16:32",
        "applyImmediately": true
    },

cloudtrail event record ์ผ๋ถ€๋ฅผ ๋ฐœ์ทŒํ–ˆ์„ ๋•Œ, PiTR ๋ฐฑ์—…์ด ์ผ์–ด๋‚œ ์‹œ๊ฐ„์— AWS Backup์— ์˜ํ•ด RDS์˜ ๋ฐฑ์—… ๋ณด์กด ๊ธฐ๊ฐ„์ด 28์ผ๋กœ ๋ณ€๊ฒฝ๋˜์—ˆ์Œ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค. ์ฆ‰, PITR ๋ณด์กด ๊ธฐ๊ฐ„์„ ๋ณ€๊ฒฝํ•˜๋ฉด AWS Backup ๋ฅผ ModifyDBInstance ์š”์ฒญํ•˜๊ณ , ํ•ด๋‹น ๊ธฐ๊ฐ„์ด ์ฆ‰์‹œ ๋ณ€๊ฒฝํ•˜๋„๋ก ์ ์šฉํ•œ๋‹ค. (์ฐธ๊ณ : ์—ฐ์† ๋ฐฑ์—… ๋ฐ point-in-time ๋ณต์› (PITR) > RDS)

 

๊ถ๊ทน์ ์œผ๋กœ PiTR์„ ๋ณ€๊ฒฝํ•˜๋ฉด RDS๊ฐ€ ์žฌ๋ถ€ํŒ…์ด ๋˜๋Š” ์ด์œ ๋Š” ๋ญ˜๊นŒ?

PiTR ์„ ํ™œ์„ฑํ™”/๋น„ํ™œ์„ฑํ™”ํ•˜๊ธฐ ์œ„ํ•ด DB ํŒŒ๋ผ๋ฏธํ„ฐ ๋ณ€๊ฒฝ์ด ์ˆ˜ํ–‰๋˜๊ณ , ์ด๋ฅผ ์ ์šฉํ•˜๊ธฐ ์œ„ํ•ด DB ์ธ์Šคํ„ด์Šค๊ฐ€ ์žฌ์‹œ์ž‘๋œ๋‹ค. postgresql์˜ ๊ฒฝ์šฐ wal_level, archive_mode ํŒŒ๋ผ๋ฏธํ„ฐ๊ฐ€ ๋ณ€๊ฒฝ๋œ๋‹ค. (์ฐธ๊ณ : ์™œ RDS์˜ ์ž๋™๋ฐฑ์—…์„ ํ™œ์„ฑํ™”ํ•˜๋ฉด RDS๊ฐ€ ์žฌ์‹œ์ž‘๋ ๊นŒ?)