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