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
「いいね!」 1

同じ問題です。サーバーのRAID構成はとっくに失われているため、新しいバックアップを取得できませんが、このデータが必要です。

image

バックアップの中を確認しました。有効なようです。

これは、バックアップを復元しているのと同じマシンですか? ファイルの転送が完了しなかったか、転送中に破損した可能性があります。

バックアップはWindows PCにあり、scpを使用しています。

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

両方のファイルでチェックサムが一致しますか? (チェックサムの生成方法についてはこちらをご覧ください。)

「いいね!」 1

そうみたいですね。WinRARでさらに調べてみますが、何か提案があればありがたいです。そこでも同じ警告が表示されますが、VSCodeでは問題なく表示されています。

もし参考になれば、pigz は以下のように表示されます。

/blackiron-2022-12-03-163112-v20221201035918.tar.gz から <stdout> pigz: スキップ中: /blackiron-2022-12-03-163112-v20221201035918.tar.gz: 不正 -- 不完全な deflate データ

あまり経験がありません。ファイルのコピーを入手できれば、コピーするための新しいバックアップファイルを作成できるはずです。

それを修正するために自分でスクリプトを書いてみましたが、うまくいきませんでした。

また、gzipの専門家ではないので、私にはあまりできることもありません。もし、SQLスクリプトとアップロードに完全にアクセスして復元する方法を知っている方がいれば、教えてください。SQLスクリプトは一見問題なく、アップロードも問題ありません。

更新:サイトの約2ヶ月前の古いバージョンを正常に復元できました。新しい(より新しい)バージョンをまだオンにしようとしています。

それは良い知らせですね。gzip Recovery Toolkit を使用するという提案を見つけました。有望そうです。

「いいね!」 2

このガイドに従って移動しましたが、次のエラーが発生しました。

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' で問題が表示される可能性が高いです。

「いいね!」 1

rootが所有していると表示されます。discourseユーザーにする必要がありますか?

編集:ツールがさらにダメージを与えたようです。