Saturday, October 10, 2009

My Linux Experiances..... (a little)

Backup

  • Rsync
    rsync is an open source utility that provides fast incremental file transfer. You can use the following script for the rsync
  • Here i am going to explain to rsync the /var/lib/mysql directory of the 192.168.0.125 to the backup server's path /backup1.For taht first of all we have to create the ssh key .you can use command ssh-keygen -t rsa -f mykey

    mkdir /scripts
    cd /scripts
    ssh-keygen -t rsa -f mykey {press enterkey for the promoting )
    vi backup.sh
       REMOTE_USER=root
    REMOTE_HOST=192.168.0.125
    REMOTE_PATH=/var/lib/mysql
    LOCAL_PATH=/backup1/
    KEY_FILE=mykey
    COMMAND=`which ssh`
    echo $COMMAND
    rsync --delete -avvvz -e "$COMMAND -i $KEY_FILE"
    $REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH $LOCAL_PATH
    chmod u+x backup.sh
    {be ensure the folder /backup1}is exist }
    sh backup.sh

    No comments:

    Post a Comment

    Which operating system you like most?