전체 /var/discourse 폴더를 백업하고 복원하는 방법?
보통의 백업 및 복원 과정에서의 문제로 인해, 전체 /var/discourse 폴더를 백업하여 다른 서버에서 재사용할 수 있는지 궁금했습니다. 다음과 같이 진행했습니다…
프로덕션 서버에서:
rsync_opts="\
--recursive \
--links \
--hard-links \
--safe-links \
--owner \
--group \
--perms \
--times \
--delete \
--sparse \
--compress \
--partial \
--rsh=ssh
"
dir=/var/discourse
rsync $rsync_opts "$dir/" root@xx.xx.xx.xx:"/var/production-backup/$dir"
스테이지 서버에서:
docker를 설치합니다.
rsync --recursive --links --hard-links --safe-links --owner --group --perms --times --delete --sparse --compress --partial /var/production-backup/var/discourse/ /var/discourse
그러나 502 Bad Gateway 오류가 발생합니다.
조사 중입니다.
cd /var/discourse
./launcher start app
root@whonix-app:/var/www/discourse# service postgresql status
12/main (port 5432): down
root@whonix-app:/var/www/discourse# service postgresql start
[....] Starting PostgreSQL 12 database server: main[....] Error: The cluster is owned [FAILoup id 116 which does not exist ... failed!
failed!
다음과 같은 수정을 시도해 보았습니다:
chown -R postgres.postgres /etc/postgresql
chown -R postgres.postgres /shared/postgres_*
chown -R postgres.postgres /var/lib/postgresql
chown -R postgres.postgres /var/log/postgresql
chown -R redis.redis /etc/redis/redis.conf
chown -R redis.redis /shared/redis_data
chown -R redis.redis /var/run/redis
chown -R redis.redis /var/lib/redis
chown -R redis.redis /var/log/redis
chgrp -R ssl-cert /etc/ssl/private
하지만 도움이 되지 않았습니다.
root@whonix-app:/var/www/discourse# service postgresql start
[....] Starting PostgreSQL 12 database server: main[....] Error: /usr/lib/postgresql/12/bin/pg_ctl /usr/lib/postgresql/12/bin/pg_ctl start -D /shared/postgres_data -l /var/log/postgresql/postgresql-12-main.log -s -o -c config_file="/etc/postgresql/12/main/postgresql.conf" exited with status 1: 2020-05-25 10:20:10.501 UTC [603] FATAL: database files are incompatible with server 2020-05-25 10:20:10.501 UTC [603] DETAIL: The data directory was initialized by PostgreSQL version 10, which is not compatible with this version 12.2 (Debian 12.2-2.pgdg100+1). pg_ctl: could not start server Examine the lo[FAILput. ... failed!
failed!
왜 이러한 파일 권한 문제가 발생하는 것일까요?
왜 한 서버에서 다른 서버로 전체 폴더를 단순히 복사하는 것만으로 postgres가 10 버전에서 12 버전으로 업데이트되는 것일까요? 제가 무언가를 잘못하고 있는 것 같습니다.
한 서버의 전체 discourse 앱을 백업하고 다른 서버로 이동하는 방법에 대한 지침을 공유해 주실 수 있을까요?