Advanced Spock Techniques
Adding a Subscriber with pg_basebackup

Creating subscriber nodes with base backups

In addition to the SQL-level node and subscription creation, Spock also supports creating a subscriber node by cloning the provider with pg_basebackup and starting it up as a Spock subscriber. Use the spock_create_subscriber tool (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=DIRECTORYdata directory to be used for new node. This can be either empty/non-existing directory, or directory populated using the pg_basebackup -X stream command.
--databasesoptional list of databases to replicate
-n, --subscriber-name=NAMEname of the newly created subscriber
--subscriber-dsn=CONNSTRconnection string to the newly created subscriber
--provider-dsn=CONNSTRconnection string to the provider
--replication-sets=SETScomma separated list of replication set names
--apply-delay=DELAYapply 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: -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 data sync options, this clone ignores replication sets and copies all tables on all databases. However, it's often much faster, especially over high-bandwidth links.