https://www.youtube.com/watch?v=S0UTSQsmCc4
SOURCE 서버에 다음과 같이 설치합니다.
# ssh-keygen
# cat /root/.ssh/id_rsa.pub
ssh-rsa AAAAB3Nz..........OGyCkT root@ip-172-31-41-225.ap-northeast-2.compute.internal
위의 내용을 복사하여 타겟 서버의 /root/.ssh/authorized_keys 에 추가합니다.
TARGET 서버에 다음과 같이 복사합니다.
# vi /root/.ssh/authorized_keys
아까 소스 서버에서 복사한 키를 하단에 추가로 붙여넣기 합니다.
(기존에 파일이 있다면 이 코드를 추가합니다.)
ssh-rsa AAAAB3Nz..........OGyCkT root@ip-172-31-41-225.ap-northeast-2.compute.internal
# ssh-keyscan -t rsa 255.1.2.3 > /root/.ssh/known_hosts
(255.1.2.3 은 타겟서버아이피)
# yum install epel-release
# yum install lsyncd
# vi /etc/lsyncd.conf
-- sync{default.rsyncssh, source="/var/www/html", host="localhost", targetdir="/tmp/htmlcopy/"}
settings {
logfile = "/var/log/lsyncd/lsyncd.log",
statusFile = "/var/log/lsyncd/lsyncd-status.log"
}
sync {
default.rsyncssh,
source="/home/ec2-user", -- 소스 서버 디렉토리
host="255.1.2.3", -- 타겟 서버 아이피 or 도메인
targetdir="/home/ec2-user", -- 타겟 서버 디렉토리
delete=true, -- 삭제시 타겟 서버에 반영하기(동기화 하기)
delay=1, -- 1초
rsync={
archive=true -- 사용자와 퍼미션 동기화 하기
}
}
설정 파일이 이상 있는지 확인하기
# lsyncd /etc/lsyncd.conf
08:05:08 Normal: --- Startup, daemonizing ---
위와 같이 정상 이라면
# systemctl start lsyncd
로그 확인하기
# tail -f /var/log/lsyncd/lsyncd.log
위와 같이 설정한후
소스 서버의 /home/ec2-user 에 파일이나 디렉토리를 생성(삭제)하면
타겟 서버의 /home/ec2-user 에 동기화 됩니다.
댓글 9개
게시글 목록
| 번호 | 제목 |
|---|---|
| 16619 | |
| 16618 | |
| 16612 | |
| 16603 | |
| 16598 | |
| 16589 | |
| 16578 | |
| 16571 | |
| 16563 | |
| 16554 | |
| 16546 | |
| 16534 | |
| 16527 | |
| 16520 | |
| 16513 | |
| 16510 | |
| 16505 | |
| 16498 | |
| 16490 | |
| 16486 | |
| 16482 | |
| 16465 | |
| 16458 | |
| 16456 | |
| 16448 | |
| 16447 |
PHP
한글 초,중,종성 분리하기
3
|
| 16440 | |
| 16439 |
웹서버
nginx 설치시 보안
3
|
| 16438 | |
| 16430 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기