반응형

3scale 백업복원 테스트를 하다가 지금껏 뜨지 않았떤 에러를 발견했다.

 

복원 과정 끝에 모든 서비스를 재기동하는데,

system-app 재기동과정에서 hook pod에서 Error가 떨어지는 것이였다.

 

에러내용은 아래와 같았다.

rake aborted!
StandardError: An error has occurred, all later migrations canceled:

Index name 'index_email_configurations_on_account_id' on table 'email_configurations' already exists

인덱스 index_email_configurations_on_account_id 가 email_configurations table에 이미 존재한다는 에러였다.

해결방법은 매우 간단하다.

3scale database 인 mysql pod 에 접근해서 email_configurations table을 삭제해주면 된다.

 

DB 접속정보확인

system-database secret에서 db 접속 정보 확인하기

$ oc get secret system-database -o yaml | grep DB_USER: | awk '{print $2}' | base64 --decode
$ oc get secret system-database -o yaml | grep DB_PASSWORD: | awk '{print $2}' | base64 --decode

 

DB POD 접속하기

$ oc exec $(oc get pods -l 'deploymentConfig=system-mysql' -o json | jq '.items[0].metadata.name' -r) -it bash

 

mysql db 접속하기

$ mysql -u mysql -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 546
Server version: 8.0.26 Source distribution

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

 

테이블 제거

3scale 데이터베이스 이름은 system이다.

(혹시 데이터베이스이름이 다르다면 show databases; 로 확인하자.)

mysql> use system;
mysql> drop table email_configurations;

 

이제 다시 system-app를 rollout 해주면 정상적으로 진행된다.

반응형
복사했습니다!