Multi-Master Configuration
This document describes how to setup multiple Gerrit master servers using shared back-ends: shared DB and shared git repos. With multiple Gerrit masters it is possible to mitigate server load by allowing users to access a server which has more free resources, and it is also possible to provide higher availability by allowing service to be transferred to any remaining masters when a master fails.
Running a multi-master setup is inherently complicated and, depending on the configuration and external hardware and software available, it is possible to configure a multi- master setup with very different levels of service. Supported configuration options are outlined below.
Sharing Git Repositories
A single site multi-master arrangement generally consists of pointing all the masters to the same copy of the git repositories via a shared file system.
Simple Shared Host Test Setup
The simplest example of this is to host two gerrit servers on the same host and to point the two servers at the same directory where the git repos are located. This is likely only useful as an example for testing, since running two gerrit servers on the same host is unlikely to provide any additional load balancing or to improve availability very much. But this may be useful for those interested in understanding how a multi-master setup works since it is very easy to setup.
Sharing via a Network File System
Running each master on a separate physical host provides a load balancing improvement. A shared file system such as NFS is likely the best option for this arrangement, although any JGit supported shared file system will work.
To share the git repos, initialize the Gerrit instances as shown below:
$ java -jar {path/}gerrit.war init -d <site1>
# ...
*** Git Repositories
***
Location of Git repositories [git]: /path/to/nfs/git
# choose any location on the network shared file system
for git repository location. NOTE: the location of the
git repository must be shared by all servers. If you
use the default, [git], then the repository will be
located on this server in 'site1/git'. It is
recommended that you avoid the default and specify the
full path to the git repository, even if it is on this
server. The full path can then be used when setting up
the other servers.
# ...
$ java -jar {path/}gerrit.war init -d <site2>
# ...
*** Git Repositories
***
Location of Git repositories [git]: /path/to/nfs/git
# choose the same git repository location that the first
instance uses
# ...
Sharing The Database
All servers must use the same database to ensure users have access to the same data. Therefore PostgreSQL or MySQL shoul