티스토리 뷰
반응형
패키지 설치
### install pkg
yum install lsyncd lua rsync
로컬 서버 2개 패스 동기화 및 벤드위스 제한 및 오너쉽 변경
settings {
logfile="/var/log/lsyncd/lsyncd.log",
statusFile="/var/log/lsyncd/lsyncd-status.log"
}
sync {
default.rsync,
source="/lsync-data",
target="/lsync-backup",
rsync = {
owner = true,
group = true,
chown = "nike:nike",
_extra = {"--bwlimit=102400"}
}
}
sync {
default.rsync,
source="/lsync-backup",
target="/lsync-data",
rsync = {
owner = true,
group = true,
chown = "rebook:rebook",
_extra = {"--bwlimit=102400"}
}
}
내부 디렉토리 양방향 동기화
#/etc/lsync.conf
settings {
logfile="/var/log/lsyncd/lsyncd.log",
statusFile="/var/log/lsyncd/lsyncd-status.log"
}
sync {
default.rsync,
source="/reni-test",
target="/reni-test01"
}
sync {
default.rsync,
source="/reni-test01",
target="/reni-test"
}
두 서버간의 동기화 방법
reni-glusterfs01 /lsync-data -> reni-glusterfs02 /lsync-data로 동기화
마스터와 슬레이브 서버 간의 키 기반 인증을 활성화합니다.
1 키생성
[root@reni-glusterfs01 etc]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
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:ldIWAvWzqfFxOio7h1aZ8/qzcGHq0C+cdTT71+kM11k root@reni-glusterfs01
The key's randomart image is:
+---[RSA 2048]----+
| .oo . |
| + o |
| . B |
| + +o |
| So*..o E|
| .=*.=o +|
| .+===. o o+|
| =o==o. =.o|
| ..=+++o .+ |
+----[SHA256]-----+
2. 키 전달
[root@reni-glusterfs01 .ssh]# ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.0.20
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host '192.168.0.20 (192.168.0.20)' can't be established.
ECDSA key fingerprint is SHA256:CC+96EMSVm//rIvMXuvcttuWpbQJlLqIA/vriJH2EK8.
ECDSA key fingerprint is MD5:55:0c:05:20:1f:94:12:9b:eb:10:86:7c:05:69:22:72.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.0.20's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'root@192.168.0.20'"
and check to make sure that only the key(s) you wanted were added.
[root@reni-glusterfs01 .ssh]# ssh 192.168.0.20
Last login: Mon Nov 8 19:47:11 2021 from 192.168.0.18
[root@reni-glusterfs02 ~]# exit
3. lsync.conf
[root@reni-glusterfs01 lsync-data]# cat /etc/lsyncd.conf
settings {
logfile="/var/log/lsyncd/lsyncd.log",
statusFile="/var/log/lsyncd/lsyncd-status.log"
}
sync {
default.rsync,
source="/lsync-data",
target="192.168.0.20:/lsync-data"
}
[root@reni-glusterfs01 lsync-data]#
4. USER 권한으로 설정
settings {
logfile = "/var/log/lsyncd/lsyncd.log",
statusFile = "/var/log/lsyncd/lsyncd-status.log"
}
sync {
default.rsyncssh,
source="/lsync-data",
host="fendys@192.168.0.20",
targetdir="/lsync-data"
}
추가 옵션 참고
sync { } 안쪽에 작성
###디렉토리 제외
exclude = {
‘/directory01’,
‘/directory02’
},
###포트를 변경
ssh = {
port = xxxx
},
###archive 소유권까지 동일하게 동기화
###compress는 압축 실행 여부
###verbose 로그 상세 기록
###extra = {"--bwlimit=51200"} 네트워크 벤드위스 설정
rsync = {
archive = true,
compress = false,
delete = false,
verbose = false,
_extra = {"--bwlimit=51200"}
}
반응형
'linux' 카테고리의 다른 글
aws linux docker proxy (0) | 2022.01.30 |
---|---|
tcp port check (0) | 2022.01.30 |
quotas to glusterfs (0) | 2021.10.29 |
acl to glusterfs (0) | 2021.10.29 |
install glusterfs on centos7 (0) | 2021.10.28 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- ansible ios
- dl20 g9 centos7 설치
- ILO
- dl20
- 리눅스 커맨드 로그남기기
- DL20 GEN9 장비에 CentOS 7
- kernel 변경
- ansible network
- ISCSI 볼륨 RAC
- linux command log
- oracle linux8 kernel
- ios ansible
- cisco ansible
- shell connmad log
- 특정 라인삭제
- ipmi
- cgroup
- 특정 문구 치환
- CentOS 7 GUI
- windows.old 강제삭제
- cmd로 계정 생성
- 윈도우 cmd 계정 관리
- vm rac
- 윈도우서버 계정 관려
- nxos ansible
- cmd로 윈도우 계정 관리
- dl20 centos7
- nutanix rac
- chrony
- centos7 ntp
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함