当前位置:网站首页>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 .
边栏推荐
猜你喜欢
sqli-labs第12关
Classes and objects (instantiation of classes and classes, this, static keyword, encapsulation)
ICMP协议
Sqli labs level 8 (Boolean blind note)
Method recursion (Fibonacci sequence, frog jumping steps, tower of Hanoi problem)
【无标题】
Kubedm deploys kubernetes v1.23.5 cluster
TCP/IP—传输层
Getting started with k8s: building MySQL with Helm
Driving test Baodian and its spokesperson Huang Bo appeared together to call for safe and civilized travel
随机推荐
HCIA—应用层
Makefile基本原理
Sqli labs (post type injection)
Pointer initialization
Minecraft空岛服开服
Intelligent manufacturing solutions digital twin smart factory
方法递归(斐波那契数列,青蛙跳台阶,汉诺塔问题)
Matlab other
Minecraft模组服开服
In depth understanding of prototype drawings
Development of digital collection trading website development of metauniverse digital collection
OpenFeign 简单使用
双向链表的实现(双向链表与单向链表的简单区别联系和实现)
C language replaces spaces in strings with%20
Openfeign facile à utiliser
Chrome debugging
C language custom type enumeration, Union (clever use of enumeration, calculation of union size)
[flask] ORM one-to-one relationship
Qunhui NAS configuring iSCSI storage
Kubedm deploys kubernetes v1.23.5 cluster