LoginSignup
0
0

RDSのカスタムエンドポイントを設定したらインスタンスのフェイルオーバ優先度も設定する

Posted at

はじめに

Amazon RDSのカスタムエンドポイントを設定した場合、フェイルオーバーの優先度も確認する。

問題

RDSのカスタムエンドポイントを利用してリーダーインスタンスの用途を分割したい場合がある。例えば、検索が重い管理画面の参照を専用インスタンスに分けたい場合などが該当する。

複数のカスタムエンドポイントを作成した場合、インスタンスのフェイルオーバー優先度も設定しないと、フェイルオーバをさせたくないインスタンスがライターインスタンスに昇格してしまう可能性がある。仮にスペックの低いインスタンスがライターに昇格することで、アプリケーション全体のSQL性能劣化が起こってしまう。

解決方法

カスタムエンドポイントを利用する場合は、インスタンスのフェイルオーバー優先度も設定する。設定は0から15まで可能で、デフォルトは0(最優先)となっている。フェイルオーバーをさせたくないインスタンスは1以上の値を設定する。

Terraformの設定例

フェイルオーバー優先度15(promotion_tier = 15)を設定する例は以下の通り。

resource "aws_rds_cluster_instance" "admin" {
  cluster_identifier = aws_rds_cluster.this.id
  identifier = "${aws_rds_cluster.this.cluster_identifier}-admin-0"
  instance_class = local.env.rds.instance_class_admin
  engine = aws_rds_cluster.this.engine
  engine_version = aws_rds_cluster.this.engine_version
  db_subnet_group_name = aws_rds_cluster.this.db_subnet_group_name
  apply_immediately = aws_rds_cluster.this.apply_immediately
  copy_tags_to_snapshot = aws_rds_cluster.this.copy_tags_to_snapshot
  auto_minor_version_upgrade = false
  performance_insights_enabled = true
  db_parameter_group_name = aws_db_parameter_group.this.name
  promotion_tier = 15

  preferred_maintenance_window = aws_rds_cluster.this.preferred_maintenance_window
}

影響

なし。

無停止で設定できる。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0