Gerrit replication Configuration

 

1        Overview

Gerrit can automatically push anychanges it makes to its managed Git repositories to another system.Typicallyreplication should be done over SSH, with a passwordless public/private keypair.On a trusted network it is also possible to use replication over theinsecure(but much faster)git://protocol, by enabling the receive-pack serviceon the receiving system, but this configuration is not recommended.

2        SSH configuration

You must set up a public/privatekey pair that enables the Gerrit user on the master server to log on to theGerrit user on the slave without a password.

2.1       Create a (password-less) key usingssh-keygen on the master server

(ignore this step , if you alreadyhave one)

gerrit2@masterserver:~$ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/gerrit2/.ssh/id_rsa): 
Created directory '/home/gerrit2/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/gerrit2/.ssh/id_rsa.
Your public key has been saved in /home/gerrit2/.ssh/id_rsa.pub.
The key fingerprint is:
3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 gerrit2@mastereserver

2.2        Use ssh command to create a directory ~/.sshas user gerrit2 on slave

gerrit2@masterserver:~$ ssh gerri2@slave 
gerrit2@slave's password: 

 

2.3       Append gerrit2@masterserver’s newpublic key to gerrit2@slave:.ssh/ authorized_keys and enter gerrit2’spassword one last time

gerrit2@masterserver:~$ cat .ssh/id_rsa.pub | ssh gerrit2@slave 'cat >> .ssh/authorized_keys'
gerrit2@slave's password: 

3        Create replication.config

Create '$site_path'/etc/replication.config asa Git-style config file, and restart Gerrit.

3.1       Git protocol

Must set-up install git-daemonfirst.

[remote "slave_mirror "]
   url = git://slave/${name}.git
   mirror = true
   threads = 2
   adminUrl = ssh://gerrit2@slave/srv/gerrit2/git/${name}.git

3.2       SSH protocal

[remote "slave "]
   url = ssh://gerrit2@slave/srv/gerrit2/git/${name}.git
   mirror = true
   threads = 2
   adminUrl = ssh://gerrit2@slave/srv/gerrit2/git/${name}.git

4        Reference

http://gerrit-documentation.googlecode.com/svn/Documentation/2.4.2/config-replication.html

http://gerrit-documentation.googlecode.com/svn/Documentation/2.4.2/cmd-replicate.html

https://groups.google.com/forum/?fromgroups=#!topic/repo-discuss/dmY87yf0X7o

http://www.linuxproblem.org/art_9.html

http://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-ssh-copy-id/

http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值