[Spacewalk-list] All attempts to connect to the database failed when installing Spacewalk 2.7 with PostgreSQL backend

Vitaly Y. | ServerBee vitaly.yakovenko at serverbee.net
Mon Mar 5 21:10:58 UTC 2018


Hi,

I try to setup Spacewalk server by following command:
# spacewalk-setup --answer-file=/root/spacewalk-answer-file
--external-postgresql

I use --external-postgresql option because custom PostgreSQL 9.4 version
has been installed on EL7.

# cat /root/spacewalk-answer-file
admin-email = root at localhost
ssl-set-org = O
ssl-set-org-unit = OU
ssl-set-city = L
ssl-set-state = P
ssl-set-country = US
ssl-password = s3cret
ssl-set-email = root at localhost
ssl-config-sslvhost = Y
db-backend=postgresql
db-name=spacewalk
db-user=spacewalk_user
db-password=s3crets3crets3crets3cret
db-host=localhost
db-port=5432
enable-tftp=N

# cat /var/lib/pgsql/9.4/data/pg_hba.conf
# PostgreSQL Client Authentication Configuration File (Ansible)
# TYPE  DATABASE        USER            ADDRESS                 METHOD
local   all             all                                     peer
host    all             all             127.0.0.1/32            md5
host    all             all             ::1/128                 md5


>From shell I can connect to PostgreSQL:

# psql -h localhost -U spacewalk_user -W -d spacewalk
Password for user spacewalk_user:
psql (9.2.23, server 9.4.17)
WARNING: psql version 9.2, server version 9.4.
         Some psql features might not work.
Type "help" for help.

spacewalk=# \l
                                           List of databases
   Name    |     Owner      | Encoding |   Collate   |    Ctype    |
 Access privileges

-----------+----------------+----------+-------------+------
-------+----------------------------------
-
 postgres  | postgres       | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 spacewalk | spacewalk_user | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
spacewalk_user=CTc/spacewalk_user



Populate_db stage finished without any errors:

# tail /var/log/rhn/populate_db.log
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
CREATE FUNCTION
 create_varnull_constriants
----------------------------
                          0
(1 row)



But within next setups I always get an error:

Preparing packages...
rhn-org-httpd-ssl-key-pair-sw-1.0-1.noarch
ERROR: there was a problem trying to initialize the database:

Exception reported from xx.example.com
Time: Mon Mar  5 22:33:50 2018
Exception type <class 'spacewalk.server.rhnSQL.sql_base.SQLConnectError'>

Exception Handler Information
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/spacewalk/satellite_tools/rhn_ssl_dbstore.py",
line 55, in processCommandline
    rhnSQL.initDB()
  File "/usr/lib/python2.7/site-packages/spacewalk/server/rhnSQL/__init__.py",
line 158, in initDB
    raise_with_tb(e, sys.exc_info()[2])
  File "/usr/lib/python2.7/site-packages/spacewalk/server/rhnSQL/__init__.py",
line 145, in initDB
    __init__DB(backend, host, port, username, password, database, sslmode,
sslrootcert)
  File "/usr/lib/python2.7/site-packages/spacewalk/server/rhnSQL/__init__.py",
line 57, in __init__DB
    __DB.connect()
  File "/usr/lib/python2.7/site-packages/spacewalk/server/rhnSQL/driver_postgresql.py",
line 194, in connect
    return self.connect(reconnect=reconnect - 1)
  File "/usr/lib/python2.7/site-packages/spacewalk/server/rhnSQL/driver_postgresql.py",
line 199, in connect
    "All attempts to connect to the database failed"), sys.exc_info()[2])
  File "/usr/lib/python2.7/site-packages/spacewalk/server/rhnSQL/driver_postgresql.py",
line 184, in connect
    self.dbh = psycopg2.connect(" ".join("%s=%s" % (k, re.escape(str(v)))
for k, v in dsndata.items()))
  File "/usr/lib64/python2.7/site-packages/psycopg2/__init__.py", line 164,
in connect
    conn = _connect(dsn, connection_factory=connection_factory, async=async)
SQLConnectError: (None, None, 'spacewalk', 'All attempts to connect to the
database failed')



What I missed ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20180305/f96db905/attachment.htm>


More information about the Spacewalk-list mailing list