Skip to end of metadata
Go to start of metadata

SonarQube has no built-in feature allowing to setup an active-active or active-passive cluster. It's up to you to setup it. 

Here are guidelines to setup an active-passive cluster.

Note:

  • this page is for SonarQube Server only and doesn't deal with database.
  • Server1 is active and Server2 is passive

Setup

  1. Server1 is started and connected to DB : ServerID is generated and Licenses are correctly set
  2. Server2 is a copy of Server1 and is stopped
  3. Change Server2 JDBC configuration to use the default embedded H2 DB
  4. Start Server2 and generate the ServerID
  5. Ask to contact@sonarsource.com the licenses corresponding to Server2's ServerID
  6. Stop Server2
  7. Change Server2 JDBC configuration to the real DB

BAU Process

  1. Have a rsync that syncs $SONAR_HOME/conf and $SONAR_HOME/extensions directories, between Server1 and Server2 every X hours
  2. Every nights, backup ES indices to avoid long rebuild of them: 
    1. Stop SonarQube Server1
    2. Do a rsync that syncs $SONAR_HOME/data/es of Server1 and Server2
    3. Start SonarQube Server1

In Case of Failure

Server1 is down.

  1. Start Server2
  2. Have a script using the SQ API to set the Organisation, IP, ServerID and Licenses gathered during the Setup phase

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" where $1 is the key of a commercial plugin and $LICENSE its license

  • No labels