Bug 1179598

Summary: minor documentation issue in 5.7 Migration
Product: Red Hat Satellite 5 Reporter: Martin Korbel <mkorbel>
Component: Docs Installation GuideAssignee: Dan Macpherson <dmacpher>
Status: CLOSED CURRENTRELEASE QA Contact: Dan Macpherson <dmacpher>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 570CC: tlestach
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-09-16 02:00:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1018166    

Description Martin Korbel 2015-01-07 08:05:17 UTC
Description of problem:
a small bug:
On the page 12.7. Migrating the Database (https://documentation-devel.engineering.redhat.com/site/documentation/en-US/Red_Hat_Satellite/5.7/html/Installation_Guide/sect-Migrating_the_Database.html#sect-Migrating_from_an_Embedded_Database_to_a_Managed_Database), there is missing one letter "L" in the word "satellite"

Actual results:
[root@satellite ~]# rhn-satelite stop

Expected results:
[root@satellite ~]# rhn-satellite stop

Comment 1 Martin Korbel 2015-01-07 08:06:41 UTC
Sorry the page is "12.7.1. Migrating from an Embedded Database to a Managed Database"

Comment 2 Martin Korbel 2015-01-08 10:45:19 UTC
I have a next, on the page "Migrating from a Managed Database to an Embedded Database" (https://documentation-devel.engineering.redhat.com/site/documentation/en-US/Red_Hat_Satellite/5.7/html/Installation_Guide/sect-Migrating_from_a_Managed_Database_to_an_Embedded_Database.html) paragraph No.9

<DOC paragraph No.9>
Remove any values created by spacewalk-setup-postgresql from the /var/lib/pgsql/data/pg_hba.conf and /var/lib/pgsql/data/postgresql.conf files. These should appear at the very end of these files.
</DOC>

There is a bad path to configuration of postgresql. Sat5.7 has got postgresql from the SCL and config files are placed in the /opt/rh/postgresql92/root/var/lib/pgsql/data/. 

I guess, the sentence is a little ambiguous and confusing, because how the user knows, what the spacewalk-setup-postgresql  created in the file "pg_hba.conf". In the file postgresql.conf there is placed a comment, but in the file pg_hba.conf isn't. All lines with the word "spacesatschema" cannot be deleted. 


> tail /opt/rh/postgresql92/root/var/lib/pgsql/data/pg_hba.conf
local spacesatschema spacesatuser md5
host  spacesatschema spacesatuser 127.0.0.1/8 md5
host  spacesatschema spacesatuser ::1/128 md5
local spacesatschema postgres ident map=usermap
local postgres postgres ident map=usermap

host spacesatschema spacesatuser 10.0.0.0/8 md5



> tail /opt/rh/postgresql92/root/var/lib/pgsql/data/postgresql.conf
effective_cache_size = 1152MB
log_line_prefix = '%m '
maintenance_work_mem = 96MB
max_connections = 600
shared_buffers = 384MB
wal_buffers = 4MB
work_mem = 2560kB
bytea_output = 'escape'
### spacewalk-setup-postgresql modified values for a standalone PostgreSQL database
listen_addresses='*'

Comment 3 Martin Korbel 2015-01-08 10:59:42 UTC
The same page "Migrating from a Managed Database to an Embedded Database".

<DOC paragraph No.8>
Add the postgresql service to the /etc/rhn/service-list file to ensure that it is started and stopped in parallel with Red Hat Satellite.

[root@satellite ~]# echo "SERVICES=\"postgresql \$SERVICES\"" >> /etc/rhn/service-list
</DOC>

In the Sat5.7, the service is called "postgresql92-postgresql".
The command should be something as this:
[root@satellite ~]# echo "SERVICES=\"postgresql92-postgresql \$SERVICES\"" >> /etc/rhn/service-list

Comment 4 Martin Korbel 2015-01-08 11:08:58 UTC
The same page "Migrating from a Managed Database to an Embedded Database".

<DOC paragraph No.7>
Edit the /etc/rhn/rhn.conf file to remove the db_port and db_hostname values.

[root@satellite ~]# sed -i 's/db_hostname\s*=.*/db_hostname = /' /etc/rhn/rhn.conf
[root@satellite ~]# sed -i 's/db_port\s*=.*/db_port = /' /etc/rhn/rhn.conf
</DOC>

In rhn.conf, there is not variable "db_hostname" and I guess there never was.

> grep -c db_hostname /etc/rhn/rhn.conf
0

Variable for hostname of database is called "db_host". The command should be something as this:

Edit the /etc/rhn/rhn.conf file to remove the db_port and db_host values.

[root@satellite ~]# sed -i 's/db_host\s*=.*/db_host = /' /etc/rhn/rhn.conf
[root@satellite ~]# sed -i 's/db_port\s*=.*/db_port = /' /etc/rhn/rhn.conf

Comment 5 Martin Korbel 2015-01-08 13:16:58 UTC
Again the page 12.7. Migrating the Database (https://documentation-devel.engineering.redhat.com/site/documentation/en-US/Red_Hat_Satellite/5.7/html/Installation_Guide/sect-Migrating_the_Database.html#sect-Migrating_from_an_Embedded_Database_to_a_Managed_Database)

---------------------------------------------------------------------

The problem with path. The same problem as the comment 2.
<DOC paragraph No.4>
 After you have installed the Managed External Database, shut it down and back up the database configuration and access control files.

[root@manageddb ~]# db-control stop
[root@manageddb ~]# cp /var/lib/pgsql/data/postgresql.conf ~/dbbackup
[root@manageddb ~]# cp /var/lib/pgsql/data/pg_hba.conf ~/dbbackup

You need to backup these files because the migration process will erase them. 
</DOC>

<DOC paragraph No.6>
 Restore the database configuration and access control files from backup to the Managed Database.

[root@manageddb ~]# cp ~/dbbackup/postgresql.conf /var/lib/pgsql/data/postgresql.conf
[root@manageddb ~]# cp ~/dbbackup/pg_hba.conf /var/lib/pgsql/data/pg_hba.conf
</DOC>

---------------------------------------------------------------------

The same problem as the comment 3.
<DOC No.8>
 Remove postgresql from the /etc/rhn/service-list file on the Satellite server.

[root@satellite ~]# sed -i 's/postgresql//g' /etc/rhn/service-list
</DOC>

---------------------------------------------------------------------

The same problem as the comment 4. + we have to set a variable "db_port".
<DOC paragraph No.6>
On the Satellite server, edit the /etc/rhn/rhn.conf file and change db_hostname to the domain name of the Managed Database. For example: 
db_hostname = manageddb.example.com
</DOC>

db_host = manageddb.example.com
db_port = 5432

---------------------------------------------------------------------

Very sorry, that I split this bug into small pieces. My mind process was little chaotic. :)

Comment 6 Dan Macpherson 2015-01-12 15:02:34 UTC
Okay, I've made some last minutes fixes before publishing live:

comment #1 - Fixed Typo
comment #2 - I've removed the line due to ambiguity
comment #3 - Fixed the service name
comment #4 - Changed the db_hostname to db_host
comment #5 - Fixed the paths, fixed the service name, changed to db_host, and added db_port

Content rebuilt here: https://documentation-devel.engineering.redhat.com/site/documentation/en-US/Red_Hat_Satellite/5.7/html/Installation_Guide/sect-Migrating_the_Database.html

Comment 7 Dan Macpherson 2015-09-16 02:00:57 UTC
I've greped the 5.7 docs and all the database locations should be fixed now.