Wednesday, 26 August 2015

GitBlit Master Slave Replication Setup

Step 1#
#In Master GIT Server[Master URL]

vim /opt/gitblit/data/
# Modify or Add lines as below

git.enableGitServlet = true

web.showFederationRegistrations = true

federation.passphrase = p@$$w0rd [We can set anything here]


#ps aux | grep java
#service gitblit stop
#ps aux | grep java
#service gitblit start

Step 2#
Login to
Click on Admin Profile-->federation-->Copy the federation tokens for "all repositories, users, & settings"

(Example: Here token is c12b82e1b5e0ba6baec48119468aa09595663164)

Step 3#
#Install Fresh GitBlit Server

#Go to Slave GIT Server

vim /opt/gitblit/data/
#Modify Or Add lines as below

example1.url =
example1.token = c12b82e1b5e0ba6baec48119468aa09595663164 [Paste the token copied from Master GIT]
example.frequency = 5 mins [Replication frequency between Master and Backup Slave]
example.folder =
example.bare = true
example.mirror = true
example.mergeAccounts = true
#ps aux | grep java
#service gitblit stop
#ps aux | grep java
#service gitblit start

Step 4#
#Monitor the log file in both the Master & Slave Servers

tail -f /opt/gitblit/data/logs/gitblit.log

Successful Logs Example:
[INFO ] ARF: lendingstream.git/info/refs?service=git-upload-pack (100) authenticated [Here lendingstream.git Repo name, like wise will get for all Repo]
[INFO ] Federation PULL_USERS request from SLAVE_IP
[INFO ] Federation PULL_TEAMS request from SLAVE_IP
[INFO ] Federation PULL_SETTINGS request from SLAVE_IP
[INFO ] Federation PULL_SCRIPTS request from SLAVE_IP

[INFO ] Pulling federated repository lendingstream.git from
example1 @
[INFO ] Next pull of
example1 @ scheduled for DATE_TIME
Step 5#
#How to Check Slave is working fine.
1. Login to Slave's GIT Dashboard by admin and check the Repo's & Users are synched or not
2. Clone any repository to Local using any Master's username & password from Slave's URL.

1 comment:

  1. All your information about the linux replication are very well and interesting for me.
    linux replication