Project

General

Profile

Actions

Bug #17834

closed

support running candlepin database on a seperate host

Added by Neil Hanlon over 7 years ago. Updated about 4 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
Installer
Target version:
Difficulty:
medium
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

I migrated my postgres db off of the main server and updated all the necessary configs, however it appears that cpdb does not read from /etc/candlepin/candlepin.conf. Therefore to run this step I had to run

/usr/share/candlepin/cpdb --update --password <pass> -d"//<myhost>:5432/candlepin"

Upgrade Step: migrate_candlepin...

########## ERROR ############
Error running command: liquibase --driver=org.postgresql.Driver --classpath=/usr/share/java/postgresql-jdbc.jar:/var/lib/tomcat/webapps/candlepin/WEB-INF/classes/ --changeLogFile=db/changelog/changelog-update.xml --url=jdbc:postgresql:candlepin --username=candlepin  --password=<redacted> migrate -Dcommunity=False
Status code: 65280
Command output: Liquibase update Failed: liquibase.exception.DatabaseException: org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

Migrating candlepin database
Traceback (most recent call last):
  File "/usr/share/candlepin/cpdb", line 245, in <module>
    dbsetup.update()
  File "/usr/share/candlepin/cpdb", line 69, in update
    self._run_liquibase("db/changelog/changelog-update.xml")
  File "/usr/share/candlepin/cpdb", line 92, in _run_liquibase
    self.community))
  File "/usr/share/candlepin/cpdb", line 38, in run_command
    error_out(command, status, output)
  File "/usr/share/candlepin/cpdb", line 46, in error_out
    raise Exception("Error running command")
Exception: Error running command

Upgrade step migrate_candlepin failed. Check logs for more information.

Actions #1

Updated by Justin Sherrill over 7 years ago

  • Subject changed from migrate_candlepin step fails if postgres is no longer running on the host to support running candlepin database on a seperate host
  • translation missing: en.field_release set to 114
  • Difficulty set to medium
Actions #2

Updated by Pascal Pascher about 7 years ago

I encountered the same issue moving my candlepin db to a separate postgresql server (where the foreman db itself was running already). I somehow managed to get everything working again but it feels very stitched together. Are there any installer options to set the candlepin db host? Also I would like to completely remove postgresql-server from the katello vm as it is no longer needed.

Here is what I did:

- create database user 'candlepin' on postgresql server
- modify pg_hba.conf to allow access for candlepin user
- create a psql dump of current candlepin db on katello vm and import on postgresql server

vim /etc/candlepin/candlepin.conf


--jpa.config.hibernate.connection.url=jdbc:postgresql://localhost:5432/candlepin
--org.quartz.dataSource.myDS.URL=jdbc:postgresql://localhost:5432/candlepin
++jpa.config.hibernate.connection.url=jdbc:postgresql://postgresql01.ipa.mydomain.com:5432/candlepin
++org.quartz.dataSource.myDS.URL=jdbc:postgresql://postgresql01.ipa.mydomain.com:5432/candlepin

To get foreman-installer to work I also had to modify a katello-installer file:

vim /usr/share/katello-installer-base/hooks/pre/30-upgrade.rb


-- Kafo::Helpers.execute("/usr/share/candlepin/cpdb --update --password #{Kafo::Helpers.read_cache_data('candlepin_db_password')}")
++ Kafo::Helpers.execute("/usr/share/candlepin/cpdb --update --password #{Kafo::Helpers.read_cache_data('candlepin_db_password')} -d \"//postgresql01.ipa.mydomain.com:5432/candlepin\"")

vim /usr/share/katello-installer-base/modules/candlepin/templates/_candlepin_database.conf.erb


-- jpa.config.hibernate.connection.url=jdbc:<%= @db_type %>://<%= @db_host %>:<%= @db_port %>/<%= @db_name %>
++ jpa.config.hibernate.connection.url=jdbc:<%= @db_type %>://postgresql01.ipa.mydomain.com:<%= @db_port %>/<%= @db_name %>
-- org.quartz.dataSource.myDS.URL=jdbc:<%= @db_type %>://<%= @db_host %>:<%= @db_port %>/<%= @db_name %>
++ org.quartz.dataSource.myDS.URL=jdbc:<%= @db_type %>://postgresql01.ipa.mydomain.com:<%= @db_port %>/<%= @db_name %>

Now I could upgrade without errors:
foreman-installer --scenario katello --upgrade

Actions #3

Updated by Justin Sherrill about 4 years ago

  • Status changed from New to Resolved
  • Triaged set to Yes

This should work now, its possible to deploy with an external database:

--katello-candlepin-db-* options

see 'foreman-installer --full-help | grep candlepin-db' for more details

Actions

Also available in: Atom PDF