Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Table of Contents

Sonar 데이터베이스 복제 도구(Sonar DB Copy Tool)은 SonarQube Enterprise EditionSupported in Enterprise Edition에 포함되어 있으며, 서로 다른 데이터베이스 벤더 간 마이그레이션 프로세스를 지원합니다.

Oracle 데이터베이스를 사용하던 SonarQube 인스턴스를 히스토리 데이터의 누락없이 MySQL 데이터베이스로 이전한다고 가정해 봅니다. 이와 같은 경우 Sonar 데이터베이스 복제 도구는 매우 유용합니다. 다음 절에서 source 및 target SonarQube 데이터베이스 인스턴스에 대해 이야기합니다. source 인스턴스는 사용을 중지하고자 하는 데이터베이스를 사용하는 인스턴스이며, target 인스턴스는 새로운 데이터베이스를 사용하는 인스턴스입니다.

Sonar 데이터베이스 복제 도구는 다음과 같이 동작합니다:

  • source 데이터베이스와 target 데이터베이스를 연결합니다.
  • source 데이터베이스를 테이블 단위로 읽습니다.
  • target 데이터베이스에 테이블 단위로 기록합니다.
  • target 데이터베이스에 sequences, index 등의 정보를 다시 생성합니다.

설치

The Sonar DB Copy Tool is provided as a standalone JAR file. It must not be installed on your source or target SonarQube instance. Put the JAR wherever your want in your machine, the only prerequisites is that this machine must be authorized to access your source and target SonarQube database.

데이터베이스 복제 준비 단계

The goal is to ask your SonarQube Server to create for you the tables (without content) and to have at the end a database schema equals on the source and target database.

  1. Your source and target database must be up and running
  2. Your SonarQube instance must be temporary stopped during the preparation and the running phase
  3. On your target database, create an empty schema (without the tables)

  4. Configure your SonarQube instance so it connects to the target database. (change properties in your conf/sonar.properties)

  5. Start your SonarQube that is going to connect to your empty target database
  6. Once your instance is up and running, you MUST stop it
  7. At this step, you have on your source and target database the exact same list of tables.
  8. Refresh the Database Statistics on the target database before restarting SonarQube

 

SonarQube version

If using a separate SonarQube instance for steps #4, #5 and #6, make sure it runs the same SonarQube version as the original one.

데이터베이스 복제 실행 단계

다음 명령어를 실행합니다:

java -jar sonar-db-copy-1.1-jar-with-dependencies.jar

 

파라미터:

Name

Value

Required ?

Description

-driverDest<jdbc driver>선택target 데이터베이스의 JDBC Driver
-driverSrc<jdbc driver>선택source 데이터베이스의 JDBC Driver
-help  parameter help 출력
-urlSrc<jdbc url>필수source 데이터베이스의 JDBC URL
-userSrc<login>필수source 데이터베이스의 username
-pwdSrc<password>필수source 데이터베이스의 password
-urlDest<jdbc url>필수target 데이터베이스의 JDBC URL
-userDest<login>필수target 데이터베이스의 username
-pwdDest<password>필수target 데이터베이스의 password
-T 선택마이그레이션 대상 테이블 (,로 구분)

실행 예시

가장 먼저, sonar-db-copy 명령어는 입력한 URL에 대한 접근 가능 여부 및 데이터베이스 버전을 확인합니다:

버전이 다른 경우: 어플리케이션은 중지됩니다.

복제를 재시작하는 경우, target 데이터베이스 버전은 0이 됩니다: 오류 상황은 아니며, 복제는 계속됩니다.

이후 source 및 target(destination) 데이터베이스의 테이블을 검색합니다:

누락된 테이블이 존재하는 경우, 다음 로그를 표시합니다:

다음으로, sonar-db-copy 는 target 데이터베이스의 테이블의 길이를 줄이고, 제거한 테이블 수를 표시합니다:

물론, 누락된 테이블은 제거하지 않습니다:

다음으로, sonar-db-copy는 source 데이터베이스의 데이터를 target 데이터베이스로 복제하고, 복제 후 target 데이터베이스의 순서를 조정합니다:

누락된 테이블이 존재하는 경우:

복제 중 오류가 발생하는 경우, 오류 메시지를 표시하고 복제를 진행합니다:

마지막으로 sonar-db-copy는 source 데이터베이스와 target 데이터베이스의 차이를 표시합니다.


  • No labels