This plugin allows making Gerrit highly available by having redundant Gerrit masters.
The masters must be:
Currently, the only mode supported is one primary (active) master and one backup (passive) master but eventually the plan is to support n
active masters. In the active/passive mode, the active master is handling all traffic while the passive is kept updated to be always ready to take over.
Even if database and git repositories are shared by the masters, there are a few areas of concern in order to be able to switch traffic between masters in a transparent manner from the user's perspective. The 4 areas of concern are things that Gerrit stores either in memory or locally in the review site:
They need either to be shared or kept local to each master but synchronized. This plugin needs to be installed in both masters and will take care of sharing or synchronizing them.
Every time a cache eviction occurs in one of the masters, the eviction will be forwarded the other master so its caches do not contain stale entries.
Every time the secondary index is modified in one of the masters, e.g., a change is added, updated or removed from the index, the other master's index is updated accordingly. This way, both indexes are kept synchronized.
Every time a stream event occurs in one of the masters (see [more events info] (https://gerrit-review.googlesource.com/Documentation/cmd-stream-events.html#events)), the event is forwarded to the other master which re-plays it. This way, the output of the stream-events command is the same, no matter which master a client is connected to.
The built-in Gerrit H2 based web session cache is replaced with a file based implementation that is shared amongst both masters.
Prerequisites:
For both masters:
Here is an example of the minimal @PLUGIN@.config:
Primary master
[main] sharedDirectory = /directory/accessible/from/both/masters [peerInfo "static"] url = http://backupMasterHost:8081/ [http] user = username password = password
Backup master
[main] sharedDirectory = /directory/accessible/from/both/masters [peerInfo "static"] url = http://primaryMasterHost:8080/ [http] user = username password = password
For further information and supported options, refer to config documentation.