도와주셔서 감사합니다!
아직도 완전히 정상적으로 작동하는 기존 프로덕션 서버에서 새로운 백업을 생성했습니다.
새로운 스테이지 서버에서 docker와 discourse를 모두 삭제했습니다. 공식 지침에 따라 docker와 discourse를 다시 설치한 후, 명령줄 복원 지침을 따랐습니다.
백업은 docker-engine 17.05.0~ce-0~debian-stretch로 생성되었고, docker-ce-cli 5:19.03.9~3-0~debian-buster로 복원하려고 했습니다. 이로 인해 더 새로운 postgres 버전이 사용됩니다. (구버전: 10; 신버전: 12)
구버전의 docker/postgres로 백업한 것을 최신 버전의 docker/discourse 설치 환경에서 복원하려는 접근 방식이 적절한 방법일까요?
이번에는 다른 오류가 발생합니다.
ERROR: could not create unique index "index_incoming_referers_on_path_and_incoming_domain_id"
DETAIL: Key (path, incoming_domain_id)=(/wiki/Tor_Browser, 3) is duplicated.
EXCEPTION: psql failed: DETAIL: Key (path, incoming_domain_id)=(/wiki/Tor_Browser, 3) is duplicated.
전체 로그:
root@whonix-app:/var/www/discourse# discourse restore whonix-forum-2020-05-25-065253-v20200506044956.tar.gz
Starting restore: whonix-forum-2020-05-25-065253-v20200506044956.tar.gz
[STARTED]
'system' has started the restore!
Marking restore as running...
Making sure /var/www/discourse/tmp/restores/default/2020-05-25-132224 exists...
Copying archive to tmp directory...
Unzipping archive, this may take a while...
Extracting dump file...
Validating metadata...
Current version: 20200524181959
Restored version: 20200506044956
Enabling readonly mode...
Pausing sidekiq...
Waiting up to 60 seconds for Sidekiq to finish running jobs...
Creating missing functions in the discourse_functions schema...
Restoring dump file... (this may take a while)
[cut]
ALTER TABLE
[cut lots of duplicate ALTER TABLE lines]
ALTER TABLE
CREATE INDEX
[cut lots of duplicate CREATE INDEX lines]
CREATE INDEX
ERROR: could not create unique index "index_incoming_referers_on_path_and_incoming_domain_id"
DETAIL: Key (path, incoming_domain_id)=(/wiki/Tor_Browser, 3) is duplicated.
EXCEPTION: psql failed: DETAIL: Key (path, incoming_domain_id)=(/wiki/Tor_Browser, 3) is duplicated.
/var/www/discourse/lib/backup_restore/database_restorer.rb:95:in `restore_dump'
/var/www/discourse/lib/backup_restore/database_restorer.rb:26:in `restore'
/var/www/discourse/lib/backup_restore/restorer.rb:49:in `run'
script/discourse:143:in `restore'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor/base.rb:485:in `start'
script/discourse:284:in `<top (required)>'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `load'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `kernel_load'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:28:in `run'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:476:in `exec'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler/vendor/thor/lib/thor.rb:399:in `dispatch'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:30:in `dispatch'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler/vendor/thor/lib/thor/base.rb:476:in `start'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:24:in `start'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/exe/bundle:46:in `block in <top (required)>'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/friendly_errors.rb:123:in `with_friendly_errors'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/exe/bundle:34:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Trying to rollback...
Rolling back...
Cleaning stuff up...
Dropping functions from the discourse_functions schema...
Removing tmp '/var/www/discourse/tmp/restores/default/2020-05-25-132224' directory...
Unpausing sidekiq...
Disabling readonly mode...
Marking restore as finished...
Notifying 'system' of the end of the restore...
Finished!
[FAILED]
Restore done.
root@whonix-app:/var/www/discourse#
제 기존 프로덕션 discourse 서버가 여전히 완전히 정상적으로 작동하고 있기 때문에 어떻게 이런 일이 가능한지 궁금합니다. 그리고 두 번째로 시도하는 백업이기도 합니다.
Postgres 10을 사용할까요, 아니면 postgres 12를 사용할까요?
수정:
root@whonix-app:/var/www/discourse# rails c
[1] pry(main)> IncomingReferer.where(path: "/wiki/Tor_Browser")
=> [#<IncomingReferer:0x0000561cba422f48
id: 11361,
path: "/wiki/Tor_Browser",
incoming_domain_id: 3>]
[2] pry(main)>
수정2:
[6] pry(main)> IncomingReferer.where("path LIKE '%/wiki/Tor_Browser%'")
=> [#<IncomingReferer:0x0000561cc08882a8
id: 19,
path: "/wiki/Tor_Browser",
incoming_domain_id: 3>,
#<IncomingReferer:0x0000561cc08b3f48
id: 67,
path: "/wiki/Tor_Browser/Download_Confirmation_Screen",
incoming_domain_id: 3>,
#<IncomingReferer:0x0000561cc08b3e08
id: 331,
path: "/wiki/Tor_Browser/Internal_Updater",
incoming_domain_id: 3>,
#<IncomingReferer:0x0000561cc08b3cf0
id: 489,
path: "/wiki/Tor_Browser",
<page break> --- Press enter to continue ( q<enter> to break ) --- <page break>
incoming_domain_id: 113>,
#<IncomingReferer:0x0000561cc08b3bb0
id: 2957,
path: "/wiki/Tor_Browser/Advanced_Users",
incoming_domain_id: 617>,
#<IncomingReferer:0x0000561cc08b3a70
id: 4052,
path: "/wiki/Tor_Browser",
incoming_domain_id: 617>,
#<IncomingReferer:0x0000561cc08b38e0
id: 4196,
path: "/wiki/Tor_Browser",
incoming_domain_id: 1513>,
#<IncomingReferer:0x0000561cc08b37f0
id: 4220,
<page break> --- Press enter to continue ( q<enter> to break ) --- <page break>
path: "/wiki/Tor_Browser/Advanced_Users",
incoming_domain_id: 1513>,
#<IncomingReferer:0x0000561cc08b3700
id: 4307,
path: "/wiki/Tor_Browser",
incoming_domain_id: 1552>,
#<IncomingReferer:0x0000561cc08b34a8
id: 4346,
path: "/wiki/Tor_Browser/Advanced_Users",
incoming_domain_id: 1552>,
#<IncomingReferer:0x0000561cc08b3318
id: 8713,
path: "/wiki/Tor_Browser/Advanced_Users",
incoming_domain_id: 3>,
#<IncomingReferer:0x0000561cc08b3188
<page break> --- Press enter to continue ( q<enter> to break ) --- <page break>
id: 9746,
path: "/wiki/Tor_Browser_without_Tor",
incoming_domain_id: 3>,
#<IncomingReferer:0x0000561cc08b2f08
id: 10248,
path: "/wiki/Tor_Browser_without_Tor",
incoming_domain_id: 113>,
#<IncomingReferer:0x0000561cc08b2cb0
id: 11361,
path: "/wiki/Tor_Browser",
incoming_domain_id: 3>,
#<IncomingReferer:0x0000561cc08b2bc0
id: 11754,
path: "/wiki/Tor_Browser/Advanced_Users",
incoming_domain_id: 113>,
<page break> --- Press enter to continue ( q<enter> to break ) --- <page break>
#<IncomingReferer:0x0000561cc08b2ad0
id: 12094,
path: "/wiki/Tor_Browser/Advanced_Users",
incoming_domain_id: 4560>,
#<IncomingReferer:0x0000561cc08b28f0
id: 12892,
path: "/wiki/Tor_Browser",
incoming_domain_id: 4559>,
#<IncomingReferer:0x0000561cc08b25f8
id: 13038,
path: "/wiki/Tor_Browser",
incoming_domain_id: 4560>]
[7] pry(main)>
[8] pry(main)>