0
0

【MYSQL】Check the status of the database if this condition persists が出る

Posted at

エラーログ

[WARN] Database "dev-db-01" at 172.31.0.167:3306 became unavailable for access from 172.31.0.8. Check the status of the database if this condition persists.

原因

このエラーは、RDSプロキシがデータベースインスタンスに接続できない場合に発生します。

対処方法

  1. RDSインスタンスの状態確認

    • AWS CLIまたはコンソールでRDSインスタンスの状態を確認:
    aws rds describe-db-instances --db-instance-identifier dev-db-01 --query 'DBInstances[0].DBInstanceStatus'
    
  2. セキュリティグループの設定確認

    • RDSインスタンスとRDSプロキシのセキュリティグループを確認:
    resource "aws_security_group_rule" "rds_proxy_to_rds" {
      type                     = "ingress"
      from_port                = 3306
      to_port                  = 3306
      protocol                 = "tcp"
      source_security_group_id = aws_security_group.rds_proxy.id
      security_group_id        = aws_security_group.rds.id
    }
    
  3. ネットワーク設定の確認

    • RDSインスタンス、RDSプロキシ、Lambda関数が同じVPCとサブネットにあることを確認
    • 必要に応じてVPCエンドポイントを設定
  4. RDSプロキシのログ確認

    • デバッグログを有効にして詳細な情報を取得:
    resource "aws_db_proxy" "rds_proxy_db_dump" {
      # 他の設定...
      debug_logging = true
    }
    

これらの対処方法を順番に試すことで、多くの接続問題を解決できます。問題が解決しない場合は、AWS Supportに連絡するか、より詳細なログ分析が必要になる可能性があります。

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