This shows you the differences between two versions of the page.
rl:labs:08:contents:12 [2023/11/05 12:57] vlad_iulius.nastase removed |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== 12. [BONUS - 10p] Transfer sincronizat de fișiere folosind ''rsync'' peste SSH ==== | ||
- | [[http://rsync.samba.org/|rsync]] este un utilitar și protocol care permite transfer incremental. Este foarte potrivit pentru situații de backup, când se transferă doar actualizările sau pentru mentenanța unui mirror, la fel transferându-se de la serverul central doar noile date. Altfel de operații poartă numele de "sincronizare" (//syncing//). | ||
- | |||
- | Dorim să facem backup prin rsync al directorului ''proiecte/'' din directorul home al utilizatorului ''ana'' de pe stația ''host'' în contul ''bogdan'' de pe stația ''blue''. Atunci când vom actualiza conținutul directorului ''proiecte/'', procesul de backup va transfera doar modificările. | ||
- | |||
- | Folosiți ''rsync'' și protocolul SSH pentru a realiza acest lucru. Se dorește ca autentificarea să se realizeze pe bază de chei, fără parolă. | ||
- | |||
- | <hidden> | ||
- | <solution -hidden> | ||
- | <code bash> | ||
- | ana@host:~$ ssh-keygen | ||
- | [...] | ||
- | ana@host:~$ ssh-copy-id bogdan@blue | ||
- | bogdan@blue's password: | ||
- | [...] | ||
- | ana@host:~$ rsync -avz -e ssh proiecte/ bogdan@blue: | ||
- | sending incremental file list | ||
- | ./ | ||
- | ana.txt | ||
- | are.txt | ||
- | mere.txt | ||
- | |||
- | sent 214 bytes received 72 bytes 572.00 bytes/sec | ||
- | total size is 13 speedup is 0.05 | ||
- | |||
- | ana@host:~$ rsync -avz -e ssh proiecte/ bogdan@blue: | ||
- | sending incremental file list | ||
- | |||
- | sent 78 bytes received 12 bytes 180.00 bytes/sec | ||
- | total size is 13 speedup is 0.14 | ||
- | |||
- | ana@host:~$ echo "Lok'tar ogar" > proiecte/orc.txt | ||
- | ana@host:~$ ls proiecte/ | ||
- | ana.txt are.txt mere.txt orc.txt | ||
- | |||
- | ana@host:~$ rsync -avz -e ssh proiecte/ bogdan@blue: | ||
- | sending incremental file list | ||
- | ./ | ||
- | orc.txt | ||
- | |||
- | sent 166 bytes received 34 bytes 400.00 bytes/sec | ||
- | total size is 26 speedup is 0.13 | ||
- | |||
- | ana@host:~$ rsync -avz -e ssh proiecte/ bogdan@blue: | ||
- | sending incremental file list | ||
- | |||
- | sent 110 bytes received 12 bytes 244.00 bytes/sec | ||
- | total size is 26 speedup is 0.21 | ||
- | </code> | ||
- | </solution> | ||
- | </hidden> |