如何恢复两个容器?

小问题:当您有多个容器(数据和 web_only)时,如何执行恢复?我首先尝试了数据容器内的此操作方法:

root@docker2:/var/discourse# ./launcher enter data
x86_64 arch detected.
root@docker2-data:/# discourse enable_restore
bash: discourse: command not found

好的,discourse 应用程序在 web 容器中。但是这里的恢复会引发异常并以错误结束:

Restore are now permitted. Disable them with `disable_restore`
root@forum:/var/www/discourse# discourse restore netzwissen-forum-2023-10-07-125819-v20230913194832.tar.gz
Plugin name is 'discourse-topic-voting', but plugin directory is named 'discourse-voting'
Starting restore: netzwissen-forum-2023-10-07-125819-v20230913194832.tar.gz
[STARTED]
'system' has started the restore!
Marking restore as running...
Making sure /var/www/discourse/tmp/restores/default/2023-10-07-132317 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 stat '/var/www/discourse/public/backups/default/netzwissen-forum-2023-10-07-125819-v20230913194832.tar.gz': No such file or directory
/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/local_backup_store.rb:47:in `download_file'
/var/www/discourse/lib/backup_restore/backup_file_handler.rb:62:in `copy_archive_to_tmp_directory'
/var/www/discourse/lib/backup_restore/backup_file_handler.rb:22: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.2.2/lib/thor/command.rb:27:in `run'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/base.rb:485: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/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-10-07-132317' directory...
Marking restore as finished...
Notifying 'system' of the end of the restore...
Finished!
[FAILED]
Restore done.

在具有独立数据和 Web 容器的部署上运行恢复的技巧是什么?

谢谢,Thommie

您是否已将备份上传到 /var/discourse/shared/web-only/default?

您可以运行

discourse restore

来获取可用备份的列表。

您也可以在 web-only 模式下运行备份,看看它将文件放在哪里,以便您知道将自己的文件放在正确的位置。

编辑:我编辑了 OP 并添加了:

这有帮助吗?

嗯,
还是不行。

我在这里有备份文件:

thommie@docker2:/var/discourse/shared/web-only$ ls
backups  log  netzwissen-forum-2023-10-09-201019-v20230913194832.tar.gz

然后

root@docker2:/var/discourse# ./launcher enter web_only

x86_64 arch detected.
root@forum:/var/www/discourse#

root@forum:/var/www/discourse# discourse restore
You must provide a filename to restore. Did you mean one of the following?

  discourse restore forum-netzwissen-eu-2023-10-08-033221-v20230926165821.tar.gz

所以,恢复只显示了新论坛实例(备份的目标)的 web_only 容器内部的备份文件。但没有显示源实例在主机系统/var/discourse/shared/web-only/ 上的备份文件。

所以,“discourse restore”不使用主机上的映射卷,只使用容器内部的卷。

??

它需要在 /var/discourse/shared/web-only/backups/default 中。

在容器内执行

discourse backup

查看它将备份放在哪里,然后将您的备份放在相同的位置。

@pfaffman你说得对,我在错误的文件夹里,恢复已成功完成
谢谢你的帮助!

1 个赞

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.