In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to install rsync under Linux, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
Rsync is a data mirror backup tool under linux system. Use the fast incremental backup tool Remote Sync to synchronize remotely, support local replication, or synchronize with other SSH or rsync hosts. Currently, cross-platform support can be used to synchronize data between Windows and Linux.
Installation
In RedHat, rsync is installed by default. You can check whether it is installed from the command line
[root@linuxprobe] # rpm-Q rsyncrsync-3.0.4-2.47.28
Configure rsync server
1. Modify the configuration file of rsync to change disable from "yes" to "no"
[root@linuxprobe ~] # vi / etc/xinetd.d/rsyncservice rsync {disable = no socket_type = stream wait = no user = root server = / usr/bin/rsync server_args =-- daemon log_on_failure + = USERID}
Set up the boot RSYNC
[root@linuxprobe ~] # chkconfig rsync on
two。 Configure / etc/rsyncd.conf (need to be generated manually)
Global parameter
Uid = root / / the user running the RSYNC daemon gid = root / / the group running the RSYNC daemon use chroot = no / / does not use chrootmax connections = 4 / / the maximum number of connections is 4strict modes = yes / / whether or not to check the password file permissions port = 873 / / default port 873
Module parameters
[backup] / / here is the name of the authenticated module. On the client side, you need to specify path = / home/backup/ the directory to be mirrored, which is indispensable! Comment = This is a test / / the comment information of this module ignore errors / / can ignore some irrelevant IO errors read only = yes / / read-only list = no / / do not allow column file auth users = linuxprobe / / authenticated user name, if not this line indicates anonymity, this user has nothing to do with the system secrets file = / etc/rsync.pas / / password and user name comparison table The password file is generated by itself, hosts allow = 192.168.1.1 10.10.10.10 / / allow host hosts deny = 0.0.0.0amp0 / / disable host # transfer logging = yes comment: the following files are automatically generated after the installation of the RSYNC service lock file = / var/run/rsyncd.pid / / pid file storage location lock file = / var/run/rsync.lock / / location of lock file log file = / var/log/rsyncd.log / / location of log file
3. Configure rsync password
(1) create a password file (secrets file = / etc/rsync.pas in the above configuration file)
[root@linuxprobe ~] # vim / etc/rsync.paslinuxprobe:password / / account: password, one user per line
(2) the permission to modify password file is 600.
[root@linuxprobe ~] # chown root.root / etc/rsync.pas [root@linuxprobe ~] # chmod 600 / etc/rsync.pas
4. Set Welcome message / etc/rsyncd.motd (optional) rsyncd.motd records the welcome message of the rsync service, in which you can enter any text message, such as:
[root@linuxprobe ~] # vim / etc/rsyncd.motdWelcome to use the rsync services!
5. Effective configuration
[root@linuxprobe ~] # service xinetd restart
Start rsync server
1. Two ways to start the RSYNC server (1) start the rsync server (start independently)
[root@linuxprobe] # / usr/bin/rsync-daemon
(2) start the rsync server (with xinetd super process started)
[root@linuxprobe ~] # / etc/rc.d/init.d/xinetd reload
two。 Join rc.local
In a variety of operating systems, rc files are stored in different locations, which can be modified to load rsync-daemon when the system is started.
[root@linuxprobe ~] # vim / etc/rc.local join a line / usr/bin/rsync-- daemon
3. Check whether rsync is started
If the output shows that the state is LISTEN, indicating the status of waiting for the link to be accepted, the rsync has been started.
[root@linuxprobe ~] # netstat-a | grep rsync tcp 0 0 0.0.0 0 grep rsync tcp 873 0.0.0 0. 0 LISTEN
Configure rsync client
1. Set password
[root@linuxprobe ~] # vim / etc/rsync.pas password
Modify permissions
[root@linuxprobe ~] # chown root.root / etc/rsync.pas [root@linuxprobe ~] # chmod 600 / etc/rsync.pas
2. Client connects to SERVER
Fetch files from the SERVER side
/ usr/bin/rsync-vzrtopg-progress-delete linuxprobe@192.168.0.217::backup / home/backup-password-file=/etc/rsync.pas
Upload a file to the SERVER side
/ usr/bin/rsync-vzrtopg-progress-password-file=/root/rsync.pas / home/backup linuxprobe@192.168.0.217::backup
This command will back up all files (including subdirectories) in the local machine / home/backup directory to the backup directory set by the backup module of RSYNC SERVER (172.20.0.6). Note that if the path ends with a "/", it means that something under the directory is backed up, but the directory is not created, if it is not with "/", the directory is created.
RSYNC usage:
Rsync [OPTION]... [USER@] HOST::SRC [DEST] # backup files from RSYNC SERVER to local machine rsync [OPTION]. SRC [SRC]... [USER@] HOST::DEST # backup files to RSYNC SERVER from the local machine
3. Automatic operation
\ 1) make script files
[root@linuxprobe] # vim / usr/local/rsync/time.sh [root@linuxprobe ~] #! / bin/bash/usr/bin/rsync-vzrtopg-- progress-- delete linuxprobe@192.168.0.217::backup / home/backup-- password-file=/etc/rsync.pas
\ 2) Edit crontab
[root@linuxprobe ~] # crontab-e55 * / usr/local/rsync/time.sh / / run the time.sh script file every 55 minutes
Firewall Settin
If there is a firewall on the server, you need to set iptables in the server to open port 837.
[root@linuxprobe] # iptables-An INPUT-p tcp-- dport 873-j ACCEPT
Thank you for reading this article carefully. I hope the article "how to install rsync under Linux" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
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.