Creating an Empty Subscriber Node with pg_basebackup

Creating a Subscriber Node with pg_basebackup

Spock supports creating a subscriber node by cloning the provider with pg_basebackup (opens in a new tab) and starting it as a Spock subscriber. Use the spock_create_subscriber utility (located in the bin directory of your pgEdge platform installation) to register the node.

Synopsis:

spock_create_subscriber [OPTION]...

Options

Specify the following options as needed.

OptionDescription
-D, --pgdata=DIRECTORYThe data directory to be used for new node. This can be either an empty/non-existing directory, or a directory populated using the pg_basebackup -X stream command.
--databasesAn optional list of databases to replicate.
-n, --subscriber-name=NAMEThe name of the newly created subscriber.
--subscriber-dsn=CONNSTRA connection string to the newly created subscriber.
--provider-dsn=CONNSTRA connection string to the provider.
--replication-sets=SETSA comma separated list of replication set names.
--apply-delay=DELAYThe apply delay in seconds (by default 0).
--drop-slot-if-existsDrop replication slot of conflicting name.
-s, --stopStop the server once the initialization is done.
-vIncrease logging verbosity.
--extra-basebackup-argsAdditional arguments to pass to pg_basebackup. Safe options are: -T, -c, --xlogdir/--waldir

Configuration files overrides

You can use the following options to override the location of the configuration files.

OptionDescription
--hba-confpath to the new pg_hba.conf
--postgresql-confpath to the new postgresql.conf
--recovery-confpath to the template recovery configuration

Unlike spock.sub_create's other data sync options, this method of cloning ignores replication sets and copies all tables on all databases. However, it's often much faster, especially over high-bandwidth links.