[shlug][OT]请教2个SVN服务器互相同步的解决方案

67 views
Skip to first unread message

Rhythm

unread,
Feb 9, 2012, 10:10:15 PM2/9/12
to sh...@googlegroups.com
现状:
地点A,使用的是“局域网”的SVN服务器a。
地点B,使用的是“公网”的SVN服务器b。
需求:
a服务器所有的操作自动同步到服务器b,
b服务器所有的操作自动同步到服务器a,
保证两台服务器的所有日志,数据都是同步的。

请问,解决方案,先谢过!

ghosTM55

unread,
Feb 9, 2012, 10:13:58 PM2/9/12
to sh...@googlegroups.com
2012/2/10 Rhythm <rhythm...@gmail.com>:

交流技术的thread不要在title上加上OT :)

--
Thomas
Shanghai Linux User Group
GitCafe - Share a cup of open source

http://ghosTunix.org
Twitter: @ghosTM55

Shell Xu

unread,
Feb 9, 2012, 10:13:51 PM2/9/12
to sh...@googlegroups.com
我打赌接下来有人建议你用git。
--
无能者无所求,饱食而遨游,泛若不系之舟
blog: http://shell909090.com/blog/
twitter: http://twitter.com/shell909090

姚飞

unread,
Feb 9, 2012, 10:39:38 PM2/9/12
to sh...@googlegroups.com
rsync?

发自我的 iPhone

Zoom.Quiet

unread,
Feb 9, 2012, 10:45:13 PM2/9/12
to sh...@googlegroups.com
在 2012年2月10日 上午11:39,姚飞 <yaof...@gmail.com> 写道:
> rsync?
>

- svn 哈,当然上 hooks 脚本了
- 不过,不明白这里的日志是什么?
- 另外,svn 的冲突怎么解决?
- 人工的话好説
- 自动的话,这难了,,,

- 其实从 cvs 时代,就有个非常坚固的解决方案:
- patch mailing list
- 不论有哪些仓库,统一将变更,以补丁邮件的方式吼到列表中
- 自动化在所有服务器中,进行自动合并

--
人生苦短, Pythonic! 冗余不做,日子甭过!备份不做,十恶不赦!
俺: http://about.me/zoom.quiet
文字协议: http://creativecommons.org/licenses/by-sa/2.5/cn/

Gene Wu

unread,
Feb 9, 2012, 10:55:25 PM2/9/12
to sh...@googlegroups.com
这么做不如用git

至少要有一个是主,否则另一个出点差池,你两个都报销

建议只能切入主,其他为mirror只读,切换一下host很快

-- 
Gene Wu
Sent with Sparrow

已使用 Sparrow 发送

Yiling Cao

unread,
Feb 9, 2012, 10:57:19 PM2/9/12
to sh...@googlegroups.com
1. rsync 或 lsyncd
2.用distributed fs 例如 glusterfs

但有可能会出现奇怪的问题,race condition

2012/2/10 Gene Wu <gene....@gmail.com>

Xiangfu Liu

unread,
Feb 9, 2012, 11:05:35 PM2/9/12
to sh...@googlegroups.com, Rhythm
On 02/10/2012 11:10 AM, Rhythm wrote:
> a服务器所有的操作自动同步到服务器b,
> b服务器所有的操作自动同步到服务器a,

这个可不是同步的问题了,这个 merge
rsync 会搞坏的。

比如你 在 a 上修改了:
echo Hello_from_a > /svn/REAME.txt

同时在 b 上修改了:
echo Hello_from_b > /svn/README.txt


这个你不手工解决怎么同步?你必须用一台做SVN服务器。另一台只能做备份。
要不然只能定期手工做。不过相信那不是你想要的。

为什么还用SVN?不用GIT?git 做 merge 还是很方便的。而且图形界面现在也不少。
发patch series 也方便。:)

Happy hacking
xiangfu

小马xiaoma

unread,
Feb 10, 2012, 12:00:27 AM2/10/12
to sh...@googlegroups.com
你这个赌本身就是一种让他用git的建议。

在 2012年2月10日 上午11:13,Shell Xu <shell...@gmail.com> 写道:
> 我打赌接下来有人建议你用git。

Ben Luo

