Bug 1285598

Summary: [Docs] [SHE] Document a procedure for migrating the engine and other databases to a separate host
Product: Red Hat Enterprise Virtualization Manager Reporter: Andrew Dahms <adahms>
Component: DocumentationAssignee: Andrew Burden <aburden>
Status: CLOSED CURRENTRELEASE QA Contact: Lucy Bopf <lbopf>
Severity: medium Docs Contact:
Priority: high    
Version: 3.5.5CC: ecohen, gklein, hkim, lsurette, rbalakri, yeylon, ylavi
Target Milestone: ovirt-3.5.7   
Target Release: 3.5.7   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: docs
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-23 00:28:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Docs RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1285145    
Bug Blocks:    

Description Andrew Dahms 2015-11-26 02:04:50 UTC
A procedure must be added to the Installation Guide that outlines how to migrate the engine database, and optionally the reports and DWH databases to a machine other than the Manager in a self-hosted engine environment.

Comment 1 Andrew Burden 2015-11-26 09:19:38 UTC
Workflow as tested on 3.5 standard install:
On Manager:
# service ovirt-engine stop
# su - postgres -c 'pg_dump -F c engine -f /tmp/engine.dump'
# scp /tmp/engine.dump root.com:/tmp/engine.dump (target directory needs to allow write access for postgres user)

On DB Server:
# yum install postgresql-server
# service postgresql initdb
# service postgresql start
# chkconfig postgresql on
# su postgres
$ psql
postgres=# create role engine with login encrypted password '[engine password]';
* engine password retrieved from '/etc/ovirt-engine/engine.conf.d/10-setup-database.conf' file on Manager
postgres=# create database engine owner engine template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';
postgres=# \q
$ exit
* In /var/lib/pgsql/data/postgresql.conf 
listen_addresses='*'
* In /var/lib/pgsql/data/pg_hba.conf:
host    engine    engine    [Manager IP]/32  md5
host    engine    engine    ::0/0      md5
# iptables -I INPUT 5 -p tcp --dport 5432 -j ACCEPT
# service iptables save
# service postgresql restart
# su - postgres -c 'pg_restore -d engine /tmp/engine.dump'

On Manager again:
* In /etc/ovirt-engine/engine.conf.d/10-setup-database.conf:
-ENGINE_DB_HOST="localhost"
+ENGINE_DB_HOST="[DB Server IP]"
# service ovirt-engine start

Note: It took about 90 seconds for the Web admin portal to come online. 

Building hosted-engine environment overnight to test; I don't foresee the workflow being any different but for restricting engine vm migration during procedure.

Comment 3 Andrew Burden 2015-11-30 06:56:54 UTC
Testing complete with success on 3.5 hosted engine; including dwhd db migration. As expected, the procedure is the same as above (with additional db considerations for dwhd) but for the need to disable the HA agent on host.
This content is being developed to be included in 3.5 publication.

Comment 7 Lucy Bopf 2015-12-01 04:39:59 UTC
Updated Target Milestone. Moving back to ON_QA.

Comment 13 Andrew Burden 2015-12-02 08:55:59 UTC
Hi Takahashi-san,

The engine db migration is now published and can be found here:
http://documentation-devel.engineering.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Virtualization/3.5/html/Installation_Guide/Migrating_the_Self-Hosted_Engine_Database_to_a_Remote_Server_Database.html

I'm still working on verifying the procedure for the dwh and reports dbs. I will update this bug with the correct procedure upon verification, and this will be included in documentation.

Thank you,
Andrew

Comment 14 Andrew Burden 2015-12-03 12:35:38 UTC
Hello Takahashi-san,

I've verified the reports db migration procedure. It is not yet in publishable state but the workflow is as follows:
On Manager:
# service ovirt-engine-reportsd stop
# su - postgres -c 'pg_dump -F c ovirt-engine-reports -f /tmp/ovirt-engine-reports.dump'
# scp /tmp/ovirt-engine-reports.dump root.com:/tmp/ovirt-engine-reports.dump (target directory needs to allow write access for postgres user)

On DB Server:
# yum install postgresql-server
# service postgresql initdb
# service postgresql start
# chkconfig postgresql on
# su postgres
$ psql
postgres=# create role ovirt-engine-reports with login encrypted password '[ovirt-engine-reports password]';
* ovirt-engine-reports password retrieved from '/var/lib/ovirt-engine-reports/build-conf/master.properties' file on Manager
postgres=# create database ovirt-engine-reports owner ovirt-engine-reports template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';
postgres=# \q
$ exit
* In /var/lib/pgsql/data/postgresql.conf 
listen_addresses='*'
* In /var/lib/pgsql/data/pg_hba.conf:
host    ovirt-engine-reports    ovirt-engine-reports    [Manager IP]/32  md5
# iptables -I INPUT 5 -p tcp --dport 5432 -j ACCEPT
# service iptables save
# service postgresql restart
# su - postgres -c 'pg_restore -d ovirt-engine-reports /tmp/ovirt-engine-reports.dump'

On Manager again:
* In /var/lib/ovirt-engine-reports/build-conf/master.properties:
-dbHost=localhost
+dbHost=[DB Server IP]
# engine-setup

There continues to be an issue with migrating the dwh db. We are collaborating with engineering to arrive at the solution.