Bug 1373056

Summary: Configuring PostgreSQL procedure needs updating
Product: [JBoss] JBoss Operations Network Reporter: Scott Mumford <smumford>
Component: DocumentationAssignee: Tyler Kelly <tkelly>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: medium    
Version: JON 3.3.7CC: fbrychta, tkelly
Target Milestone: post-GAKeywords: Documentation, Triaged
Target Release: JON 3.3.8   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Build Name: 23084, Installation Guide-3.3-3.3 Build Date: 22-07-2016 13:45:26 Topic ID: 43526-777571 [Latest]
Last Closed: 2017-06-25 22:41:25 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:
Bug Depends On:    
Bug Blocks: 1458981    

Description Scott Mumford 2016-09-05 03:09:32 UTC
Title: Configuring PostgreSQL

Describe the issue:

Command in Step 2 (service postgresql initdb) does not work with systemctl

Output is:

"The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl."

Suggestions for improvement:
Add command options for systemctl

Additional information:
This is similar to changes made in Step 3 to include command for systemctl

Comment 1 Scott Mumford 2016-09-05 03:28:34 UTC
Was able to initialize database with:

pg_ctl initdb -D ~/path/to/location

Comment 2 Scott Mumford 2016-09-05 03:32:52 UTC
Had to initialize db again as 'postgres' user.

Started database server with:

/usr/bin/postgres -D /var/lib/pgsql/pgdb

Comment 3 Scott Mumford 2016-09-05 03:58:09 UTC
Step 4: Cannot set a password for postgres user in psql. System attempts to use normal user home directory.

Log in as postgres user:
su postgres
Password: 

Invoke psql:
bash-4.3$ psql
could not change directory to "/home/smumford": Permission denied
psql (9.4.7)

Doc needs more information and/or clearer instructions regarding different users

Comment 4 Scott Mumford 2016-09-06 02:36:25 UTC
OK, it appears I had an unusable parameter ("max_fsm_pages") in my 'var/lib/pgsql/data/postgresql.conf' file. Commented out and was able to start postgresql service with:

$ sudo systemctl start postgresql.service

Then able to switch to postgres user and invoke psql utility with:

$ sudo -u postgres -i
$ psql

Comment 5 Scott Mumford 2016-09-06 03:05:20 UTC
Unable to successfully start JON 3.3 due to 'Cannot obtain client connection to the RHQ app server!!' error and recurring 'FATAL: Ident authentication failed for user' errors.

"Cannot obtain client connection..." error is discussed in [1] however proposed solution did not help.


1: https://access.redhat.com/solutions/678553

Comment 6 Tyler Kelly 2017-06-05 06:45:31 UTC
2.1.1 step 3 

sudo systemctl enable postgresql-<version>.service
sudo systemctl start postgresql-<version>.service

where <version> = <major>.<minor>

For Example:

systemctl enable postgresql-8.4.service

Source: https://wiki.postgresql.org/wiki/YUM_Installation

Comment 8 Tyler Kelly 2017-06-08 06:33:09 UTC
Revised to improve formatting and ensure procedures worked in a variety of situations:
Sections 2.1 and 2.1.1: 
https://access.qa.redhat.com/documentation/en-us/red_hat_jboss_operations_network/3.3/html-single/installation_guide/#Database-Postgres_Preparation
Merged: 
https://gitlab.cee.redhat.com/red-hat-jboss-operations-network-documentation/doc-jon-docs/merge_requests/4
Note:
this merge request also includes changes for https://bugzilla.redhat.com/show_bug.cgi?id=1458981
Now includes instructions for RHEL 6 and earlier, RHEL 7 and Later and RHEL 7 using Downloaded binaries from postgresql. Third type of install included as current version of postgresql is not supported by JON https://access.redhat.com/articles/112523.

Comment 9 Filip Brychta 2017-06-22 11:11:45 UTC
2 issues:
1) - 2.1.2 Step2 - Initialize the PostgreSQL database.
For installs using downloaded binaries on Red Hat Enterprise Linux 7 (and later): 
sudo service postgresql-<version> initdb

this will not work on RHEL 7, should be:
/usr/pgsql-y.x/bin/postgresqlyx-setup initdb

2) 2.1.2 Step 3 - Start the PostgreSQL service
Update following step to contain 'chkconfig postgresql on' as well.

It could look like this:
On Red Hat Enterprise Linux 6 (and earlier) using repository install:
sudo service postgresql start
chkconfig postgresql on


Changes suggested according to - https://wiki.postgresql.org/wiki/YUM_Installation

Comment 11 Tyler Kelly 2017-06-25 22:41:25 UTC
Published on customer portal on 2017-06-26