当前位置:网站首页>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 .
边栏推荐
- 旋转链表(图解说明)
- Shortcut key to comment code and cancel code in idea
- STM32 new project (refer to punctual atom)
- W10 is upgraded to W11 system, but the screen is black, but the mouse and desktop shortcuts can be used. How to solve it
- Sqli labs (post type injection)
- 2022 Heilongjiang latest construction eight members (materialman) simulated examination questions and answers
- HCIA - data link layer
- kubeadm部署kubernetes v1.23.5集群
- TCP/IP—传输层
- SQL operation database syntax
猜你喜欢

Sqli labs level 12

OpenShift 容器平台社区版 OKD 4.10.0部署

Sqli labs level 8 (Boolean blind note)

File upload Labs

Sentinel easy to use

Gateway is easy to use

Use Wireshark to grab TCP three handshakes

双向链表的实现(双向链表与单向链表的简单区别联系和实现)

Solid principle: explanation and examples

W10 is upgraded to W11 system, but the screen is black, but the mouse and desktop shortcuts can be used. How to solve it
随机推荐
实现双向链表(带傀儡节点)
Matlab-其它
Solid principle: explanation and examples
What is SQL injection
16: 00 interview, came out at 16:08, the question is really too
ICMP Protocol
顺序表基本功能函数的实现
Shortcut key to comment code and cancel code in idea
Generate database documents with one click, which can be called swagger in the database industry
Use the numbers 5, 5, 5, 1 to perform four operations. Each number should be used only once, and the operation result value is required to be 24
Matlab mathematical modeling tool
OpenShift 容器平台社区版 OKD 4.10.0部署
Linux二进制安装Oracle Database 19c
Concise analysis of redis source code 11 - Main IO threads and redis 6.0 multi IO threads
Dip1000 runaway
方法递归(斐波那契数列,青蛙跳台阶,汉诺塔问题)
Minecraft安装资源包
Service de groupe minecraft
How to build the alliance chain? How much is the development of the alliance chain
Honeypot attack and defense drill landing application scheme