此内容没有您所选择的语言版本。
13.8. Migrating the Database
If you have installed Red Hat Satellite 5 but later need to transition your database, use the following sections to guide your migration process.
The requirements to migrate from Embedded to Managed Database are:
- The Red Hat Satellite installation ISO
- A complete installation of Red Hat Satellite server with an Embedded Database (
satellite.example.com) - A new system to host the Managed Database with Red Hat Enterprise Linux 6 installed (
manageddb.example.com)
Procedure 13.2. Migrating to a Managed Database
- Shut down the Red Hat Satellite instance:
rhn-satellite stop
[root@satellite ~]# rhn-satellite stopCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Remove the
rhn-upgradeif it exists on your server:yum remove rhn-upgrade
[root@satellite ~]# yum remove rhn-upgradeCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Use
db-controlto create a database backupmkdir ~/dbbackup db-control backup ~/dbbackup
[root@satellite ~]# mkdir ~/dbbackup [root@satellite ~]# db-control backup ~/dbbackupCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Copy the database backup from the Satellite server to the Managed Database server.
scp -r ~/dbbackup root@manageddb.example.com:~/.
[root@satellite ~]# scp -r ~/dbbackup root@manageddb.example.com:~/.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Install the Managed Database using the Red Hat Satellite installation ISO. For full instructions, see Section 4.2.6, “Installing the Managed Database”.
- After you have installed the Managed External Database, shut it down and back up the database configuration and access control files.
db-control stop cp /opt/rh/postgresql92/root/var/lib/pgsql/data/postgresql.conf ~/dbbackup cp /opt/rh/postgresql92/root/var/lib/pgsql/data/pg_hba.conf ~/dbbackup
[root@manageddb ~]# db-control stop [root@manageddb ~]# cp /opt/rh/postgresql92/root/var/lib/pgsql/data/postgresql.conf ~/dbbackup [root@manageddb ~]# cp /opt/rh/postgresql92/root/var/lib/pgsql/data/pg_hba.conf ~/dbbackupCopy to Clipboard Copied! Toggle word wrap Toggle overflow You need to backup these files because the migration process will erase them. - Use
db-controlto restore the database backup to the Managed Database server.db-control restore ~/dbbackup
[root@manageddb ~]# db-control restore ~/dbbackupCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Restore the database configuration and access control files from backup to the Managed Database.
cp ~/dbbackup/postgresql.conf /opt/rh/postgresql92/root/var/lib/pgsql/data/postgresql.conf cp ~/dbbackup/pg_hba.conf /opt/rh/postgresql92/root/var/lib/pgsql/data/pg_hba.conf
[root@manageddb ~]# cp ~/dbbackup/postgresql.conf /opt/rh/postgresql92/root/var/lib/pgsql/data/postgresql.conf [root@manageddb ~]# cp ~/dbbackup/pg_hba.conf /opt/rh/postgresql92/root/var/lib/pgsql/data/pg_hba.confCopy to Clipboard Copied! Toggle word wrap Toggle overflow - On the Satellite server, edit the
/etc/rhn/rhn.conffile and changedb_hostto the domain name of the Managed Database and set thedb_portto 5432. For example:db_host = manageddb.example.com db_port = 5432
db_host = manageddb.example.com db_port = 5432Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Remove
postgresql92-postgresqlfrom the/etc/rhn/service-listfile on the Satellite server.sed -i 's/postgresql92-postgresql //g' /etc/rhn/service-list
[root@satellite ~]# sed -i 's/postgresql92-postgresql //g' /etc/rhn/service-listCopy to Clipboard Copied! Toggle word wrap Toggle overflow - On the Managed Database, edit the
/etc/rhn/rhn.conffile and changedb_name,db_user,db_passwordto reflect the same values in/etc/rhn/rhn.confon the Satellite server. For example:db_name = mydb db_user = mydbuser db_password = mydbpassword
db_name = mydb db_user = mydbuser db_password = mydbpasswordCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Start the Managed Database instance using
db-control.db-control start
[root@manageddb ~]# db-control startCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Remove the
postgresql92-serverandspacewalk-dobbypackages from the Satellite server.yum remove postgresql92-server spacewalk-dobby
[root@satellite ~]# yum remove postgresql92-server spacewalk-dobbyCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Restart Red Hat Satellite.
rhn-satellite start
[root@satellite ~]# rhn-satellite startCopy to Clipboard Copied! Toggle word wrap Toggle overflow
The database is now migrated from an Embedded Database to a Managed Database.