Use rsync to set up remote disaster recovery backup system

Windows Articles

x64 application emulation will arrive in Windows 10 on ARM from November

For a year now there has been speculation that Microsoft is going to implement x64 emulation in the version of Windows 10...

Install The Lounge on Ubuntu 20.04. A modern client for IRC.

Hello, friends. Believe it or not, IRC is not dead. It's still widely used. That's why in this post we'll show you how to...

The latest minor version of RHEL 7 available

In the year 2014, they finally announced Red Hat Enterprise Linux 7.0. Since then, it has become one of the most influential...

5 calibre available

Calibre is a free open source book manager, available on multiple platforms (for Linux, Windows, and Mac OS). Developers Announce Major Calibre...

eDEX-UI: A cross-platform terminal with a cool graphic interface.

No doubt there are many terminal emulators on the market. However, you can hardly get one as original as eDEX-UI. In fact,...
Mel Khamlichi
Mel Khamlichihttp://www.osradar.com
Founder of Osradar, from Amsterdam Netherlands

Introduction

In the previous article, we mentioned rsync installation and the use of some of the parameters. If you don’t understand, please read the Synchronous data Using the rsync Command Linux in this article. We learned that rsync works in three modes. The main introduction here is the server model

Server mode:

This model is based on C/S mode, in which rsync enables a daemon in the background that runs permanently on the rsync server to receive file transfer requests, so that clients can either send files to or request them from the daemon. Rsync’s server mode is ideal for use with remote central backup servers or data remote repositories.

Case

To ensure data security, the need for a remote disaster system, the site data at 3 o ‘clock in the morning every day disaster backup to a remote server, because the quantity is very big, every day can only incremental backup, backup only increase of data in the day, when the site after a failure, can be backup to restore data to a great extent.

Solution: this assumes there is A, B two Linux system, A system as A web server, B system as A system of remote disaster backup machine, thus A system is rsyncd server, B system is as A system of remote disaster backup, need to install it in A and B system software, in this way, the rsync daemon running on A system, and can through the system in B daemon crontab to specified by A system backup data regularly, so as to realize the data remote disaster.

System environment

Two virtual machines and Install rsync

server: 172.16.6.116
client: 172.16.6.117

Rsync service configuration

We first need to create rsync’s configuration directory and the necessary configuration files.

Create a profile if none exists

touch /etc/rsyncd.conf

man rsyncd.conf to check the instructions

man rsyncd.conf 
man rsyncd.conf
rsyncd.conf

Editor configuration file Add content

[root@localhost ~]# vim /etc/rsyncd.conf
uid = rsync
gid = rsync
fake super = yes
use chroot = no
max connections = 2000
timeout = 600
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
ignore errors
read only = false
list = false
hosts allow = 0.0.0.0/0
auth users = rsync_backup
secrets file = /etc/rsync.passwd
[backup]
comment = welcome to xiyuxingxia backup!
path = /backup/
  • Add user rsync service users, manage local directory
[root@localhost ~]# useradd -s /sbin/nologin  -M rsync
[root@localhost ~]# id rsync
useradd
useradd

Configure the remote connected account

Create a password file

echo "rsync_backup:kobe" > /etc/rsync.passwd  
(Rsync_backup for remote user kobe for password rsync.passwd for password configuration file)

Set permissions for the password file

[root@localhost etc]# chmod 600 /etc/rsync.passwd
[root@localhost etc]# ll /etc/rsync.passwd
Configure the remote connected account
Configure the remote connected account

Create a Shared directory and authorize rsync as the user service manager

[root@localhost ~]# mkdir -p /backup
[root@localhost ~]# chown -R rsync.rsync  /backup
[root@localhost ~]# ll /backup

Start the rsync service and check

[root@localhost ~]# systemctl start rsyncd
[root@localhost ~]# systemctl status  rsyncd
Start the rsync service and check
Start the rsync service and check

Configuration complete! Congratulations! After the above operation, a backup server is set up under Linux!!!

Client configuration

Generate the password file needed to connect to the server

[root@localhost ~]# echo "kobe" >/etc/rsync.passwd

Set permissions for the password file

[root@localhost ~]# chmod 600 /etc/rsync.passwd

Create a directory for local backups

[root@localhost ~]# mkdir -p /backup

Push the contents of the client backup to the backup server

rsync -avz /backup/  rsync_backup@172.16.6.116::backup/  --password-file=/etc/rsync.passwd
rsync Push
Push

Pull content from the server to the client

[root@localhost backup]# rsync -avz rsync_backup@172.16.6.116::backup/ /backup/  --password-file=/etc/rsync.passwd
rsync pull
pull

So, enjoy it.

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

x64 application emulation will arrive in Windows 10 on ARM from November

For a year now there has been speculation that Microsoft is going to implement x64 emulation in the version of Windows 10...

Install The Lounge on Ubuntu 20.04. A modern client for IRC.

Hello, friends. Believe it or not, IRC is not dead. It's still widely used. That's why in this post we'll show you how to...

The latest minor version of RHEL 7 available

In the year 2014, they finally announced Red Hat Enterprise Linux 7.0. Since then, it has become one of the most influential...

5 calibre available

Calibre is a free open source book manager, available on multiple platforms (for Linux, Windows, and Mac OS). Developers Announce Major Calibre...

eDEX-UI: A cross-platform terminal with a cool graphic interface.

No doubt there are many terminal emulators on the market. However, you can hardly get one as original as eDEX-UI. In fact,...
x