Aurora MySQL 주 버전 업그레이드 실패 원인 조사
자습서에서는 Aurora MySQL 버전 2에서 버전 3로 업그레이드하는 데 성공했습니다. 하지만 업그레이드가 실패했다면 그 이유를 알고 싶을 것입니다.
먼저 describe-events
AWS CLI 명령을 사용하여 DB 클러스터 이벤트를 살펴볼 수 있습니다. 이 예제는 지난 10시간 동안의 mydbcluster
에 대한 이벤트를 보여줍니다.
aws rds describe-events \ --source-type db-cluster \ --source-identifier mydbcluster \ --duration 600
이 경우 업그레이드 사전 점검에 실패한 것이 원인입니다.
{ "Events": [ { "SourceIdentifier": "mydbcluster", "SourceType": "db-cluster", "Message": "Database cluster engine version upgrade started.", "EventCategories": [ "maintenance" ], "Date": "2024-04-11T13:23:22.846000+00:00", "SourceArn": "arn:aws:rds:us-east-1:123456789012:cluster:mydbcluster" }, { "SourceIdentifier": "mydbcluster", "SourceType": "db-cluster", "Message": "Database cluster is in a state that cannot be upgraded: Upgrade prechecks failed. For more details, see the upgrade-prechecks.log file. For more information on troubleshooting the cause of the upgrade failure, see https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Upgrading.Troubleshooting.html", "EventCategories": [ "maintenance" ], "Date": "2024-04-11T13:23:24.373000+00:00", "SourceArn": "arn:aws:rds:us-east-1:123456789012:cluster:mydbcluster" } ] }
문제의 정확한 원인을 진단하려면 라이터 DB 인스턴스에 대한 데이터베이스 로그를 검사합니다. Aurora MySQL 버전 3으로 업그레이드할 때 실패하면 라이터 인스턴스에 upgrade-prechecks.log
라는 이름의 로그 파일이 포함됩니다. 이 예에서는 해당 로그의 존재를 감지한 다음 검사를 위해 로컬 파일로 다운로드하는 방법을 보여줍니다.
aws rds describe-db-log-files --db-instance-identifier mydbcluster-instance \ --query '*[].[LogFileName]' --output text error/mysql-error-running.log error/mysql-error-running.log.2024-04-11.20 error/mysql-error-running.log.2024-04-11.21 error/mysql-error.log external/mysql-external.log upgrade-prechecks.log aws rds download-db-log-file-portion --db-instance-identifier mydbcluster-instance \ --log-file-name upgrade-prechecks.log \ --starting-token 0 \ --output text >upgrade_prechecks.log
upgrade-prechecks.log
파일은 JSON 형식입니다. 다른 JSON 래퍼 내에서 JSON 출력을 인코딩하지 않도록 --output text
옵션을 사용하여 다운로드합니다. Aurora MySQL 버전 3 업그레이드의 경우 이 로그에는 항상 특정 정보 메시시지와 경고 메시지가 포함됩니다. 업그레이드가 실패하는 경우에만 오류 메시지가 포함됩니다. 업그레이드가 성공하면 로그 파일이 생성되지 않습니다.
이러한 모든 오류를 요약하고 관련 객체 및 설명 필드를 표시하려면 upgrade-prechecks.log
파일의 내용에 관한 grep -A 2 '"level":
"Error"'
명령을 실행합니다. 그러기 위해 각 오류 줄과 그 뒤에 두 줄이 표시됩니다. 여기에는 해당 데이터베이스 객체의 이름과 문제 수정 방법에 대한 지침이 포함되어 있습니다.
$
cat upgrade-prechecks.log | grep -A 2 '"level": "Error"' "level": "Error", "dbObject": "problematic_upgrade.dangling_fulltext_index", "description": "Table `problematic_upgrade.dangling_fulltext_index` contains dangling FULLTEXT index. Kindly recreate the table before upgrade."
이 예제에서는 문제가 되는 테이블에서 다음 SQL 명령을 실행하여 문제를 해결하거나, 누락된 인덱스 없이 테이블을 다시 생성할 수 있습니다.
OPTIMIZE TABLE problematic_upgrade.dangling_fulltext_index;
그런 다음 업그레이드를 다시 시도하세요.