unread,
Feb 10, 2012, 12:19:52 AM2/10/12
to sh...@googlegroups.com
一直没觉得 Git/HG 作merge的好处在哪。如果有冲突,还是要 kdiff3 之类的来
人工干预吧。

Bruce Du

unread,
Feb 9, 2012, 11:47:12 PM2/9/12
to sh...@googlegroups.com
ghosTM55 �:
> 2012/2/10 Rhythm <rhythm...@gmail.com>:
>
>> ��״��
>> �ص�A��ʹ�õ��ǡ��������SVN������a��
>> �ص�B��ʹ�õ��ǡ������SVN������b��
>> ����
>> a���������еIJ����Զ�ͬ����������b��
>> b���������еIJ����Զ�ͬ����������a��
>> ��֤��̨��������������־����ݶ���ͬ���ġ�
>>
>> ���ʣ������������л��
>>
>
> ����������thread��Ҫ��title�ϼ���OT :)
>
>
WANDisco, it works perfect.

Xiangfu Liu

unread,
Feb 10, 2012, 1:14:24 AM2/10/12
to sh...@googlegroups.com, Ben Luo
On 02/10/2012 01:19 PM, Ben Luo wrote:
> 一直没觉得 Git/HG 作merge的好处在哪。如果有冲突,还是要 kdiff3 之类的来 人工干预吧。

有自动解决的吗? 都需要人工干预吧 :)

我用 emacs 或 meld :

[mergetool "ediff"]
cmd = emacsclient -c -nw -eval \"(ediff-merge-files-with-ancestor \\\"$PWD/$LOCAL\\\" \\\"$PWD/$REMOTE\\\"\\\"$PWD/$BASE\\\" nil \\\"$PWD/$MERGED\\\")\"
[merge]
tool = meld

liyaoshi

unread,
Feb 10, 2012, 1:19:14 AM2/10/12
to sh...@googlegroups.com
我觉得还不如中间加个proxy

就像Perforce

liyaoshi

unread,
Feb 10, 2012, 1:20:12 AM2/10/12
to sh...@googlegroups.com
svn 服务器就架公网的算了

局域网内用HTTP proxy ,cache加大点

依云

unread,
Feb 10, 2012, 2:49:19 AM2/10/12
to sh...@googlegroups.com
On Fri, Feb 10, 2012 at 01:19:52PM +0800, Ben Luo wrote:
> 一直没觉得 Git/HG 作merge的好处在哪。如果有冲突,还是要 kdiff3
> 之类的来 人工干预吧。

没弄错的话,git / hg 可以从不同的远程仓库 merge,svn 只能有一个远程仓库。

> On 10/02/2012 12:05, Xiangfu Liu wrote:
> >On 02/10/2012 11:10 AM, Rhythm wrote:
> >>a服务器所有的操作自动同步到服务器b,
> >>b服务器所有的操作自动同步到服务器a,
> >
> >这个可不是同步的问题了,这个 merge
> >rsync 会搞坏的。
> >
> >比如你 在 a 上修改了:
> > echo Hello_from_a > /svn/REAME.txt
> >
> >同时在 b 上修改了:
> > echo Hello_from_b > /svn/README.txt
> >
> >
> >这个你不手工解决怎么同步?你必须用一台做SVN服务器。另一台只能做备份。
> >要不然只能定期手工做。不过相信那不是你想要的。
> >
> >为什么还用SVN?不用GIT?git 做 merge
> >还是很方便的。而且图形界面现在也 不少。
> >发patch series 也方便。:)
> >
> >Happy hacking
> >xiangfu

--
Best regards,
lilydjwg

Linux Vim Python 我的博客:
http://lilydjwg.is-programmer.com/
--
A: Because it obfuscates the reading.
Q: Why is top posting so bad?

Xiangfu Liu

unread,
Feb 10, 2012, 3:54:30 AM2/10/12
to sh...@googlegroups.com, liyaoshi
On 02/10/2012 02:20 PM, liyaoshi wrote:
> svn 服务器就架公网的算了

+1. 并且公开一下代码 :)

Xiangfu

wang tiezhen

unread,
Feb 10, 2012, 6:44:53 AM2/10/12
to sh...@googlegroups.com
不知道需求是什么样子的,能不能只用内网svn,公网通过vpn访问内网? 

2012/2/10 Xiangfu Liu <xia...@openmobilefree.net>

机械唯物主义 : linjunhalida

