Print
카테고리: [ MariaDB ]
조회수: 6560

1. xtrabackup이란?


2. innobackupex 옵션

--apply-log

--copy-back

--incremental

--read-only

--slave-info

--databases

--parallel=[스레드 수]

--incremental-dir=[증분 백업 경로]


3. 전체 데이터베이스 백업 예제

3-1. 전체 데이터베이스 백업

$ innobackupex --default-file=/etc/my.cnf --user=root --password=rootroot
/backup/mysql/full

 

3-2. 증분 데이터베이스 백업

1) 먼저 전체 데이터베이스 백업 수행

$ innobackupex --default-file=/etc/my.cnf --user=root --password=rootroot
/backup/mysql/full
  1. 백업된 디렉토리 확인 (백업 진행 날짜/시간 형식 하위 디렉토리)
  2. 백업 정보 확인
$ cat xtrabackup_checkpoints

from lsn 확인, 0부터 시작하면 전체 백업

2) 다음 증분 데이터베이스 백업 수행 (1차)

$ innobackupex --default-file=/etc/my.cnf --user=root --password=rootroot
/backup/mysql/inc1 --incremental --incremental-basedir=/backup/mysql/full/[하위백업경로]

혹은 --incremental-lsn=[LSN번호]와 같이 LSN을 직접 지정할 수 있다.

  1. 백업된 디렉토리 확인 (백업 진행 날짜/시간 형식 하위 디렉토리)
  2. 백업 정보 확인, from lsn 확인, 지난 전체 데이터베이스 백업 수행 이후인지 확인
$ cat xtrabackup_checkpoints

from lsn 확인, 0부터 시작하면 전체 백업

3) 다음 증분 데이터베이스 백업 수행 (2차)

$ innobackupex --default-file=/etc/my.cnf --user=root --password=rootroot
/backup/mysql/inc2 --incremental --incremental-basedir=/backup/mysql/full/[하위백업경로]

혹은 --incremental-lsn=[LSN번호]와 같이 LSN을 직접 지정할 수 있다.

  1. 백업된 디렉토리 확인 (백업 진행 날짜/시간 형식 하위 디렉토리)
  2. 백업 정보 확인, from lsn 확인, 지난 전체 데이터베이스 백업 수행 이후인지 확인
$ cat xtrabackup_checkpoints

from lsn 확인, 0부터 시작하면 전체 백업

 

3-3. 개별 테이블 백업

$ innobackupex --default-file=/etc/my.cnf --user=root --password=rootroot
--include='^hr.salarytables' /backup/mysql/hr/table
  1. 백업된 디렉토리 확인
  2. 백업된 개별 데이터파일 확인 (*.frm, *.ibd)

 

4. 복구 시나리오

  1. 백업본 로그 적용 및 redo log 생성
  2. MariaDB 종료
  3. 기존 데이터파일 이동
  4. 백업 파일을 데이터파일 경로로 복사
  5. MariaDB 기동 (Read-only)
  6. Binary Log 적용
  7. MariaDB 재기동