Info |
---|
SQ Official Doc Link: https://docs.sonarqube.org/display/SONAR/How+To+Implement+an+Active-Passive+Cluster |
Panel | ||||
---|---|---|---|---|
| ||||
Table of Contents
|
SonarQube has no built-in feature allowing to setup an SonarQube는 active-active or 혹은 active-passive 클러스터(cluster. It's up to you to setup it. Here are guidelines to setup an active-passive cluster) 생성을 기본적으로 지원하지 않습니다. 사용자는 해당 설정을 직접 수행할 수 있습니다.
다음 가이드를 따라 active-passive 클러스터를 설정할 수 있습니다.
Note:
- this page is for SonarQube Server only and doesn't deal with database.
- Server1 is active and Server2 is passive
Setup
- Server1 is started and connected to DB : ServerID is generated and Licenses are correctly set
- Server2 is a copy of Server1 and is stopped
- Change Server2 JDBC configuration to use the default embedded H2 DB
- Start Server2 and generate the ServerID
- Ask to contact@sonarsource.com the licenses corresponding to Server2's ServerID
- Stop Server2
- Change Server2 JDBC configuration to the real DB
BAU Process
- Have a rsync that syncs $SONAR_HOME/conf and $SONAR_HOME/extensions directories, between Server1 and Server2 every X hours
- Every nights, backup ES indices to avoid long rebuild of them:
- Stop SonarQube Server1
- Do a rsync that syncs $SONAR_HOME/data/es of Server1 and Server2
- Start SonarQube Server1
In Case of Failure
Server1 is down.
- 본 섹션에서는 SonarQube 서버만을 다룹니다. Database는 다루지 않습니다.
- Server1은 active, Server2는 passive 입니다.
설정
- Server1은 DB에 연결되어 구동된 상태입니다: ServerID 생성 및 Licenses들이 정상적으로 설정되었습니다.
- Server2는 Server1을 복제한 것으로, 구동되지 않은 상태입니다.
- Server2가 기본 내장 데이터베이스인 H2 데이터베이스를 사용하도록 JDBC 환경을 수정합니다.
- Server2를 시작시킨 후 ServerID를 생성합니다.
- contact@sonarsrouce.com에 Server2의 ServerID와 관련된 라이선스를 문의합니다.
- Server2를 정지합니다.
- Server2가 실제 Database를 사용하도록 JDBC 환경을 수정합니다.
BAU 프로세스
- Server1과 Server2의 $SONARHOME/conf와 $SONARHOME/extentions 디렉토리를 X 시간 주기로 동기화하는 rsync를 설정합니다.
- 매일 ES 인덱스를 백업하여 인덱스를 장시간 재생성하지 않도록 합니다:
- SonarQube Server1을 정지합니다.
- rsync로 Server1, Server2의 $SONAR_HOME/data/es 디렉토리를 동기화합니다.
- SonarQube Server1을 재시작합니다.
실패하는 경우
Server1이 다운됩니다.
- Server2를 시작합니다.
- 설정하기 단계에서 수집된 Organisation, IP, ServerID License들을 설정하도록 SQ API를 사용해 스크립트를 작성합니다.
Web API URLS Sample
- curl -u admin:admin -X POST 'http://localhost:9000/api/properties?id=sonar.organisation&value=AlexCorp'
- curl -u admin:admin -X POST 'http://localhost:9000/api/properties?id=sonar.server
- id.ip
- address&value=192.168.0.1'
- curl -u admin:admin -X POST 'http://localhost:9000/api/properties?id=sonar.server_id&value=1cd5b4936302808'
- curl -s -u admin:admin -X POST "http://localhost:9000/api/properties?id=sonarsource.$1.license.secured&value=$LICENSE"
- ($1 은 상용 플러그인의 키값, $LICENSE는 해당 플러그인의 라이선스입니다)