1. 程式人生 > 資訊 >雲米官方迴應:大屏冰箱一直可以一鍵關閉廣告

雲米官方迴應:大屏冰箱一直可以一鍵關閉廣告

1、使用rsync進行資料同步

格式:rsync 【選項】 原始檔 目標檔案

常用選項:

-a,--archive(存檔)歸檔模式,表示以遞迴的方式傳輸檔案,並且保持檔案屬性

-z,表示壓縮傳輸

-P,顯示傳輸進度

--delete,刪除那些目標檔案有而原始位置沒有的檔案

例:在niexj21上建立/mnt/test1,把檔案/mnt/,備份到niexj22的/backup檔案中

[root@niexj21 ~]# touch /mnt/test1

[root@niexj22 ~]# mkdir /backup

[root@niexj21 ~]# rsync -azP /mnt 192.168.1.22:/backup

[root@niexj22 ~]# ls /backup
mnt

[root@niexj22 ~]# ls /backup/mnt/
test1

兩臺主機之間實現無交付連線

[root@niexj21 ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 直接回車
Enter passphrase (empty for no passphrase):
Enter same passphrase again: 直接回車
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:直接回車


SHA256:uwYD8uqisuJTX5miaIZTTf+EIQ18qzhhHe2NNz0QRYo root@niexj21
The key's randomart image is:
+---[RSA 2048]----+
| . . .+o |
| + o... |
| . *E+.o |
| + = * + o |
| . B = +S. . |
| +.+.=+.. |
|..ooo o=. |
|*=.. . o. |
|X*o .. |
+----[SHA256]-----+

[root@niexj21 ~]# ssh-copy-id 192.168.1.22
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
[email protected]'s password:輸入密碼

測試

[root@niexj21 ~]# touch /mnt/test2
[root@niexj21 ~]# rsync -azP --delete /mnt 192.168.1.22:/backup #直接回車不需要輸入密碼

[root@niexj22 ~]# ls /backup/mnt/
test1 test2