티스토리 뷰

​1. 원본 서버 lsyncd 설치

apt update&&upgrad
apt-get install -y lyncd

 

2. 원본 서버 ssh key 생성

root@q381-1921:/# ssh-keygen

Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa
Your public key has been saved in /root/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:/a3uBy9NYgx3isDrVnCUEH9pK+oYOM4NygJIBCDz+WY root@q381-1921
The key's randomart image is:
+---[RSA 3072]----+
|B       oo .     |
|.+ .     .o  .   |
|. o    . .. +    |
| . .    +.oo...  |
|o   E   S=o=.o   |
|o  o .  ..oo*..  |
|.   + .... ..*.  |
|.. + + +o   ..+  |
| .o o o..  o+o   |
+----[SHA256]-----+

root@q381-1921:/# cat ~/.ssh/id_rsa.pub | ssh -p 22 1.1.1.1 "cat >> .ssh/authorized_keys"

The authenticity of host '[1.1.1.1]:22 ([1.1.1.1]:22)' can't be established.
ECDSA key fingerprint is SHA256:OD0g2UQiH4NpaZKhtbW97faXxl2nX4anWZYCPnS2tl8.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[58.72.3.2]:4022' (ECDSA) to the list of known hosts.
root@1.1.1.1's password:

 

3. 원본서버 lsyncd 설정

root@q381-1921:/# cd /etc
root@q381-1921:/etc# mkdir lsyncd 
root@q381-1921:/# cd lsyncd
root@q381-1921:/etc/lsyncd# vi lsyncd.conf.lua

settings {
        logfile = "/var/log/lsyncd/lsyncd.log",
        statusFile = "/var/log/lsyncd/lsyncd-status.log",
        statusInterval = 20
        nodaemon = false
}

sync {
        default.rsyncssh,
        source="/data/images",
        host="1.1.1.1",
        targetdir="/data/images_backup",
        delay = 1,
        delete = false,
        ssh = {
                port = 22
        },
        rsync = {
                archive = true,
                compress = true,
                verbose = true,
                _extra = {"--bwlimit=730"}

        }
}
:wq

root@q381-1921:/etc/lsyncd# cd /var/log
root@q381-1921:/var/log# mkdir lsyncd 
root@q381-1921:/var/log# cd lsyncd
root@q381-1921:/var/log/lsyncd# 
root@q381-1921:/var/log/lsyncd# touch lsyncd.log
root@q381-1921:/var/log/lsyncd# touch lsyncd-status.log
root@q381-1921:/var/log/lsyncd# systemctl restart lsyncd
root@q381-1921:/var/log/lsyncd#  systemctl enable lsyncd

 

4. Taget서버 rsync 설치

root@Daniel:/# apt-get install -y rsync
root@Daniel:/# systemctl start rsync

 

5. Taget서버 rsync설정

root@Daniel# vi /etc/rsyncd.conf
# /etc/rsyncd: configuration file for rsync daemon mode
# See rsyncd.conf man page for more options.
# configuration example:
# uid = nobody
# gid = nobody
# use chroot = yes
# max connections = 4
# pid file = /var/run/rsyncd.pid
# exclude = lost+found/
# transfer logging = yes
# timeout = 900
# ignore nonreadable = yes
# dont compress   = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2

# [ftp]
#        path = /home/ftp
#        comment = ftp export area
[web]
path = /data/images
comment = image_backup
hosts allow=2.2.2.2
uid = root
gid = root
use chroot = yes
read_noly = no
:wq​

'System > Linux' 카테고리의 다른 글

Tar 압축 및 해제  (0) 2022.05.12
[Ubuntu] 타임존 설정  (0) 2022.04.21
SSH 접속시 에러  (0) 2022.01.29
CentOS Stream으로 인한 대처 방안  (0) 2021.04.21
[ CentOS6 ] 무료 SSL인 Let’s encrypt 설치와 관리  (0) 2019.04.05
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함