Red Hat Training

A Red Hat training course is available for Red Hat Satellite

15.2.2. Red Hat Satellite 復原程序

過程 15.3. Red Hat Satellite 復原程序

重要

下列程序詳述了完整的 Red Hat Satellite 復原程序。這項程序會刪除一個既有的 Red Hat Satellite instance 中的所有資料。請確認:
  • 您將復原至正確的 instance。Red Hat Satellite instance 必須擁有與原始系統相同的配置、套件版本以及勘誤。
  • 所有指令皆必須以 root 身份,並在包含了進行備份程序時所建立之封存檔案的目錄中執行。
  • 所有 SELinux context 皆正確。執行這項指令:
    restorecon -Rnv /
    
  1. 準備 Red Hat Satellite 主機以進行復原。這項程序會將備份復原在產生了該備份的相同伺服器上。若原始系統無法使用,請以相同的設定(主機名稱、IP 位址等等)來佈建相同的配置,並以相同指令執行 katello-configure,並使用來自於配置備份的檔案:
    # tar --selinux -xzvf config_files.tar.gz -C /tmp
    # katello-configure --answer-file=/tmp/etc/katello/katello-configure.conf
  2. 將目錄更改為備份目錄。
    # export BDIR=/backup
    # chgrp postgres -R $BDIR
    # cd $BDIR
  3. 檢查 Red Hat Satellite PostgreSQL 資料庫的名稱。預設的資料庫名稱為 foremanschemacandlepin。請在 katello-configure 的 man page 或是 /usr/share/katello/install/default-answer-file 中找尋所有的預設值。若 Red Hat Satellite 事例未使用預設的名稱,請檢查 katello-configure.conf,它存放了所有供 katello-configure 指令使用的選項,並搜尋 db_name
    # grep db_name /etc/katello/katello-configure.conf
  4. 復原資料庫之前停用所有服務:
    # katello-service stop
    # service postgresql stop
    
  5. 復原系統檔案。確認檔案在正確的主機上解開。透過在備份目錄中執行下列指令,以復原所有系統檔案:
    # tar --selinux -xzvf config_files.tar.gz -C /
    # tar --selinux -xzvf elastic_data.tar.gz -C /
    # tar --selinux -xvf pulp_data.tar -C /
  6. 若有既有的 Red Hat Satellite PostgreSQL 資料庫存在的話,請將它們停用:
    # service postgresql start
    # runuser - postgres -c "dropdb foremanschema"
    # runuser - postgres -c "dropdb candlepin"

    注意

    當停用資料庫時可能會出現以下錯誤:
    資料庫 xxx 正被其他使用者存取中
    確認所有程序皆已停下。
  7. 透過下列指令復原 Red Hat Satellite PostgreSQL 資料庫:
    # runuser - postgres -c "pg_restore -C -d postgres /backup/katello.dump"
    # runuser - postgres -c "pg_restore -C -d postgres /backup/candlepin.dump"

    注意

    欲取得更多有關於 PostgreSQL 備份上的相關資訊,請參閱 pg_dump 的 man page 或前往〈http://www.postgresql.org/docs/8.4/static/backup.html〉。
  8. 確認 MongoDB 有在執行並刪除舊的資料:
    # service mongod start
    # echo 'db.dropDatabase();' | mongo pulp_database
  9. 在提供 --username--password 的同時,在備份封存檔案的目錄中執行以下指令。
    # mongorestore --host localhost mongo_dump/pulp_database/

    注意

    欲取得更多資訊,請參閱 mongorestore man page 或前往〈http://www.mongodb.org/display/DOCS/Backups〉。
  10. 重新啟動所有的 Red Hat Satellite 程序:
    # service postgresql start
    # katello-service start
    
  11. 檢查日誌檔案查看是否有錯誤,請檢查 audit.log 中是否有拒絕項目,並嘗試 ping Red Hat Satellite instance:
    # hammer -u admin -p admin ping
22921%2C+User+Guide-6.008-10-2014+13%3A34%3A52Red+Hat+Satellite+6Docs+User+Guide回報錯誤