Find the answer to your Linux question:
Results 1 to 7 of 7
Can one server be both the master and the slave? Can it be for the same directory? thanks...
  1. #1
    Just Joined!
    Join Date
    Feb 2010
    Posts
    3

    rsync master AND slave both in one box?

    Can one server be both the master and the slave?

    Can it be for the same directory?

    thanks

  2. #2
    Linux Guru Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    2,096
    I understand, you want to have a setup like this?
    Server A: /rsyncdata <-> Server B /rsyncdata
    And both servers export /rsyncdata to the other one?

    Possible, but I wouldnt recommend it. You will run into race conditions, if the same file is modified and then "synchronized".
    Basically, the last write will win and this is probably not what you want.
    It would be correct to show the user the collision and ask what he wants.

    Maybe unison is more appropiate, as it works bi-directional
    Unison File Synchronizer
    Last edited by Irithori; 02-01-2010 at 10:15 PM.
    You must always face the curtain with a bow.

  3. #3
    Just Joined!
    Join Date
    Feb 2010
    Posts
    3
    thanks for the response

    i mean like this:

    Server A: /rsyncdata > Server B /rsyncdata > Server C /rsyncdata

    i'll check out unison, thanks

  4. #4
    Linux Guru Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    2,096
    your setup is well possible with rsync.
    Two scenarios:
    a) the chain you described
    Server A: /rsyncdata > Server B /rsyncdata > Server C /rsyncdata

    If you somehow ensure, that the rsync from A to B has terminated succesfull before B to C is started, then all is well.
    The simplest (but somewhat unreliable) way is to plan a long enough wait.

    b) do the rsyncs from one source.
    aka: A -> B
    and A -> C
    You must always face the curtain with a bow.

  5. #5
    Linux Guru Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    2,096
    Another way of dealing with scenario a)
    Server B *pulls* from Server A
    but *pushes* to Server C

    on Server B:
    Code:
    rsync -av --delete -e ssh user@ServerA:/rsyndata /rsyncdata
    if this was succesfull, then the return value $? is 0.
    test for it, then run
    Code:
    rsync -av --delete -e ssh  /rsyncdata user@ServerC:/rsyndata
    You must always face the curtain with a bow.

  6. #6
    Just Joined!
    Join Date
    Feb 2010
    Posts
    3
    thanks i will try that

    cheers

  7. #7
    Linux Guru Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    2,096
    Disclaimer:
    Be sure, that you have read in the manpage of rsync what the parameter --delete does
    You must always face the curtain with a bow.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...