スティルハウスの書庫の書庫

はてなダイアリーで書いてた「スティルハウスの書庫」を移転してきました。

Amazon RDSの運用メモ

ただいまAmazon RDSで実運用環境を絶賛構築中! ドキュメントから運用や構成上で気になるところだけメモしました:

http://aws.amazon.com/rds/faqs/
http://docs.amazonwebservices.com/AmazonRDS/latest/DeveloperGuide/index.html?Overview.BackingUpUpAndRestoringAmazonRDSInstances.html

メンテナンス時間帯(maintenance window)とは何か?

Q: What is a maintenance window? Will my DB Instance be available during software maintenance?
    Any system changes (such as patching the database software) or modifications you have requested (such as scaling DB Instance class or storage capacity) will be completed within a weekly four hour maintenance window. The only time we will take your DB Instance offline is for backups or software patching; patching should seldom require more than a fraction of your maintenance window, occurs infrequently, and is used only for patches that are security or durability related. If you did not specify a preferred maintenance window when creating your DB Instance, a default value is assigned (such as Sun:05:00-Sun:09:00 UTC for DB Instances in the US-East region). Ideally this window should fall at the time of lowest database usage and thus may need to be modified. If you wish to modify when maintenance is performed on your behalf, you can do so using the ModifyDBInstance API. Each of your DB Instances can have different preferred maintenance windows, if you so choose. For more information on using the APIs or command line interface to specify your maintenance window, please refer to the Amazon RDS Developer Guide.
  • DBインスタンス等の容量変更は、週1回4時間のメンテナンス時間帯に適用される
  • バックアップまたはパッチ適用時のみDBがオフラインになる
  • パッチ適用はセキュリティやデータ耐久性に関連するパッチのみを対象として少ない頻度で実施され、短い時間で完了する
  • デフォルトのメンテナンス時間帯は日本時間の日曜午後2時〜午後6時(US Eastの場合)
  • 個々のDBインスタンスごとにModifyDBInstance APIでメンテナンス時間帯を設定も可能

MySQLのクリティカルなパッチは必ず適用されるか? 特定のパッチを除外できるか?

Q: Does Amazon RDS always update the relational database software with critical patches? Can I opt out of particular patches?
    Automatically performing critical updates to the MySQL database software powering your DB Instance is a core function of Amazon RDS and cannot be turned off. However, as previously mentioned, you can control the time of the maintenance window when patches are applied to minimize the operational impact of patching. At this point in time, you cannot opt-out of critical patches to the MySQL software. However, you will be informed about upcoming patches via the Amazon RDS forums.
  • MySQLへのクリティカルなパッチ適用はAmazon RDSの主要な機能であり、停止できない
  • ただし、パッチ適用はメンテナンス時間帯に行われるので、作業の影響は最小限に抑えられる
  • 現時点では特定パッチの適用除外はできないが、適用されるパッチの内容はAmazon RDSフォーラムを通じて告知される

DBインスタンスに割り当てたメモリやCPUを拡張する方法は?

Q: How do I scale the compute resources and/or storage capacity associated with my RDS database instance?
    You can scale the compute resources and storage capacity allocated to your DB Instance with the ModifyDBInstance API. Memory and CPU resources are modified by changing your DB Instance class, and storage available is changed when you modify your storage allocation. Please note that when you modify your DB Instance class or allocated storage using the ModifyDBInstance API, your requested changes will be applied during your specified maintenance window. Alternately, you can use the “apply-immediately” flag to apply your scaling requests immediately. Bear in mind that any other pending system changes will be applied as well.
  • ModifyDBInstance APIで拡張できる
  • メモリおよびCPUを増減するにはDBインスタンスクラスを変更する。ストレージ容量はストレージ割り当て設定で変更可能。
  • 変更結果は指定したメンテナンス時間帯に他の変更点と合わせて適用される。もしくは、直ちに適用することも可能

拡張中もDBインスタンスを利用可能か?

Q: Will my DB Instance remain available during scaling?
    The storage capacity allocated to your DB Instance can be increased while maintaining DB Instance availability. However, when you decide to scale the compute resources available to your DB Instance up or down, your database will be temporarily unavailable while the DB Instance class is modified. This period of unavailability typically lasts only a few minutes, and will occur during the maintenance window for your DB Instance, unless you specify that the modification should be applied immediately.
  • DBインスタンスに割り当てるストレージ容量は、DBインスタンスを稼働させたまま拡張できる
  • ただしCPU/メモリの増減時は、DBインスタンスクラスの変更となるため、メンテナンス時間帯(もしくは即時指定は即時)に数分間サービスが停止する

「自動バックアップ」と「DBスナップショット」の違いは?

Q: What is the difference between RDS automated backups and DB Snapshots?
    Amazon RDS provides two different methods for backing up and restoring your DB Instance(s): automated backups and database snapshots (DB Snapshots). The automated backup feature of Amazon RDS automatically performs a daily backup of your data (during your preferred backup window) and captures transaction logs (constantly). Amazon RDS retains backups of a DB Instance for a limited, user-specified period of time called the retention period, which by default is one day; your database can later be recovered to any point in time within the retention period, up to the last available transaction log. You can use the DescribeDBInstances API to return the latest restorable time for you DB Instance(s). 
  • 自動バックアップ
    • データ全体のバックアップ(1日1回指定したバックアップ時間帯に実行)
    • トランザクションログのバックアップ(継続的に実行)
  • DBインスタンスのバックアップ内容は、保持期間(retention period)と呼ばれる指定した期間(デフォルトは1日)だけ保持される
  • DBのリストア時には、この保持期間から最新のトランザクションログ記録時点までの任意時点の内容をリストアできる
    • (RDSのトップページには「up to the last five minutes/最短で5分前まで」と記されている)
DB Snapshots are user-initiated and enable you to back up your DB Instance in a known state as frequently as you wish, and then restore to that specific state at any time. DB Snapshots can be created with the CreateDBSnapshot API and are kept until you explicitly delete them with the DeleteDBSnapshot API. Please note: When you perform a restore operation to a point in time or from a DB Snapshot, a new DB Instance is created with a new endpoint (the old DB Instance can be deleted with the DeleteDBInstance API, if so desired).
  • DBスナップショット
    • 任意時点のDBインスタンスの内容を記録でき、任意のタイミングでリストアできる
    • CreateDBSnapshot APIでスナップショットを作成すると、DeleteDBSnapshot APIで削除するまで保持される
    • DBスナップショットからのリスト味には新しいDBインスタンスが作成される(古いDBインスタンスはDeleteDBInstace APIで削除できる)
NOTE: A brief I/O freeze (typically lasting a few minutes) will occur during both automated and user-initiated backup operations. 

NOTE: Amazon RDS plans to add a High Availability offering in a future release, which will maintain multiple complete copies of your data in different Availability Zones for greater levels of data durability.
  • 自動バックアップおよびユーザー起動バックアップ時には短時間(通常は2〜3分で終了)のI/Oフリーズが発生する
  • 異なるAvailability Zoneにデータをレプリケーションする高可用性オプションも将来的に提供予定