unread,
Feb 10, 2012, 7:15:01 AM2/10/12
to sh...@googlegroups.com
对了, 大家一般用什么工具来merge? 每次遇到merge的状况我都很崩溃的说. 完全不知道怎么用kdiff等东西.

2012/2/10 wang tiezhen <jwz...@gmail.com>:

依云

unread,
Feb 10, 2012, 7:42:37 AM2/10/12
to sh...@googlegroups.com
我在 git mergetool 的提示下用 vimdiff。

--

Shen Chenjun

unread,
Feb 10, 2012, 7:48:17 AM2/10/12
to sh...@googlegroups.com
从a同步到b,svn自带sync功能,很容易做到。

反向同步,至少我在svn 1.4里的文档离没看到。不过现在svn已经1.7了,最好先看下svn book。

2012/2/10 Rhythm <rhythm...@gmail.com>

Gene Wu

unread,
Feb 10, 2012, 11:00:17 AM2/10/12
to sh...@googlegroups.com, sh...@googlegroups.com
Meld

Thanks,

Gene Wu

周涛

unread,
Feb 11, 2012, 3:51:07 AM2/11/12
to sh...@googlegroups.com
rsync+inotify配置触发式(实时)文件远程同步
347.gif

Shen Chenjun

unread,
Feb 12, 2012, 5:21:35 AM2/12/12
to sh...@googlegroups.com
楼主需要的是双向同步,这种方法行吗?另外inofity理论上还是有延迟的,不能叫同步,只能叫异步。

2012/2/11 周涛 <root.z...@googlemail.com>
347.gif

david pu

unread,
Feb 12, 2012, 6:07:37 AM2/12/12
to sh...@googlegroups.com
这个不可能做到的。
比如a上的checkin和b同步前没有冲突,但是提交后同步有冲突怎么解决?

一般的做法是一个master,别的都是mirror,checkout从mirror拉代码,checkin都到master上。
公司用git也是这么做的,git-master在各个site都要mirror,这样pull就很快,push就push到master上。

2012/2/10 Rhythm <rhythm...@gmail.com>:

--
() ASCII Ribbon Campaign
/\ Keep it simple!

Liu Cheng

unread,
Feb 12, 2012, 9:59:20 AM2/12/12
to sh...@googlegroups.com
不能想办法checkin到一个库里面吗?比如都到公网的,或者用vpn都到LAN的,使用这些现成的解决方案有什么问题么?

2012/2/12 david pu <pulq...@gmail.com>:

Gene Wu

unread,
Feb 12, 2012, 10:43:53 AM2/12/12
to sh...@googlegroups.com, sh...@googlegroups.com
可以做到,要hack
因为checkin是post,重定向post的,没做过YY出来的

Thanks,

Gene Wu

david pu

unread,
Feb 12, 2012, 9:57:19 PM2/12/12
to sh...@googlegroups.com
这个不也是checkin到master么?这种不用hack,改host或者像git的话就在.gitconfig设置insteadOf 就可以。
比如
$git remote -v
origin git://git-mirror:9418/linux-2.6 (fetch)
origin ssh://git-master:29418/linux-2.6 (push)


2012/2/12 Gene Wu <gene....@gmail.com>:

au9ustine

unread,
Mar 5, 2012, 9:08:43 PM3/5/12
to sh...@googlegroups.com
git +1

呃,此处的a和b都是裸仓库吗?貌似push的时候应该就会解决conflict的吧,两个裸仓merge也会conflict吗?

2012/2/10 Xiangfu Liu <xia...@openmobilefree.net>

Lantian (Bruce) Du

unread,
Mar 6, 2012, 1:41:08 AM3/6/12
to sh...@googlegroups.com
Try WanDisco

在2012-03-06,au9ustine <duke.au...@gmail.com> 写道:
-----原始邮件-----
发件人:au9ustine <duke.au...@gmail.com>
发送时间:2012年3月6日 星期二
收件人:sh...@googlegroups.com
主题:Re: [shlug][OT]请教2个SVN服务器互相同步的解决方案

yayv

unread,
Mar 6, 2012, 5:23:09 AM3/6/12
to sh...@googlegroups.com
svnsync 这个命令,就是用来同步svn仓库的啊

-- 
yayv
Sent with Sparrow

Reply all
Reply to author
Forward
0 new messages