문서의 이전 판입니다!
RHEV 3.6 Backup / Restore
백업 절차
[root@host]# engine-backup --scope=all --mode=backup --file=BACKUP_FILE --log=LOG_FILE
복구 절차
[root@host]# service ovirt-engine stop [root@host]# engine-cleanup [root@host]# su - postgres -c psql alter role engine encrypted password 'PASSWORD'; [root@host]# engine-backup --mode=restore --scope=all --file=BACKUP_FILE --log=LOG_FILE --change-db-credentials --db-host=localhost --db-name=engine --db-user=engine --db-password --restore-permissions [root@host]# engine-setup
script
본 스크립트 파일은 위의 절차를 예제로 만들어본 것 뿐으로서 정확한 조건하에서만 정상적으로 동작합니다.
따라서 본 스크립트는 참고용으로만 사용할것을 권장드리며 위의 절차대로 한단계씩 테스트 해보시기 바랍니다.
#!/bin/bash # Usage : restore.sh DB_PASS RESTORE_FILE # if [ $# -ne 2 ] then echo "Usage : restore.sh <DB_PASS> <RESTORE_FILE>"; exit 1; fi PASSWORD=$1 RESTORE_FILE=$2 ####### check daemon echo "check ovirt-engine daemon..." service ovirt-engine status if [ $? -ne 3 ] then echo "Service ovirt-engine is not stopped."; echo "MUST Service ovirt-engine daemon stop."; echo "service ovirt-engine stop"; exit 1; fi engine-cleanup << EOF yes ok ok EOF if [ $? -ne 0 ] then echo "engine-cleanup is not completed"; echo "Exit"; exit 1; fi su - postgres -c psql << EOF alter role engine encrypted password '$PASSWORD'; \q EOF if [ $? -ne 0 ] then echo "db password is not set"; echo "Exit"; exit 1; fi engine-backup --mode=restore --scope=all --file=$RESTORE_FILE --log=restore.log --change-db-credentials --db-host=localhost --db-name=engine --db-user=engine --db-password=$PASSWORD --restore-permissions engine-setup << EOF yes no ok EOF echo "Restore Done"
참고사항
가끔 engine-cleanup이나 engine-setup이 제대로 안되는경우가 있는데 이런경우 database가 꼬인경우일 수도 있다.
psql로 들어가 database list를 살펴보기 바란다.
[root@host2 ~]# su - postgres -c psql
psql (8.4.20)
Type "help" for help.
postgres=# \l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
-----------------------+-----------------------+----------+-------------+-------------+-----------------------
engine_20160416011028 | engine_20160416011028 | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
engine_20160416011808 | engine_20160416011808 | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
: postgres=CTc/postgres
(5 rows)
postgres=# drop database engine_20160416011028
postgres-# ;
DROP DATABASE
postgres=# drop database engine_20160416011808;
DROP DATABASE
postgres=# \l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
: postgres=CTc/postgres
(3 rows)
postgres=# \q