[Spacewalk-list] All attempts to connect to the database failed when installing Spacewalk 2.7 with PostgreSQL backend
Andrei Popenta
andrei.popenta at visma.com
Fri Mar 30 06:15:52 UTC 2018
Hi,
I am sorry it didn't work for you. I had the same problem and the
workaround suggested by Eric Burgueño fixed the installation.
"you need to initialise the database **before** running spacewalk-setup.
BR,
Andrei
On Thu, Mar 29, 2018 at 9:45 PM, Vitaly Y. | ServerBee <
vitaly.yakovenko at serverbee.net> wrote:
> Hi,
>
> Unfortunately with locale all good on my server:
>
> # locale
> LANG=en_US.UTF-8
> LC_CTYPE="en_US.UTF-8"
> LC_NUMERIC="en_US.UTF-8"
> LC_TIME="en_US.UTF-8"
> LC_COLLATE="en_US.UTF-8"
> LC_MONETARY="en_US.UTF-8"
> LC_MESSAGES="en_US.UTF-8"
> LC_PAPER="en_US.UTF-8"
> LC_NAME="en_US.UTF-8"
> LC_ADDRESS="en_US.UTF-8"
> LC_TELEPHONE="en_US.UTF-8"
> LC_MEASUREMENT="en_US.UTF-8"
> LC_IDENTIFICATION="en_US.UTF-8"
> LC_ALL=
>
>
> postgres=# \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
> template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
> =c/postgres +
> | | | | |
> postgres=CTc/postgres
> template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
> =c/postgres +
> | | | | |
> postgres=CTc/postgres
> (4 rows)
>
>
> It's another problem but I still not resolved it.
>
> On Tue, Mar 6, 2018 at 1:34 PM, Andrei Popenta <andrei.popenta at visma.com>
> wrote:
>
>> Hi,
>>
>> Take a look here, it might help. https://bugzilla.redhat.com/sh
>> ow_bug.cgi?id=1524221
>> Andrei
>>
>> On Mon, Mar 5, 2018 at 11:10 PM, Vitaly Y. | ServerBee <
>> vitaly.yakovenko at serverbee.net> wrote:
>>
>>> 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_b
>>> ase.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 ?
>>>
>>> _______________________________________________
>>> Spacewalk-list mailing list
>>> Spacewalk-list at redhat.com
>>> https://www.redhat.com/mailman/listinfo/spacewalk-list
>>>
>>
>>
>> _______________________________________________
>> Spacewalk-list mailing list
>> Spacewalk-list at redhat.com
>> https://www.redhat.com/mailman/listinfo/spacewalk-list
>>
>
>
>
> --
> Best regards,
>
> Vitaly Yakovenko
> Co-Founder & CTO at ServerBee
>
> _______________________________________________
> Spacewalk-list mailing list
> Spacewalk-list at redhat.com
> https://www.redhat.com/mailman/listinfo/spacewalk-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20180330/2620ea7d/attachment.htm>
More information about the Spacewalk-list
mailing list