bacula 최근,특정일자 복구방법
첫번째로 최근본으로 복구하는 방법부터
백업서버로 가서 bacula 설치되어있는 디렉토리-etc로 이동
./bconsole
Connecting to Director backup:9101
1000 OK: backup-dir Version: 5.2.3 (16 December 2011)
Enter a period to cancel a command.
*restore
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
First you select one or more JobIds that contain files
to be restored. You will be presented several methods
of specifying the JobIds. Then you will be allowed to
select which files from those JobIds are to be restored.
To select the JobIds, you have the following choices:
1: List last 20 Jobs run
2: List Jobs where a given File is saved
3: Enter list of comma separated JobIds to select
4: Enter SQL list command
5: Select the most recent backup for a client
6: Select backup for a client before a specified time
7: Enter a list of files to restore
8: Enter a list of files to restore before a specified time
9: Find the JobIds of the most recent backup for a client
10: Find the JobIds for a backup for a client before a specified time
11: Enter a list of directories to restore for found JobIds
12: Select full restore to a specified Job date
13: Cancel
Select item: (1-13):
5번 선택
복구할 서버 ip 선택
Select the Client (1-61): 48
Automatically selected FileSet:
+--------+-------+----------+----------+---------------------+---------------------+
| JobId | Level | JobFiles | JobBytes | StartTime | VolumeName |
+--------+-------+----------+----------+---------------------+---------------------+
| 33,929 | F | 3 | 12 | 2016-01-03 14:52:09 | |
+--------+-------+----------+----------+---------------------+---------------------+
You have selected the following JobId: 33929
Building directory tree for JobId(s) 33929 ...
2 files inserted into the tree.
You are now entering file selection mode where you add (mark) and
remove (unmark) files to be restored. No files are initially added, unless
you used the "all" keyword on the command line.
Enter "done" to leave this mode.
cwd is: /
$
간단한 쉘 명령어 지원됨 (ls, cd같은것) ls를 쳐보면 백업된 디렉토리가 보인다. 원하는 복원파일이 있는 디렉토리로 이동
$ cd /home/test
cwd is: /home/test/
$ ls
test1
test2
$
test1을 복구하고싶다
$ mark test1
1 file marked.
$ ls
*test1
test2
디렉토리 안에 있는 모든것을 복구하고 싶다면 mark * 하면됨
복구하고싶은 파일을 mark 하였다면 done 입력
$ done
Bootstrap records written to /opt/webapps/bacula-5.2.3/var/bacula/working/backup-dir.restore.10.bsr
The job will require the following
Volume(s) Storage(s) SD Device(s)
===========================================================================
backup-sd backup-sd-fs
Volumes marked with "*" are online.
1 file selected to be restored.
Run Restore job
JobName: RestoreFiles
Bootstrap: /opt/webapps/bacula-5.2.3/var/bacula/working/backup-dir.restore.10.bsr
Where: /home/restore/
Replace: always
FileSet:
Backup Client:
Restore Client:
Storage: backup-sd
When: 2016-01-04 18:11:34
Catalog: MyCatalog
Priority: 10
Plugin Options: *None*
OK to run? (yes/mod/no):
바로 yes 하면 복구 되지만
where 부분을 보면 /home/restore/로 경로가 되어있다 저부분이 복구파일이 생길 위치이다
나는 원래 파일이 위치했던 부분으로 바로 복구할것이므로
mod 입력
OK to run? (yes/mod/no): mod
Parameters to modify:
1: Level
2: Storage
3: Job
4: FileSet
5: Restore Client
6: When
7: Priority
8: Bootstrap
9: Where
10: File Relocation
11: Replace
12: JobId
13: Plugin Options
Select parameter to modify (1-13):
9번 선택
Select parameter to modify (1-13): 9
Please enter path prefix for restore (/ for none):
/를 입력해주면 내가 백업 지정해두었던 경로
즉 /home/test 에 복구가 된다
/ 입력
Please enter path prefix for restore (/ for none): /
Run Restore job
JobName: RestoreFiles
Bootstrap: /opt/webapps/bacula-5.2.3/var/bacula/working/backup-dir.restore.10.bsr
Where:
Replace: always
FileSet: -fs
Backup Client:
Restore Client:
Storage: backup-sd
When: 2016-01-04 18:11:34
Catalog: MyCatalog
Priority: 10
Plugin Options: *None*
OK to run? (yes/mod/no):
yes 입력하면 복구 완료
종료는 quit
두번째 특정 일자로 복구하는 방법
특정 일자로 복구하는 방법은 일단 jobid를 알아야한다
jobid는 백업이 실행될때마다 생성되는 id값인데
백업이 될때마다 id값이 달라진다
그러므로 특정 일에 백업당시 jobid를 알아야한다
bacula 로그파일에 들어가서 아이피 검색 해보면 일자별 jobid를 볼 수 있다.
나는 백업 완료되면 메일로 백업결과가 오기때문에 메일 참고해서 jobid를 알아냈다
jobid를 알아냈다면
bconsole 실행
restore 입력
*restore
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
First you select one or more JobIds that contain files
to be restored. You will be presented several methods
of specifying the JobIds. Then you will be allowed to
select which files from those JobIds are to be restored.
To select the JobIds, you have the following choices:
1: List last 20 Jobs run
2: List Jobs where a given File is saved
3: Enter list of comma separated JobIds to select
4: Enter SQL list command
5: Select the most recent backup for a client
6: Select backup for a client before a specified time
7: Enter a list of files to restore
8: Enter a list of files to restore before a specified time
9: Find the JobIds of the most recent backup for a client
10: Find the JobIds for a backup for a client before a specified time
11: Enter a list of directories to restore for found JobIds
12: Select full restore to a specified Job date
13: Cancel
Select item: (1-13):
12번 입력
Enter JobId to get the state to restore: 33891
jobid 입력하면 아래와 같은 내용이 나온다
Selecting jobs to build the Full state at 2016-01-02 00:43:46
You have selected the following JobIds: 33853,33891
Building directory tree for JobId(s) 33853,33891 ...
2 files inserted into the tree.
You are now entering file selection mode where you add (mark) and
remove (unmark) files to be restored. No files are initially added, unless
you used the "all" keyword on the command line.
Enter "done" to leave this mode.
cwd is: /
$
그다음 과정은 위에 설명했으므로 생략..
복원할 파일 선택하면 위에선 안나온 Select the Client (1-61): 창이 나온다
복구할 서버 번호 선택을 하면
위에서 봤던 복구할지 물어보는 창이 뜬다.
복구할 위치 선택후 yes 해주면 복구 완료.
종료는 quit
'Linux' 카테고리의 다른 글
mod_cband 이용 아파치 트래픽 제어, 트래픽 모니터링 (0) | 2016.01.06 |
---|---|
도메인별로 MRTG 트래픽 그리기 (0) | 2016.01.06 |
-bash: ./pp_cli: /lib/ld-linux.so.2: bad ELF interpreter: 그런 파일이나 디렉터리가 없습니다 (0) | 2015.12.30 |
아파치 (28)No space left on device (0) | 2015.12.29 |
rsync 암호 없이 사용하기 (0) | 2015.11.10 |