Skip to content

Instantly share code, notes, and snippets.

@npwalker
Last active September 19, 2017 17:00
Show Gist options
  • Save npwalker/193b7ee5b046df207726e53144e0b765 to your computer and use it in GitHub Desktop.
Save npwalker/193b7ee5b046df207726e53144e0b765 to your computer and use it in GitHub Desktop.
Installing pg_repack in Puppet Enterprise
yum install pe-postgresql-devel zlib-devel readline-devel gcc -y
PATH=$PATH:/opt/puppetlabs/server/bin/
cd /tmp
git clone https://github.com/reorg/pg_repack
cd pg_repack
git checkout ver_1.4.1
make
make install
su - pe-postgres -s /bin/bash -c "psql -d pe-puppetdb -c 'CREATE EXTENSION pg_repack'"
su - pe-postgres -s /bin/bash -c "psql -d pe-classifier -c 'CREATE EXTENSION pg_repack'"
su - pe-postgres -s /bin/bash -c "psql -d pe-rbac -c 'CREATE EXTENSION pg_repack'"
su - pe-postgres -s /bin/bash -c "psql -d pe-activity -c 'CREATE EXTENSION pg_repack'"
su - pe-postgres -s /bin/bash -c "psql -d pe-orchestrator -c 'CREATE EXTENSION pg_repack'"
su - pe-postgres -s /bin/bash -c "psql -d pe-postgres -c 'CREATE EXTENSION pg_repack'"
su - pe-postgres -s /bin/bash -c "/opt/puppetlabs/server/apps/postgresql/bin/pg_repack --help"
#--all doesn't work because the postgres database seems to be hard coded
[root@master201642-centos pg_repack]# su - pe-postgres -s /bin/bash -c "/opt/puppetlabs/server/apps/postgresql/bin/pg_repack --all"
ERROR: could not connect to database with "dbname=postgres ": FATAL: database "postgres" does not exist
#use a specific db name instead
[root@master201642-centos pg_repack]# su - pe-postgres -s /bin/bash -c "/opt/puppetlabs/server/apps/postgresql/bin/pg_repack -d pe-puppetdb"
INFO: repacking table "environments"
INFO: repacking table "fact_paths"
INFO: repacking table "facts"
INFO: repacking table "report_statuses"
INFO: repacking table "schema_migrations"
INFO: repacking table "value_types"
INFO: repacking table "factsets"
INFO: repacking table "resource_params"
INFO: repacking table "edges"
INFO: repacking table "catalogs"
INFO: repacking table "reports"
INFO: repacking table "certnames"
INFO: repacking table "catalog_resources"
INFO: repacking table "producers"
INFO: repacking table "fact_values"
INFO: repacking table "resource_params_cache"