Upgrade to Pro — share decks privately, control downloads, hide ads and more …

こわくないRDS B/Gデプロイ

そめやポチ
September 14, 2023
1.1k

こわくないRDS B/Gデプロイ

RDS B/Gデプロイで本番環境のDBをMySQL5.7から8.0にアップグレードしたので知⾒を共有します。2023年のペパボテックカンファレンス「夏のSREまつり」で喋ったときの資料です。

そめやポチ

September 14, 2023
Tweet

Transcript

  1. 2 こんにちは GMOペパボ 技術部プラットフォームグループ 2022年 新卒⼊社 染⽮ 健⼈ Someya Kento

    • ペパボでいろんなサービスのプラットフォームを 壊したり直したりしています • 社内ではpochy(そめやポチ)と呼ばせています • 好きなアザラシはワモンアザラシです • 各種サービスでのID : @kesompochy
  2. 6 https://aws.amazon.com/jp/about-aws/whats-new/2023/09/amazon-aurora-rds-extended-support-mysql-postgresql-databases/ > Amazon Relational Database Service (RDS) は、MySQL 5.7、PostgreSQL

    11、およびそれ以降のメジャーバージョンを 実行している Amazon Aurora および Amazon RDS データ ベースインスタンスの Amazon RDS 延長サポートを、コミュニ ティのサポート終了後も継続いたします。
  3. 7 https://docs.aws.amazon.com/ja_jp/AmazonRDS/latest/UserGuide/extended-support.html > With Amazon RDS Extended Support, you can

    continue running your database on a major engine version past the RDS end of standard support date for an additional cost.
  4. 8 https://docs.aws.amazon.com/ja_jp/AmazonRDS/latest/UserGuide/extended-support.html > With Amazon RDS Extended Support, you can

    continue running your database on a major engine version past the RDS end of standard support date for an additional cost.
  5. 10 今⽇話すこと 1. MySQLのサポート終了について 2. 対象サービス「minne」のDBについて 3. よくあるDBアップグレード戦略 4. RDS

    B/Gデプロイの説明 5. RDS B/Gデプロイを試してみて分かったこと、分からなかったこと
  6. 今回DBバージョンが上がったサービス 13 - ハンドメイドマーケットサービス - readもwriteも常時そこそこある - 新機能の開発が盛ん - スキーマ変更も頻繁にある

    - INSTANT DDL (MySQL 8.0.12 ~)が使えると嬉しい - DBはRDS for MySQL - Primary - Replica minneについて \オフラインイベントやるよ/
  7. RDS B/Gデプロイ 18 - DBでBGデプロイができる - 本番環境と同期するステージング環境が作られる - ステージング環境でのreadの検証ができる -

    ダウンタイム少なく切り替えができる - 公式ドキュメントによると通常1分以内 - 切り替え時に接続先情報を変更する必要がない - GUIポチポチで済むので楽ちん - 2022年12⽉に提供が開始された機能 RDSのB/Gデプロイについて
  8. 35

  9. 実際にやってみて初めて気づいた挙動の紹介 36 - BGデプロイ識別⼦のステータスが「無効な設定」となる - その状態での切り替えはできない - それぞれのDBに接続はできる - 同じスナップショットから作ったインスタンスで、この現象が起きる場合と起きない場

    合があった - 同じスナップショットから作ったインスタンスでのインプレースでのアップグレードはできた - インスタンスサイズは原因ではなさそう - パラメータグループは原因ではなさそう - 原因不明...... 「切り替え可能」にならないときがある
  10. 実際にやってみて初めて気づいた挙動の紹介 38 - Replicaインスタンスのbinlog retention hoursを⼿動で変更していた MySQLの設定値に引き継がれないものがある mysql> call mysql.rds_set_configuration('binlog

    retention hours', 72); Query OK, 0 rows affected (0.00 sec) mysql> call mysql.rds_show_configuration; +------------------------+-------+-----------------------------------------------------------------------------------------------------------+ | name | value | description | +------------------------+-------+-----------------------------------------------------------------------------------------------------------+ | binlog retention hours | 72 | binlog retention hours specifies the duration in hours before binary logs are automatically deleted. | | source delay | 0 | source delay specifies replication delay in seconds between current instance and its master. | | target delay | 0 | target delay specifies replication delay in seconds between current instance and its future read-replica. | +------------------------+-------+-----------------------------------------------------------------------------------------------------------+ 3 rows in set (0.01 sec) Query OK, 0 rows affected (0.01 sec)
  11. 実際にやってみて初めて気づいた挙動の紹介 39 - Green環境のReplicaインスタンスではNULLになっていた...... MySQLの設定値に引き継がれないものがある mysql> call mysql.rds_show_configuration; +------------------------+-------+-----------------------------------------------------------------------------------------------------------+ |

    name | value | description | +------------------------+-------+-----------------------------------------------------------------------------------------------------------+ | binlog retention hours | NULL | binlog retention hours specifies the duration in hours before binary logs are automatically deleted. | | source delay | 0 | source delay specifies replication delay in seconds between current instance and its master. | | target delay | 0 | target delay specifies replication delay in seconds between current instance and its future read-replica. | +------------------------+-------+-----------------------------------------------------------------------------------------------------------+ 3 rows in set (0.00 sec) Query OK, 0 rows affected (0.00 sec)
  12. 実際にやってみて初めて気づいた挙動の紹介 - Debezium ServerによるCDC(Change Data Capture)を実施している - binlogを読んで変更内容をBigQueryへ送る - インスタンスが変わると読むbinlogも別になる

    - 切り替え後もCDCを続けるならDebezium Server側での初期化処理が必要 「BlueとGreenとでインスタンスは別物」で引っかかった事例 45 Debezium ServerによるChange Data Captureの事例紹介
  13. We're hiring! We're hiring! We're hiring! We're hiring! We're hiring!

    We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring!We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring!We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring!We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring!We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring!We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring!We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring!We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring!We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring!We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring!We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! We're hiring! 48 おわり