Panel | ||||
---|---|---|---|---|
| ||||
Table of Contents
|
Sonar 데이터베이스 복제 도구(Sonar DB Copy Tool)은 SonarQube Enterprise Edition
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.
- Your source and target database must be up and running
- Your SonarQube instance must be temporary stopped during the preparation and the running phase
On your target database, create an empty schema (without the tables)
Configure your SonarQube instance so it connects to the target database. (change properties in your conf/sonar.properties)
- Start your SonarQube that is going to connect to your empty target database
- Once your instance is up and running, you MUST stop it
- At this step, you have on your source and target database the exact same list of tables.
- 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.
데이터베이스 복제 실행 단계
다음 명령어를 실행합니다:
|
파라미터:
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 데이터베이스의 차이를 표시합니다.