当前位置:网站首页>Synchronize files using unison
Synchronize files using unison
2022-07-02 08:39:00 【Teacher Liu Trent】
Unison Is a cross platform file synchronization tool , It is very useful for synchronizing data between computers or storage devices . |
Environmental Science
- Centos7(1): 192.168.43.165
- Centos7(2): 192.168.43.166
install Unison
Install... In both systems epel Source , And then they all need to be installed unison:
[[email protected]_168_43_165 ~]# yum -y install epel-release
[[email protected]_168_43_165 ~]# yum makecache
[[email protected]_168_43_165 ~]# yum -y install unison
- 1.
- 2.
- 3.
Two operating system configurations ssh Password free login
[[email protected]_168_43_165 ~]# ssh-keygen
- 1.

[[email protected]_168_43_165 ~]# ssh-copy-id [email protected]
[[email protected]_168_43_165 ~]# cd ~/.ssh
[[email protected]_168_43_165 .ssh]# cat id_rsa.pub > authorized_keys
[[email protected]_168_43_165 .ssh]# scp id_rsa [email protected]:/root/.ssh
- 1.
- 2.
- 3.
- 4.
How to use Unison
Unison Used to synchronize a group of files in a directory to another location with similar structure , The location can be a local host or a remote host .
Local file synchronization
stay root Create two folders under the home directory , One is "Files", One is "Backup".Files Create files in it , Synchronize to Backup Inside .
[[email protected]_168_43_165 ~]# mkdir Files Backup
[[email protected]_168_43_165 ~]# cd Files/
[[email protected]_168_43_165 Files]# touch file{1..10}.txt
- 1.
- 2.
- 3.

Now run unison command , Synchronize files to Backup In the folder .
[[email protected]_168_43_165 ~]# unison -batch /root/Files /root/Backup
- 1.

Check it out. Backup Folder , I found that the files were synchronized .

Let's change it now Backup A file in a folder , Then add the given file , Last but not least, I'll do the same thing command , See if it syncs to Files In the folder :
[[email protected]_168_43_165 Backup]# echo "testtesttest" > file2.txt
[[email protected]_168_43_165 Backup]# echo 'hello world!' > index.html
- 1.
- 2.

perform unison command :
[[email protected]_168_43_165 ~]# unison -batch /root/Files /root/Backup
- 1.

You can see Backup The contents in the folder are synchronized to Files Inside the

Remote file synchronization
If you need remote file synchronization , Must be installed on both local and remote servers Unison.
Now we have two servers root Create two folders under the directory , Used for synchronizing files .
# Create a folder on the first server .
[[email protected]_168_43_165 ~]# mkdir Files
# Create a folder on the second server .
[[email protected]_168_43_166 ~]# mkdir Files
- 1.
- 2.
- 3.
- 4.
Use -testServer Option to test connectivity between local and remote servers .
[[email protected]_168_43_165 ~]# unison -testServer /root/Files ssh://[email protected]//root/Files
Contacting server...
Connected [//192_168_43_165//root/Files -> //192_168_43_166//root/Files]
- 1.
- 2.
- 3.

After connectivity is OK , We can execute the command to synchronize the file :
[[email protected]_168_43_165 ~]# unison -batch /root/Files ssh://[email protected]//root/Files
- 1.


Look at the... On the second server /root/Files Folder , Is the file synchronized :

summary
Unison Very easy to use , It doesn't take extra energy . It can be GUI And custom synchronization in any way in command line utilities . If you need to use a graphical interface , It can be executed in a desktop environment unison-gtk-2.40 Open the graphical interface for configuration .
边栏推荐
- HackTheBox-Gunship
- c语言自定义类型枚举,联合(枚举的巧妙使用,联合体大小的计算)
- Tcp/ip - transport layer
- Linked list classic interview questions (reverse the linked list, middle node, penultimate node, merge and split the linked list, and delete duplicate nodes)
- Viewing JS array through V8
- sqli-labs第8关(布尔盲注)
- 2022 Heilongjiang latest construction eight members (materialman) simulated examination questions and answers
- zipkin 简单使用
- Sentinel easy to use
- Dip1000 runaway
猜你喜欢

使用wireshark抓取Tcp三次握手

Solid principle: explanation and examples

Linux安装Oracle Database 19c RAC

Method recursion (Fibonacci sequence, frog jumping steps, tower of Hanoi problem)

Getting started with k8s: building MySQL with Helm

OpenShift 部署应用

Sentinel easy to use

HCIA - application layer

Linked list classic interview questions (reverse the linked list, middle node, penultimate node, merge and split the linked list, and delete duplicate nodes)

c语言自定义类型枚举,联合(枚举的巧妙使用,联合体大小的计算)
随机推荐
[dynamic planning] p4170: coloring (interval DP)
Minecraft group service opening
DWORD ptr[]
Network security - summary and thinking of easy-to-use fuzzy tester
Simple implementation scheme of transcoding and streaming (I)
Openfeign is easy to use
Matlab mathematical modeling tool
文件上传-upload-labs
STM32-新建工程(参考正点原子)
ICMP协议
Matlab other
sqli-labs(POST类型注入)
Dip1000 runaway
Viewing JS array through V8
Matlab-其它
Development of digital collection trading website development of metauniverse digital collection
Makefile Fundamentals
[flask] ORM one-to-one relationship
How to uninstall SQL Server cleanly
Aneng logistics' share price hit a new low: the market value evaporated by nearly 10 billion yuan, and it's useless for chairman Wang Yongjun to increase his holdings