CLI에서 백업을 복원할 수 없습니다

안녕하세요,

백업 복구를 시도하고 있는데 계속 이 오류가 발생합니다:

Starting restore: blackiron-2022-12-03-163112-v20221201035918.tar.gz
[STARTED]
'system' has started the restore!
Marking restore as running...
Making sure /var/www/discourse/tmp/restores/default/2023-11-28-040817 exists...
Copying archive to tmp directory...
Unzipping archive, this may take a while...
EXCEPTION: /var/www/discourse/lib/discourse.rb:138:in `exec': Failed to decompress archive.

gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
/var/www/discourse/lib/discourse.rb:172:in `execute_command'
/var/www/discourse/lib/discourse.rb:138:in `exec'
/var/www/discourse/lib/discourse.rb:34:in `execute_command'
/var/www/discourse/lib/backup_restore/backup_file_handler.rb:78:in `decompress_archive'
/var/www/discourse/lib/backup_restore/backup_file_handler.rb:23:in `decompress'
/var/www/discourse/lib/backup_restore/restorer.rb:42:in `run'
script/discourse:149:in `restore'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.3.0/lib/thor/command.rb:28:in `run'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.3.0/lib/thor/invocation.rb:127:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.3.0/lib/thor.rb:527:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.3.0/lib/thor/base.rb:584:in `start'
script/discourse:290:in `<top (required)>'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:58:in `load'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:58:in `kernel_load'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:23:in `run'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli.rb:492:in `exec'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli.rb:34:in `dispatch'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli.rb:28:in `start'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/exe/bundle:45:in `block in <top (required)>'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/exe/bundle:33:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Trying to rollback...
There was no need to rollback
Cleaning stuff up...
Removing tmp '/var/www/discourse/tmp/restores/default/2023-11-28-040817' directory...
Marking restore as finished...
Notifying 'system' of the end of the restore...
Finished!
[FAILED]
Restore done.

왜 그런 메시지가 뜨는지 모르겠습니다. 백업 파일은 가져온 그대로 수정하지 않았는데요. 감사합니다.

웹에서도 동일한 오류가 발생합니다.

이것이 치명적인 오류일 가능성이 높습니다. 백업 파일이 손상되지 않았는지 확인해 보셨나요? 이 방법이 작동할 것 같습니다:

$ gunzip -c  blackiron-2022-12-03-163112-v20221201035918.tar.gz | tar -t > /dev/null

같은 문제입니다. 서버의 RAID 구성이 이미 사라져서 새 백업을 만들 수 없지만, 이 데이터가 필요합니다.

image

백업 파일을 열어 확인해 보았습니다. 유효한 것으로 보입니다.

백업 복원 작업을 수행 중인 것과 동일한 기계인가요? 파일 전송이 완료되지 않았거나 전송 과정에서 손상되었을 수 있습니다.

백업은 내 Windows PC에 있으며, scp를 사용 중입니다:

scp blackiron-2022-12-03-163112-v20221201035918.tar.gz root@#.#.#.#:/var/discourse/shared/standalone/backups/default

두 파일의 체크섬이 일치합니까? (체크섬 생성 방법은 여기에서 확인하세요.)

그렇게 보이네요. WinRAR으로 더 조사해 보겠지만, 혹시 제안이 있으시면 감사하겠습니다. 거기서도 같은 경고가 뜨지만, VSCode에서는 잘 보입니다.

도움이 된다면, pigz는 다음을 표시합니다:

/blackiron-2022-12-03-163112-v20221201035918.tar.gz to <stdout> pigz: skipping: /blackiron-2022-12-03-163112-v20221201035918.tar.gz: corrupted -- incomplete deflate data

거기에 대해 경험이 많지 않습니다. 파일의 사본을 가져올 수 있다면, 복사할 새 백업 파일을 만들어야 합니다.

직접 스크립트를 작성해서 수정하려고 했지만 작동하지 않았습니다.

gzip에 대한 전문가도 아니어서 제가 할 수 있는 것도 많지 않습니다. SQL 스크립트와 업로드 파일에 대한 전체 접근 권한이 있는 상태에서 복원하는 방법을 아시는 분이 있다면 알려주시면 감사하겠습니다. 한눈에 보기에는 SQL 스크립트도 문제없고, 업로드 파일도 정상적인 상태입니다.

업데이트: 약 2개월 전의 이전 버전으로 사이트를 성공적으로 복구했습니다. 이제 더 최신 버전으로 전환하는 방법을 찾고 있습니다.

좋은 소식입니다. gzip Recovery Toolkit을 사용하라는 제안을 찾았는데, 유망해 보입니다.

이 가이드를 따라 파일을 이동한 후 다음과 같은 오류가 발생했습니다:

root@ftsweb-app:/var/www/discourse# discourse restore blackiron-2022-12-03-163112-v20221201035918.tar.gz
Starting restore: blackiron-2022-12-03-163112-v20221201035918.tar.gz
[STARTED]
'system' has started the restore!
Marking restore as running...
Making sure /var/www/discourse/tmp/restores/default/2023-11-28-060452 exists...
Copying archive to tmp directory...
EXCEPTION: /var/www/discourse/lib/discourse.rb:138:in `exec': Failed to copy archive to tmp directory.
cp: cannot open '/var/www/discourse/public/backups/default/blackiron-2022-12-03-163112-v20221201035918.tar.gz' for reading: Permission denied

해당 파일이 다른 사용자에게 소유되어 있을 가능성이 큽니다. ls -l /var/www/discourse/public/backups/default/blackiron-2022-12-03-163112-v20221201035918.tar.gz' 명령을 실행하면 문제를 확인할 수 있을 것입니다.

루트가 소유하고 있다고 나와 있습니다. discourse 사용자로 변경해야 하나요?

수정: 도구가 더 많은 피해를 입힌 것 같습니다.