Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19
rsync between 2 servers
Results 1 to 9 of 9

Thread: rsync between 2 servers

  1. #1

    rsync between 2 servers

    Hi,

    I need to rsync almost all the data from one of my server to another server in the same DC.. I am aware of how to use rsync but that is just for 1 folder at a time.

    I need to write a script that can copy my desired files from one server to another without prompting me for Login and Password every time i connect to the new server.

    Later after that i need to swap the IPs for the server i.e. the new server should get the old IP's and the old server should get the new ip. What is the file that i need to edit to accomplish this ?

    I would appreciate if some one could get this thread going ?

    Regards,

  2. #2
    Administrator Moderator
    Member
    starfish's Avatar
    Join Date
    Apr 2004
    Posts
    141
    Hello,

    I took a quick look at the "man" pages for rsync and found this:

    rsync -avz foo:src/bar /data/tmp

    this would recursively transfer all files from the directory src/bar on
    the machine foo into the /data/tmp/bar directory on the local machine.
    The files are transferred in "archive" mode, which ensures that sym-
    bolic links, devices, attributes, permissions, ownerships etc are pre-
    served in the transfer. Additionally, compression will be used to
    reduce the size of data portions of the transfer.

    rsync -avz foo:src/bar/ /data/tmp

    a trailing slash on the source changes this behavior to transfer all
    files from the directory src/bar on the machine foo into the
    /data/tmp/. A trailing / on a source name means "copy the contents of
    this directory". Without a trailing slash it means "copy the direc-
    tory".


    =======================


    For the IPs: If the systems are running RedHat / Fedora, the ethernet configuration files are in the /etc/sysconfig/network-scripts directory. Check this link:

    http://www.linuxhomenetworking.com/l...work-linux.htm

    You can also use the ifconfig command to do this. The URL mentions this also.

    You'll create ARP problems if the servers are on the same subnet and you switch the IP addresses. This is because the MAC address to IP address mapping will be swapped.

    You'll have to clear the ARP tables on most of the servers on your subnet and the routers too. Sometimes a ping to the subnet's broadcast address will help fix this, but not always.

  3. #3
    Hello Starfish,

    But i need to rsync data Between 2 different servers and i also do not want the other machine prompting me for the password ..i should be able to write a script for this...How can i do this ?

    Regards,

  4. #4
    Let me ask around at work. I think we do this on some of our systems, ie. automatic rsync without prompting. I'll try to get back to you on this in a day or two.

    The examples I gave should be for two different servers though.

  5. #5
    Administrator Moderator
    Member
    starfish's Avatar
    Join Date
    Apr 2004
    Posts
    141
    FlyingFish,

    Try setting up SSH so that you can SSH between the servers without a password.

    http://www.linuxhomenetworking.com/l...ssh-server.htm

    rsync operates on top of SSH so it should work afterwards.

    Let me know if this works.

  6. #6

    rsync password

    Quote Originally Posted by flyingfish
    Hello Starfish,

    But i need to rsync data Between 2 different servers and i also do not want the other machine prompting me for the password ..i should be able to write a script for this...How can i do this ?

    Regards,

    --password-file=FILE

    zparihar

  7. #7

    Re: rsync password

    or in the ryncd.conf

    max connections = 2
    log file = /var/log/rsync.log
    timeout = 300

    [pub]
    comment = This is my first rsync setup...
    path = /path/to/my/public/share
    read only = yes
    list = yes
    uid = nobody
    gid = nobody
    auth users = pub
    secrets file = /etc/rsyncd.secrets



    the secrets file should contain the username and password

    Create a file: "/etc/rsyncd.secrets", with the contents:

    pubub

    This simply makes a user pub, with password pub or whatever you want it to be...

    Be warned that this will be sent in clear text....

    Make sure that this file is also only root readable.

  8. #8
    To backup your data using Rsync is very easy but you should enable it only through VPN or tunnel here is a simple way to rsync through CIPE

    step 1 ( SERVER )
    1) Install cipe rpms
    2)Create cipe cofiguration file
    ______________________________
    #vi /etc/cipe/options.source
    ipaddr 10.0.0.1
    ptpaddr 10.0.0.2
    me 192.168.0.16:8082
    peer 192.168.0.15:8084
    maxerr -1
    key b5b1433cb03a23c8543d440824507c94
    ___________________________
    ( Here “ipaddr” is Virtual Ip address of cipe “ptpaddr” is the virtual address of destination mechine “ me & peer “ is the original ip of source & destination, key :-any key to encrypt
    use 'echo hai | md5sum' to get key )
    #chmod 600 /etc/cipe/options.source
    #cipe-cb -o /etc/cipe/options.source


    3) destination mechines ( CLIENT )
    Install RPM cipe

    do the same as earlier
    # vi /etc/cipe/options.destination
    ipaddr 10.0.0.2
    ptpaddr 10.0.0.1
    me 192.168.0.15:8084
    peer 192.168.0.16:8082
    maxerr -1
    key b5b1433cb03a23c8543d440824507c94
    #chmod 600 /etc/cipe/options.destination
    #cipe-cb -o /etc/cipe/options.destination

    #ifconfig


    cipe completed here u can see CIPE tunnel


    SERVER
    -----
    rsync -- used as a tool

    Create file
    # vi /etc/rsyncd.conf
    motd file = /etc/rsyncd.motd
    log file = /var/log/rsync.log
    pid file = /etc/rsyncd.pid

    [home]
    path = /home
    comment = MYSERVER
    read only = yes
    list = yes
    auth users = noushad
    secrets file = /etc/rsyncd.secrets
    hosts allow = 10.0.0.1 # ( cipe ip client)
    hosts deny = *
    use chroot = yes
    ________________________________________

    #touch /etc/rsyncd.secrets
    #chmod 600 /etc/rsyncd.secrets

    #vi /etc/rsyncd.secrets
    noushad:rhce

    add user named noushad
    password is rhce

    #vi /etc/rsync.motd
    WELCOME TO LINUX WORLD
    #rsync --daemon

    CLIENT
    ------
    #rsync 10.0.0.1::
    WELCOME TO LINUX WORLD
    #rsync -arvpzog noushad@10.0.0.1::home /Backup

    system asks passwords

    add entry in crontab
    # crondtab -e
    15 5 * * * rsync -arvzpzog noushad@10.0.0.1::home /Backup --password-file=/root/password

    #service crond restart

  9. #9

    Rsync

    Try these
    this is good ( sorru for correction )

     To backup your data using Rsync is very easy but you should enable it only through VPN or tunnel here is a simple way to rsync through CIPE



    step 1 ( SERVER )

    1) Install cipe rpms

    2)Create cipe cofiguration file

    __________________________________________________

    #vi /etc/cipe/options.cipcb0

    ipaddr 10.0.0.1

    ptpaddr 10.0.0.2

    me 192.168.0.16:8082

    peer 192.168.0.15:8084

    maxerr -1

    key b5b1433cb03a23c8543d440824507c94

    __________________________________________________ __

    ( Here “ipaddr” is Virtual Ip address of cipe “ptpaddr” is the virtual address of destination mechine “ me & peer “ is the original ip of source & destination, key :-any key to encrypt

    use 'echo hai | md5sum' to get key )

    #chmod 600 /etc/cipe/options.cipcb0



    __________________________________________________ __

    #vi /etc/sysconfig/network-scripts/ifcfg-cipcb0

    DEVICE=cipcb0

    ONBOOT=yes

    BOOTPROTO=static

    IPADDR=10.0.0.1

    NETMASK=255.0.0.0

    __________________________________________________ ____





    #service network restart

    #ifconfig



    ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++



    3) destination mechines ( CLIENT )

    Install RPM cipe



    do the same as earlier

    __________________________________________________ ____

    # vi /etc/cipe/options.cipcb0

    ipaddr 10.0.0.2

    ptpaddr 10.0.0.1

    me 192.168.0.15:8084

    peer 192.168.0.16:8082

    maxerr -1

    key b5b1433cb03a23c8543d440824507c94

    __________________________________________________ _____

    #chmod 600 /etc/cipe/options.cipcb0



    __________________________________________________ __

    #vi /etc/sysconfig/network-scripts/ifcfg-cipcb0

    DEVICE=cipcb0

    ONBOOT=yes

    BOOTPROTO=static

    IPADDR=10.0.0.2

    NETMASK=255.0.0.0

    __________________________________________________ ____





    #service network restart

    #ifconfig



    cipe completed here u can see CIPE tunnel



    ################################################## ####################



    SERVER

    -----

    rsync -- used as a tool



    Create file

    # vi /etc/rsyncd.conf

    motd file = /etc/rsyncd.motd

    log file = /var/log/rsync.log

    pid file = /etc/rsyncd.pid



    [home]

    path = /home

    comment = MYSERVER

    read only = yes

    list = yes

    auth users = noushad

    secrets file = /etc/rsyncd.secrets

    hosts allow = 10.0.0.2 # ( cipe ip client)

    hosts deny = *

    use chroot = yes



    _______________________________________

    #vi /etc/xinetd.d/rsync



    disable=no

    _______________________________________



    service xinetd restart



    #touch /etc/rsyncd.secrets

    #chmod 600 /etc/rsyncd.secrets



    #vi /etc/rsyncd.secrets

    noushad:rhce



    add user named noushad

    password is rhce



    #vi /etc/rsync.motd

    WELCOME TO LINUX WORLD

    #rsync --daemon

    ++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++



    CLIENT

    --------

    #rsync 10.0.0.1::

    WELCOME TO LINUX WORLD



    #rsync -arvpzog noushad@10.0.0.1::home /Backup


     To backup your data using Rsync is very easy but you should enable it only through VPN or tunnel here is a simple way to rsync through CIPE



    step 1 ( SERVER )

    1) Install cipe rpms

    2)Create cipe cofiguration file

    __________________________________________________

    #vi /etc/cipe/options.cipcb0

    ipaddr 10.0.0.1

    ptpaddr 10.0.0.2

    me 192.168.0.16:8082

    peer 192.168.0.15:8084

    maxerr -1

    key b5b1433cb03a23c8543d440824507c94

    __________________________________________________ __

    ( Here “ipaddr” is Virtual Ip address of cipe “ptpaddr” is the virtual address of destination mechine “ me & peer “ is the original ip of source & destination, key :-any key to encrypt

    use 'echo hai | md5sum' to get key )

    #chmod 600 /etc/cipe/options.cipcb0



    __________________________________________________ __

    #vi /etc/sysconfig/network-scripts/ifcfg-cipcb0

    DEVICE=cipcb0

    ONBOOT=yes

    BOOTPROTO=static

    IPADDR=10.0.0.1

    NETMASK=255.0.0.0

    __________________________________________________ ____





    #service network restart

    #ifconfig



    ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++



    3) destination mechines ( CLIENT )

    Install RPM cipe



    do the same as earlier

    __________________________________________________ ____

    # vi /etc/cipe/options.cipcb0

    ipaddr 10.0.0.2

    ptpaddr 10.0.0.1

    me 192.168.0.15:8084

    peer 192.168.0.16:8082

    maxerr -1

    key b5b1433cb03a23c8543d440824507c94

    __________________________________________________ _____

    #chmod 600 /etc/cipe/options.cipcb0



    __________________________________________________ __

    #vi /etc/sysconfig/network-scripts/ifcfg-cipcb0

    DEVICE=cipcb0

    ONBOOT=yes

    BOOTPROTO=static

    IPADDR=10.0.0.2

    NETMASK=255.0.0.0

    __________________________________________________ ____





    #service network restart

    #ifconfig



    cipe completed here u can see CIPE tunnel



    ################################################## ####################



    SERVER

    -----

    rsync -- used as a tool



    Create file

    # vi /etc/rsyncd.conf

    motd file = /etc/rsyncd.motd

    log file = /var/log/rsync.log

    pid file = /etc/rsyncd.pid



    [home]

    path = /home

    comment = MYSERVER

    read only = yes

    list = yes

    auth users = noushad

    secrets file = /etc/rsyncd.secrets

    hosts allow = 10.0.0.2 # ( cipe ip client)

    hosts deny = *

    use chroot = yes



    _______________________________________

    #vi /etc/xinetd.d/rsync



    disable=no

    _______________________________________



    service xinetd restart



    #touch /etc/rsyncd.secrets

    #chmod 600 /etc/rsyncd.secrets



    #vi /etc/rsyncd.secrets

    noushad:rhce



    add user named noushad

    password is rhce



    #vi /etc/rsync.motd

    WELCOME TO LINUX WORLD

    #rsync --daemon

    ++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++



    CLIENT

    --------

    #rsync 10.0.0.1::

    WELCOME TO LINUX WORLD



    #rsync -arvpzog noushad@10.0.0.1::home /Backup



    system asks passwords

    __________________________________________________ _____________________________________

    Crondtab -e

    add entry in crontab

    15 5 * * * rsync -arvpzog noushad@10.0.0.1::home /Backup --password-file=/root/password

    __________________________________________________ ______________________________________

    ______________________________

    #vi /root/password

    rhce #password of user noushad

    _______________________________



    chmod 600 /root/password

    #service crond restart










    system asks passwords

    __________________________________________________ _____________________________________

    Crondtab -e

    add entry in crontab

    15 5 * * * rsync -arvpzog noushad@10.0.0.1::home /Backup --password-file=/root/password

    __________________________________________________ ______________________________________

    ______________________________

    #vi /root/password

    rhce #password of user noushad

    _______________________________



    chmod 600 /root/password

    #service crond restart

Similar Threads

  1. Rsync Excludes acting oddly
    By vwgtiturbo in forum Linux - Software, Applications & Programming
    Replies: 0
    Last Post: 06-09-2006, 05:14 PM
  2. Rsync incremental backup script
    By vwgtiturbo in forum Programming
    Replies: 6
    Last Post: 06-07-2006, 08:19 PM
  3. smb & rsync help
    By hunterhunter in forum Linux - Hardware, Networking & Security
    Replies: 4
    Last Post: 02-10-2006, 07:02 PM
  4. Rsync
    By markwaugh in forum Linux - General Topics
    Replies: 0
    Last Post: 07-24-2004, 01:09 AM
  5. rsync+cron help
    By Ashcrow in forum Linux - Hardware, Networking & Security
    Replies: 1
    Last Post: 05-05-2003, 01:46 PM

Bookmarks

Posting Permissions

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