IT/리눅스관련2020. 4. 24. 09:59

 

1. Rsync 서버

서버는 소스를 백업한 서버에 올린다.

 

** 패키지 설치가 안 되어있을 경우

# yum install rsync

# yum install xinetd

 

 

 

 

# vi /etc/xinetd.d/rsync

'disable = yes' 라고 되어있는 부분을 'disable = no' 로 변경한다.

 

===================================================================

# default: off

# description: The rsync server is a good addition to an ftp server, as it \

# allows crc checksumming etc.

service rsync

{

disable = no

socket_type = stream

wait = no

user = root

server = /usr/bin/rsync

server_args = --daemon

log_on_failure += USERID

}

===================================================================

 

 

 

 

# vi /etc/rsyncd.conf

/etc/rsyncd.conf의 경우 처음에는 없는 파일일 가능성이 높다. 편집기를 이용해 새로 작성해준다.

====================================================

[rsync_backup]

comment=Backup

path=/root/backup/

host allow=100.100.20.205 -> rsync 접속 허용 아이피 (복수입력가능)

uid=root

gid=root

use chroot=yes

read only=no

list=yes

max connection=0

timeout 600

secrets file=/etc/rsyncd.secrets -> 권한 사용자

====================================================

 

# vi /etc/rsyncd.secrets -> 없으면 생성

rsyncuser:rsyncuser@!

 

 

# /etc/init.d/xinetd restart

 

 

 

 

 

 

 

 

2. Rsync 클라이언트

# telnet [rsync 서버 IP] 873

ex) telnet 192.168.123.10 873

telnet을 이용하여 873 포트가 정상적으로 연결되는지 확인한다.

 

 

# rsync -avz [IP]::[서비스명] 저장디렉토리

ex) # rsync -avz 100.100.20.200::rsync_test /data/rsync_test

 

혹시 내역을 로그로 남기고 싶을 경우 아래와 같이 입력한다.

# rsync -avz 100.100.20.200::rsync_test /data/rsync_test > /data/rsync.log

 

 

 

 

 

 

3. NAS 동기화

Netgear ReadyNAS를 대상으로 설정했습니다.

NAS에 Backup / DB, Source 폴더를 생성한 후

백업 스케쥴을 생성

 

 

Remote Rsync서버 연결설정, 로컬 백업 경로 설정

 

동기화 일정 등록

 

 

 

 

 

대표사진 삭제

백업시 30일 이상 지난파일은 계속해서 삭제하므로 체크하여 적용(미적용시 무제한 계속해서 생성됨)

 

 

 

 

 

 

사진 삭제

백업 스케쥴링 현황 에서 마지막 동기화 상태를 확인 할 수 있음

 

 

Posted by Yohan.Ju
카테고리 없음2020. 4. 24. 09:55

 

1. DB 백업 스크립트

backup_db_projectname.sh

 

#!/bin/sh

# 백업설정

TODAY=`date +%Y%m%d`

BACKUP_DIR=/root/backup/DB

 

#필요한 디렉토리 생성

if [ ! -d ${BACKUP_DIR} ]

then

mkdir ${BACKUP_DIR}

chmod 700 ${BACKUP_DIR}

fi

 

# DB Root 계정정보

DB_USER="db접속계정"

DB_PW="db접속패스워드"

 

#전체 DB 백업

SQL_FILE="DB_backup_projectname.sql"

mysqldump -u ${DB_USER} -p${DB_PW} 데이터베이스명 > ${BACKUP_DIR}/${TODAY}_${SQL_FILE}

 

# 압축 및 30일 지난파일 삭제

TGZ_FILE="backup_db_projectname.tar.gz"

cd ${BACKUP_DIR}

tar cvfpz ${BACKUP_DIR}/${TODAY}_${TGZ_FILE} ${TODAY}_${SQL_FILE}

find ${BACKUP_DIR} -ctime +30 -exec rm -f {} \;

 

 

 

 

2. Source 백업 스크립트

backup_src_projectname.sh

 

#!/bin/sh

# 백업설정

TODAY=`date +%Y%m%d`

BACKUP_DIR=/root/backup/Source

 

#필요한 디렉토리 생성

if [ ! -d ${BACKUP_DIR} ]

then

mkdir ${BACKUP_DIR}

chmod 700 ${BACKUP_DIR}

fi

 

# 압축 및 30일 지난파일 삭제

TGZ_FILE="backup_src_projectname.tar.gz"

cd ${BACKUP_DIR}

tar cvfpz ${BACKUP_DIR}/${TODAY}_${TGZ_FILE} /var/www/웹소스경로/

find ${BACKUP_DIR} -ctime +30 -exec rm -f {} \;

 

 

3. Crontab Daily Batch

#크론탭 배치 매일 2시, 2시 30분 백업 실행

00 02 * * * /root/backup_db_projectname.sh > /dev/null 2>&1

30 02 * * * /root/backup_src_projectname.sh > /dev/null 2>&1

 

 

 

 

 

Posted by Yohan.Ju
IT/리눅스관련2020. 4. 24. 09:54

 

Bad IDN in from "hostname"

 

vi /etc/Muttrc 파일을 열어서 'set from' 검색 후

#set from= 주석 풀고 아래와 같이 변경

set from= "xxxx@domain.com"

 

 

sendmail: fatal: parameter inet_interfaces: no local interface found for ::1

Error sending message, child exited 75 (Deferred.).

Could not send the message.

 

 

vi /etc/postfix/main.cf 파일을 열어서 'inet_interfaces' 검색 후

 

inet_interfaces = all 주석

또는

inet_interfaces = {서버IP}

로 변경

 

 

static postfix/postdrop[12749]: warning: unable to look up public/pickup: No such file or directory

 

mkfifo /var/spool/postfix/public/pickup

service postfix restart

 

 

기타 메일 발송이 안될경우 postfix 스풀에 문제가있을수있으므로

service postfix restart

서비스 리스타트 후 테스트 했던 스풀에 저장된 메일링 작업들이 한번에 발송되는 경우가 있다.

 

Posted by Yohan.Ju