Hello,<div><br></div><div>Sorry for my delay and thank you for your reply.</div><div><br></div><div>After reading your answer, now i understand how it works.</div><div><br></div><div>Thank you again.</div><div><br></div><div>
Regards,</div><div>Ali<br><br><div class="gmail_quote">On Sat, Oct 27, 2012 at 2:34 PM, Lars Ellenberg <span dir="ltr"><<a href="mailto:lars.ellenberg@linbit.com" target="_blank">lars.ellenberg@linbit.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Fri, Oct 26, 2012 at 05:10:25PM +0300, Ali Nebi wrote:<br>
> Hi,<br>
><br>
> I'm new to csync2 and i'm just started using it in our environment for<br>
> synchronization of files. I was using rsync for syncing, but wanted to test<br>
> csync2 and to learn how it works. I got it working just fine regarding sync<br>
> together with lsyncd, but I have a question regarding deleting<br>
> files/folders from destination host that do not on source.<br>
><br>
> Using rsync I can keep files/folders in sync including '--delete' option.<br>
> This way rsync delete from destination host everything that do not exist on<br>
> source host. Can csync2 do same?<br>
<br>
</div>csync2 does only ever push those *changes* it is aware of.<br>
<br>
At some point it recorded a "local state" into its data base.<br>
At a later point, it verifies the then current local state against the<br>
recorded state.<br>
The *changes* in this local state are then pushed to the peer(s).<br>
<br>
Which means, for csync2, to push out a "delete", it needs to be aware<br>
that there had been a deletion. You need to tell it that at some point,<br>
there had been a local file, but now it is no longer...<br>
<br>
There are two ways to achieve that.<br>
To "delete remotely", you could locally mark as dirty a file that does<br>
not exist:<br>
csync2 -m this-file-exists-only-on-peer<br>
csync2 -uv this-file-exists-only-on-peer<br>
<br>
To make the peer(s) look like the node you chose to be master,<br>
on all nodes do:<br>
csync2 -cIr /<br>
on the master do:<br>
csync2 -TUIX<br>
csync2 -uv<br>
(that is not something you should do as normal operation,<br>
but only on initial setup, or when integrating a new node,<br>
possibly occasionally as maintenance).<br>
<div class="im"><br>
> I run following test:<br>
><br>
> on host1 i create:<br>
><br>
> /var/www/html/test1<br>
> /var/www/html/test2<br>
><br>
> They are successfully synced to host2. Now on host2 i create<br>
><br>
> /var/www/html/test3<br>
><br>
> And on host1 i run sync again, what i see is that 'test3' folder is not<br>
> deleted on host2.<br>
<br>
</div>Of course.<br>
<div class="im"><br>
> They I decided on host1 to create one more folder:<br>
><br>
> /var/www/html/test4.<br>
><br>
> This new folder was synced to host2, but 'test3' folder is still not<br>
> removed. Is there a way to do this using csync2?<br>
<br>
</div>See above: csync2 is push only, and it pushes changes that happened locally.<br>
<br>
Test3 never existed, so it was not deleted locally, no change to test3,<br>
nothing to push out...<br>
<br>
But it is symetrical, so host2 had been expected to sync its test3<br>
folder over to host1... then, if you delete it on host1 again, that<br>
would be propagated back to host2.<br>
<br>
If you want host2 to always be "slave", you can configure it so,<br>
but you still need to trigger pushes (csync2 -x runs) on it,<br>
which would then make host1 aware of the creation of test3,<br>
but refuse it.<br>
On the next push from host1 to host2 it would be deleted.<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
: Lars Ellenberg<br>
: LINBIT | Your Way to High Availability<br>
: DRBD/HA support and consulting <a href="http://www.linbit.com" target="_blank">http://www.linbit.com</a><br>
<br>
DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.<br>
_______________________________________________<br>
Csync2 mailing list<br>
<a href="mailto:Csync2@lists.linbit.com">Csync2@lists.linbit.com</a><br>
<a href="http://lists.linbit.com/mailman/listinfo/csync2" target="_blank">http://lists.linbit.com/mailman/listinfo/csync2</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Iguana Information Technologies, SL</span><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Calle López de Hoyos 35, 1º</span><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">28002 Madrid</span>, España (Spain)</div>+34 915569100<br>+34 649336286<br><a href="http://www.iguanait.com/" target="_blank">http://www.iguanait.com/</a><br>
<br>Advertencia<br>-----------<br>Este mensaje contiene información privada y confidencial. Si usted<br>no es el destinatario, no está autorizado a leer, imprimir, retener,<br>copiar o difundir este mensaje o parte de él. En caso de que usted<br>
reciba este mensaje por error debe borrarlo. Gracias.<br><br>Confidentiality notice<br>----------------------<br>This message contains private and confidential information. If you<br>are not the named addressee, you are not authorized to read, print,<br>
retain, copy or disseminate this message or any part of it. In case<br>you receive this message by mistake you should delete it. Thanks.<br>
</div>