이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 9. Migrating Databases


9.1. Migrating the Self-Hosted Engine Database to a Remote Server Database

You can migrate the engine database of a self-hosted engine to a remote database server after the Red Hat Enterprise Virtualization Manager has been initially configured.
This task is split into two procedures. The first procedure, preparing the remote PostgreSQL database, is a necessary prerequisite for the migration itself and presumes that the server has Red Hat Enterprise Linux installed and has been configured with the appropriate subscriptions.
The second procedure, migrating the database, uses PostgreSQL pg_dump and pg_restore commands to handle the database backup and restore. As such, it is necessary to edit the /etc/ovirt-engine/engine.conf.d/10-setup-database.conf file with the updated information. At a minimum, you must update the location of the new database server. If the database name, role name, or password are modified for the new database server, these values must also be updated in the 10-setup-database.conf file. This procedure uses the default engine database settings to minimize modification of this file.

Procedure 9.1. Preparing the Remote PostgreSQL Database for use with the Red Hat Enterprise Virtualization Manager

  1. Log in to the remote database server and install the PostgreSQL server package:
    # yum install postgresql-server
    Copy to Clipboard Toggle word wrap
  2. Initialize the PostgreSQL database, start the postgresql service, and ensure that this service starts on boot:
    # service postgresql initdb
    # service postgresql start
    # chkconfig postgresql on
    Copy to Clipboard Toggle word wrap
  3. Connect to the psql command line interface as the postgres user:
    # su - postgres
    $ psql
    Copy to Clipboard Toggle word wrap
  4. Create a user for the Manager to use when it writes to and reads from the database. The default user name on the Manager is engine:
    postgres=# create role user_name with login encrypted password 'password';
    Copy to Clipboard Toggle word wrap

    Note

    The password for the engine user is located in plain text in /etc/ovirt-engine/engine.conf.d/10-setup-database.conf. Any password can be used when creating the role on the new server, however if a different password is used then this file must be updated with the new password.
  5. Create a database in which to store data about the Red Hat Enterprise Virtualization environment. The default database name on the Manager is engine, and the default user name is engine:
    postgres=# create database database_name owner user_name template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';
    
    Copy to Clipboard Toggle word wrap
  6. Ensure the database can be accessed remotely by enabling md5 client authentication. Edit the /var/lib/pgsql/data/pg_hba.conf file, and add the following line immediately underneath the line starting with local at the bottom of the file, replacing X.X.X.X with the IP address of the Manager:
    host    database_name    user_name    X.X.X.X/32   md5
    Copy to Clipboard Toggle word wrap
  7. Allow TCP/IP connections to the database. Edit the /var/lib/pgsql/data/postgresql.conf file and add the following line:
    listen_addresses='*'
    Copy to Clipboard Toggle word wrap
    This example configures the postgresql service to listen for connections on all interfaces. You can specify an interface by giving its IP address.
  8. Open the default port used for PostgreSQL database connections, and save the updated firewall rules:
    # iptables -I INPUT 5 -p tcp --dport 5432 -j ACCEPT
    # service iptables save
    Copy to Clipboard Toggle word wrap
  9. Restart the postgresql service:
    # service postgresql restart
    Copy to Clipboard Toggle word wrap
Optionally, set up SSL to secure database connections using the instructions at http://www.postgresql.org/docs/8.4/static/ssl-tcp.html#SSL-FILE-USAGE.

Procedure 9.2. Migrating the Database

  1. Log in to one of the hosted-engine hosts and place the environment into global maintenance mode. This disables the High Availability agents and prevents the Manager virtual machine from being migrated occurring during the procedure:
    # hosted-engine --set-maintenance --mode=global
    Copy to Clipboard Toggle word wrap
  2. Log in to the Manager virtual machine and stop the ovirt-engine service so that it does not interfere with the engine backup:
    # service ovirt-engine stop
    Copy to Clipboard Toggle word wrap
  3. Create the engine database backup using the PostgreSQL pg_dump command:
    # su - postgres -c 'pg_dump -F c engine -f /tmp/engine.dump'
    Copy to Clipboard Toggle word wrap
  4. Copy the backup file to the new database server. The target directory must allow write access for the postgres user:
    # scp /tmp/engine.dump root@new.database.server.com:/tmp/engine.dump
    Copy to Clipboard Toggle word wrap
  5. Log in to the new database server and restore the database using the PostgreSQL pg_restore command:
    # su - postgres -c 'pg_restore -d engine /tmp/engine.dump'
    Copy to Clipboard Toggle word wrap
  6. Log in to the Manager virtual machine and update the /etc/ovirt-engine/engine.conf.d/10-setup-database.conf and replace the localhost value of ENGINE_DB_HOST with the IP address of the new database server. If the engine name, role name, or password differ on the new database server, update those values in this file.
  7. Now that the database has been migrated, start the ovirt-engine service:
    # service ovirt-engine start
    Copy to Clipboard Toggle word wrap
  8. Log in to a hosted-engine host and turn off maintenance mode, enabling the High Availability agents:
    # hosted-engine --set-maintenance --mode=none
    Copy to Clipboard Toggle word wrap
맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat