Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Centos6.5 rsync synchronous backup

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

This chapter mainly explains the realization of fast, safe and efficient remote backup.

Experimental environment: server A 192.168.1.10 client B 192.168.1.20

First, install rsync yum-y install rsync*

Create a new configuration file vi / etc/rsyncd.conf

Uid = nobody

Gid = nobody

Use chroot = yes

Address = 192.168.1.10

Port 873

Log file = / var/log/rsyncd.log

Pid file = / var/run/rsyncd.pid

Hosts allow = 192.168.1.0 Compact 24

[yy]

Path = / var/www/html

Comment = ccccccccccccc

Read only = yes

Dont compress = * .gz * .bz2

Auth users = bin

Secrets file = / etc/rsyncd_users.db

Note: if you use anonymous synchronization, just remove the auth users and secrets file configuration records.

Second, create a password authentication file vi / etc/rsyncd_users.db

Bin:123

Save exit

Modify password file permissions chmod 600 / etc/rsyncd_users.db

Third, start rsync rsync-- daemon ps-ef | grep rsync to view the process.

If you want to end the process kill process number kill

1. Use rsync local backup to back up the file / etc/fastab to / tmp

Rsync-rl / etc/fastab / tmp/

2. To use the client for remote backup, first configure the server firewall iptables-I INPUT-p tcp-- dport 873-j ACCEPT

Service iptables save Save Firewall

Fourth, client configuration

1. Create the test directory mkdir / rsync

two。 Synchronize rsync shared directories

# rsync bin@192.168.1.10::yy / / Browse sharing

Vim / root/rsync_pass / / set password file

123 / / only need to write the login user password, which should be consistent with the password set by the server

Chmod 60000 / root/rsync_pass / / error will be reported if permissions are not modified

Rsync-az-- password-file=/root/rsync_pass bin@192.168.1.10::yy / rsync / / synchronization

3. Put rsync into crontab scheduled tasks and synchronize once a day

# crontab-e

0 5 * / usr/bin/rsync-a-password-file=/root/rsync_pass bin@192.168.1.10::yy / rsync

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.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report