In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "introduction and use of Rsync under Linux". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Introduction of 0.Rsync
Rsync is a file synchronization and data transfer tool under the Linux system, it is well-known based on the "delta-transfer" algorithm, to ensure file synchronization between the client and the remote server, rsync can support breakpoint resume; rsync transfers only the inconsistent parts of the source file and the target file; rsync supports full backup and incremental backup.
Characteristics of 1.Rsync
Mirror the entire directory tree and file system
Incremental synchronization, reduce synchronization time and improve backup efficiency.
Keep the permissions, time, links and other attributes of the original file.
Encrypted transmission to ensure data security.
Support for anonymous transmission
Deployment and installation of 2.Rsync
The home page of rysnc is: https://rsync.samba.org/download.html. The downloaded version is: * * rsync-3.1.3** version.
[root@db ~] # tar zxvf rsync-3.1.3.tar.gz [root@db ~] # cd rsync-3.1.3 [root@db rsync-3.1.3] #. / configure [root@db rsync-3.1.3] # make [root@db rsync-3.1.3] # make install3. Build a remote backup system. 3.1 Environment configuration client: Platform: Linux 86_64Server Name: db01.zsd.com, IP: 172.17.4.201 Server: Platform: Linux 86_64Server Name: db02.zsd.com, IP: 172.17.4.202
Scene effect: the Oracle RMAN backup file of [172.17.4.201] is transferred to [172.17.4.202].
3.2 configuration of server Rsync
Configure the server in [172.17.4.202].
Install rysnc
[root@db ~] # tar zxvf rsync-3.1.3.tar.gz [root@db ~] # cd rsync-3.1.3 [root@db rsync-3.1.3] #. / configure [root@db rsync-3.1.3] # make [root@db rsync-3.1.3] # make install
Server side configuration / etc/rsyncd.conf
[root@db backup] # mkdir-p / backup/oracle_full_201/ [root @ db backup] # mkdir-p / backup/zsd_test_201/ [root @ db etc] # vi / etc/rsyncd.conf#__#created by zsd 2019-03-28##rsyncd.conf start##uid = rootgid = rootuse chroot = nomax connections = 200timeout = 600pid file = / Var/run/rsyncd.pidlock file = / var/run/rsync.locklog file = / var/log/rsyncd.log#__#backupfile01# [oracle_full_201] path = / backup/oracle_full_201/ignore errorsread only = falselist = falsehosts allow = 172.17.4.201hosts deny = 0.0.0.0/32auth users = rsync_backupsecrets file = / etc/rsync.password#backuptest01# [zsd_test_201] path = / backup/zsd_test_201/ignore errorsread only = falselist = falsehosts allow = 172.17.4.201hosts deny = 0.0.0.0/32auth users = rsync_backupsecrets file = / etc/rsync.password
Configure password file
[root@db etc] # vi / etc/rsync.passwordrsync_backup: zsd7101 [root @ db etc] # chmod 600 / etc/rsync.password
The server starts the rsync daemon
[root@db etc] # / usr/local/bin/rsync-- configuration of daemon3.3 client rsync.
Additional skills (complete with Oracle RMAN)-optional
[oracle@db logs] $rman target / RMAN > run {allocate channel c1 device type disk format'/ u01 backup database plus archivelog delete all input;release channel / U01 backup database plus archivelog delete all input;release channel c1 release channel c2 device type disk format'/ u01 channel c2 device type disk format'/ u01 channel c3 device type disk format'/ u01 apprenticeship channel c3 device type disk format'/ u01 apprenticeship
Here do not do too much detail description, purpose: to do a complete Oracle database. Finally, the [/ u01/app/backup/rman/] directory data is backed up remotely.
Set password file
[root@db ~] # vi / etc/rsync.passwordzsd7101
If you need oracle users to transfer backups. The following permissions need to be set:
[root@db rman] # chown-R oracle:oinstall / etc/rsync.password [oracle@db ~] $chmod 600 / etc/rsync.password
Client [172.17.4.201] transfers backup
[oracle@db] $rsync-vzrtopg-- progress / u01/app/backup/rman/ rsync_backup@172.17.4.202::oracle_full_201-- password-file=/etc/rsync.password
Where [- vzrtopg],-v is-- verbose, that is, detailed mode output;-z is-- compress, which compresses the backed-up files during transfer;-r means-recursive, that is, subdirectories are processed in recursive mode and then transferred to the remote end;-t means-- times, which retains file time information;-o means-- owner, which is used to maintain owner information;-p, that is-- perms, is used to maintain file permissions. G is-- group, which retains the group information of the file.
-- progress, which shows the detailed process of data mirror synchronization.
Rsync_backup@172.17.4 .202:: oracle_full_201, which means that the directory corresponding to the backup location name [oracle_full_201] is: / backup/oracle_full_201/. Use rsync_backup user backup. 172.17.4.202 is the server-side IP.
-- password-file=/etc/rsync.password to ensure that the passwords of the client and the server are the same and that they are transmitted correctly.
The rsync--delete and-- backup commands add
Transfer three files to the server
[oracle@db zsd] $pwd/u01/app/zsd [oracle@db zsd] $echo "you are handsome boy" > > zsd01.log [oracle@db zsd] $echo "you are handsome boy 02" > > zsd02.log [oracle@db zsd] $echo "you are handsome boy 03" > > zsd033.log [oracle@db zsd] $lszsd01.log zsd02.log zsd033.log## transfers files to [zsd_test_201] module directory [oracle@db zsd] $rsync-av on the server side -- no-iconv-- progress-- backup--backup-dir= `date +% Ymuri% mmury% d`-- delete / u01/app/zsd rsync_backup@172.17.4.202::zsd_test_201-- password-file=/etc/rsync.password
Delete a file and create a new file. View the effect of-- delete and-- backup commands
[oracle@db zsd] $rm zsd033.log [oracle@db zsd] $echo "just for fun" > > zsd04.log [oracle@db zsd] $rsync-av-- no-iconv-- progress-- backup--backup-dir= `date +% Ymuri% mmurd`-- delete / u01/app/zsd rsync_backup@172.17.4.202::zsd_test_201-- password-file=/etc/rsync.password
By looking at the following log, it is found that zsd033.log has been deleted, and zsd04.log 's log has been synchronized, and. The zsd033.log file is placed in the [/ backup/zsd_test_201/2019-03-28/zsd] directory.
Sending incremental file listdeleting zsd/zsd033.logzsd/zsd/zsd04.log 27 100% 0.00kB/s 0:00:00 (xfr#1, to-chk=0/4) # Server side operation [root@db backup] # cd / backup/zsd_test_201/ [root @ db zsd_test_201] # ls2019-03-28 zsd [root@db zsd] # pwd/backup/zsd_test_201/2019-03-28/zsd [root@db zsd] # lszsd033.log
Among them, the-- delete command, as above, synchronizes the data mirrors based on the [/ u01/app/zsd] of the local directory to ensure that the client directory is exactly the same as the server directory.
-- backup and-- backup-dir, ensure that the files removed above are placed in the backup directory to ensure a complete backup record.
This is the end of the introduction and use of Rsync under Linux. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.