Skip to content

Instantly share code, notes, and snippets.

service httpd restart
service pulp_workers restart
service pulp_celerybeat restart
service pulp_resource_manager restart
service goferd restart
mkdir -p /etc/foreman-installer/applied_hooks/pre
touch /etc/foreman-installer/applied_hooks/pre/fix_katello_settings_file
touch /etc/foreman-installer/applied_hooks/pre/fix_pulp_httpd_conf
touch /etc/foreman-installer/applied_hooks/pre/migrate_candlepin
touch /etc/foreman-installer/applied_hooks/pre/migrate_pulp
touch /etc/foreman-installer/applied_hooks/pre/start_databases
touch /etc/foreman-installer/applied_hooks/pre/start_httpd
touch /etc/foreman-installer/applied_hooks/pre/start_pulp
touch /etc/foreman-installer/applied_hooks/pre/start_qpidd
touch /etc/foreman-installer/applied_hooks/pre/start_tomcat
cd /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-*/
git init; git add -A .; git commit -m original
curl https://patch-diff.githubusercontent.com/raw/theforeman/foreman-tasks/pull/205.patch | patch -p1
git add -A .; git commit -m 'fix for bz 1381352'
foreman-rake db:migrate
# you should see indexes getting added to the instance
katello-service restart
# foreman
1) Edit /var/lib/pgsql/data/postgresql.conf
2) Change log_min_duration_statement to 500:
log_min_duration_statement = 500 # -1 is disabled, 0 logs all statements
# and their durations, > 0 logs only
# statements running at least this number
# of milliseconds
This will log any query that runs longer than .5 seconds
# sudo -u postgres psql -d foreman
psql (9.2.15)
Type "help" for help.
foreman=# create index foreman_tasks_tasks_state_temp_idx on foreman_tasks_tasks ((state <> 'stopped'));
CREATE INDEX
foreman=# analyze;
ANALYZE
foreman=#
# EG : ALTER USER Postgres WITH PASSWORD '<newpassword>';
CP_PASS=`grep jpa.config.hibernate.connection.password /etc/candlepin/candlepin.conf | awk -F= '{print $2}'`
F_PASS=`grep password /etc/foreman/database.yml | awk -F: '{print $2}' | sed 's/"//g'`
echo "ALTER USER candlepin WITH PASSWORD '$CP_PASS';" | sudo -u postgres psql
echo "ALTER USER foreman WITH PASSWORD '$F_PASS';" | sudo -u postgres psql
:loggers:
:app:
:enabled: true
:level: debug
# :ldap:
# :enabled: false
# :permissions:
# :enabled: false
:sql:
:enabled: true
SELECT table_name, pg_size_pretty(total_bytes) AS total
, pg_size_pretty(index_bytes) AS INDEX
, pg_size_pretty(toast_bytes) AS toast
, pg_size_pretty(table_bytes) AS TABLE
FROM (
SELECT *, total_bytes-index_bytes-COALESCE(toast_bytes,0) AS table_bytes FROM (
SELECT c.oid,nspname AS table_schema, relname AS TABLE_NAME
, c.reltuples AS row_estimate
, pg_total_relation_size(c.oid) AS total_bytes
, pg_indexes_size(c.oid) AS index_bytes
User.current = User.first
system = Katello::System.find_by_uuid("c4317235-dab2-4972-8112-a1a5da349bc7")
Katello::Resources::Candlepin::Consumer.destroy(system.uuid)
Katello.pulp_server.extensions.consumer.delete(system.uuid)
system.destroy!
###
# copy this gist to /usr/lib/python2.7/site-packages/pulp_rpm/882.patch
# patch -p3 < 882.patch
# sudo -u apache pulp-manage-db
# satellite-installer --upgrade
From 0b7636b8d905840bac715ccb34050a782b369fe8 Mon Sep 17 00:00:00 2001
From: Jeff Ortel <[email protected]>
Date: Thu, 26 May 2016 15:40:33 -0500