[katello-devel] Restart of postgresql does not mean PostgreSQL is accessible

Ohad Levy ohadlevy at redhat.com
Sun Oct 2 07:11:13 UTC 2011



----- Original Message -----
| On Thu, Sep 29, 2011 at 01:39:34PM +0200, Jan Pazdziora wrote:
| > 
| > err: /Stage[main]/Katello::Config/Exec[katello_seed_db]/returns:
| > change from notrun to 0 failed: /usr/bin/env rake db:seed >>
| > /usr/share/katello/log/db_seed.log 2>&1 && touch
| > /var/lib/katello/initdb_done returned 1 instead of one of [0] at
| > /usr/share/katello/install/puppet/modules/katello/manifests/config.pp:60
| 
| Possibly related to this is another case I just hit -- this time, it
| was preceded by
| 
| notice: /Stage[main]/Postgres::Service/Service[postgresql]/ensure:
| ensure changed 'stopped' to 'running'
| notice: /Stage[main]/Postgres::Service/Service[postgresql]: Triggered
| 'refresh' from 6 events
| err:
| /Stage[main]/Katello::Config/Postgres::Createuser[katello]/Sqlexec[createuser-katello]/Exec[psql
| -h localhost --username=postgres postgres -c "CREATE ROLE katello
| WITH LOGIN PASSWORD 'katello' ;" >>
| /var/lib/puppet/postgresql.sql.log 2>&1]/returns: change from notrun
| to 0 failed: psql -h localhost --username=postgres postgres -c
| "CREATE ROLE katello WITH LOGIN PASSWORD 'katello' ;" >>
| /var/lib/puppet/postgresql.sql.log 2>&1 returned 2 instead of one of
| [0] at
| /usr/share/katello/install/puppet/modules/postgres/manifests/sqlexec.pp:12
| notice:
| /Stage[main]/Katello::Config/Postgres::Createdb[katello]/Sqlexec[katello]/Exec[psql
| -h localhost --username=postgres postgres -c "CREATE DATABASE
| katello WITH OWNER = katello ENCODING = 'UTF8';" >>
| /var/lib/puppet/postgresql.sql.log 2>&1]: Dependency Exec[psql -h
| localhost --username=postgres postgres -c "CREATE ROLE katello WITH
| LOGIN PASSWORD 'katello' ;" >> /var/lib/puppet/postgresql.sql.log
| 2>&1] has failures: true
| 
| and in the /var/lib/puppet/postgresql.sql.log there was
| 
| psql: could not connect to server: Connection refused
| 	Is the server running on host "localhost" and accepting
| 	TCP/IP connections on port 5432?
| could not connect to server: Connection refused
| 	Is the server running on host "localhost" and accepting
| 	TCP/IP connections on port 5432?
| CREATE ROLE
| CREATE DATABASE
| CREATE ROLE
| CREATE DATABASE
| 
| Presumably, in RHEL 6 and Fedoras, the fact that service was
| restarted OK does not mean the server is already listening. Indeed,
| 
| # service postgresql restart && psql -h localhost --username=postgres
| postgres
| 
| failed for me a couple of times (even thou I was not able to
| to make it fail in deterministic fashion).
| 
| What is the best way of amending the puppet manifests to check
| that something is indeed listening on the port 5432?
imho its an error of the postgres startup script, and should be resolved there.

as for hacks, we can tell puppet to try and detect if pg is running based on a process instead of the status of the startup script.

Ohad
| 
| --
| Jan Pazdziora
| Principal Software Engineer, Satellite Engineering, Red Hat
| 
| _______________________________________________
| katello-devel mailing list
| katello-devel at redhat.com
| https://www.redhat.com/mailman/listinfo/katello-devel
| 




More information about the katello-devel mailing list