install postgresql without creating instance (for use with repmgr)

I’m trying to get REPMGR setup, and I’m following the steps at https://repmgr.org/docs/current/quickstart-standby-preparation.html to get the standby setup.

I noticed it warns On the standby, do not create a PostgreSQL instance. However I believe this happens automatically with how I installed Postgres

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |sudo tee  /etc/apt/sources.list.d/pgdg.list sudo apt update sudo apt -y install postgresql-12 postgresql-client-12 

because when I try to clone the primary onto the standby as mentioned in https://repmgr.org/docs/current/quickstart-standby-clone.html
$ repmgr -h node1 -U repmgr -d repmgr -f /etc/repmgr.conf standby clone --dry-run

I get

postgres@empty2:~$   repmgr -h 192.168.1.102 -U repmgr -d repmgr -f /etc/repmgr.conf standby clone --dry-run NOTICE: destination directory "/var/lib/postgresql/12/main" provided ERROR: specified data directory "/var/lib/postgresql/12/main" appears to contain a running PostgreSQL instance HINT: ensure the target data directory does not contain a running PostgreSQL instance 

Now I’m just ASSUMING that this is because the database instance was created when I installed postgres on the standby. and I’m also ASSUMING that I can just delete everything in the data directory on the standby, and everything will work ok…

But (assuming my assumptions are correct….) what is the correct way to install postgres12 without creating an instance and the corresponding data files?

pg_dump does not return schema for repmgr objects

While trying to browse repmgr.monitoring_history, I noticed it has many tens of millions of records. Wanting to get a peak at the indexes that (may or may not) already exist on the table, I try a quickie pg_dump

# pg_dump -U postgres -d repmgr --table=repmgr.monitoring_history --schema-only 

…which frustratingly returns only the boilerplate header/footer info…

-- -- PostgreSQL database dump --  -- Dumped from database version 10.8 -- Dumped by pg_dump version 10.8  SET statement_timeout = 0; SET lock_timeout = 0; SET idle_in_transaction_session_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SELECT pg_catalog.set_config('search_path', '', false); SET check_function_bodies = false; SET xmloption = content; SET client_min_messages = warning; SET row_security = off;  -- -- PostgreSQL database dump complete -- 

…well darnit! Did I typo something? 🤔

# pg_dump -U postgres -d repmgr --table=foo.bar --schema-only pg_dump: no matching tables were found 

…no… I am connected to the host I though I was, right?…

# psql -U postgres -d repmgr -c 'select count(*) from repmgr.monitoring_history;'   count    ----------  43597932 (1 row) 

… so what gives? Why can’t I dump the schema definition for this table?


Possibly also worth noting that pg_dump -s -d repmgr returns only the CREATE EXTENSION… & CREATE SCHEMA… commands and none of the tables. The behaviour is consistent across a few different repmgr installations. Perhaps I’m having the same issue as this guy?