postgresql_16:7.2.14.2 Options
PostgreSQL 16 > Reference > PostgreSQL Client Applications > pg_receivewal > Options
**-D *directory*, --directory=*directory***
Directory to write the output to.
This parameter is required.
**-E *lsn*, --endpos=*lsn***
Automatically stop replication and exit with normal exit status 0 when receiving reaches the specified LSN.
If there is a record with LSN exactly equal to *lsn*, the record will be processed.
--if-not-exists
Do not error out when --create-slot is specified and a slot with the specified name already exists.
-n, --no-loop
Don't loop on connection errors. Instead, exit right away with an error.
--no-sync
This option causes pg_receivewal to not force WAL data to be flushed to disk. This is faster, but means that a subsequent operating system crash can leave the WAL segments corrupt. Generally, this option is useful for testing but should not be used when doing WAL archiving on a production deployment.
This option is incompatible with --synchronous.
**-s *interval*, --status-interval=*interval***
Specifies the number of seconds between status packets sent back to the server. This allows for easier monitoring of the progress from server. A value of zero disables the periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout disconnect. The default value is 10 seconds.
**-S *slotname*, --slot=*slotname***
Require pg_receivewal to use an existing replication slot (see (see postgresql_16:4.12.2.6)). When this option is used, pg_receivewal will report a flush position to the server, indicating when each segment has been synchronized to disk so that the server can remove that segment if it is not otherwise needed.
When the replication client of pg_receivewal is configured on the server as a synchronous standby, then using a replication slot will report the flush position to the server, but only when a WAL file is closed. Therefore, that configuration will cause transactions on the primary to wait for a long time and effectively not work satisfactorily. The option --synchronous (see below) must be specified in addition to make this work correctly.
--synchronous
Flush the WAL data to disk immediately after it has been received. Also send a status packet back to the server immediately after flushing, regardless of --status-interval.
This option should be specified if the replication client of pg_receivewal is configured on the server as a synchronous standby, to ensure that timely feedback is sent to the server.
-v, --verbose
Enables verbose mode.
**-Z *level*, -Z *method*[:*detail*], --compress=*level*, --compress=*method*[:*detail*]**
Enables compression of write-ahead logs.
The compression method can be set to gzip, lz4 (if PostgreSQL was compiled with --with-lz4) or none for no compression. A compression detail string can optionally be specified. If the detail string is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form keyword or keyword=value. Currently, the only supported keyword is level.
If no compression level is specified, the default compression level will be used. If only a level is specified without mentioning an algorithm, gzip compression will be used if the level is greater than 0, and no compression will be used if the level is 0.
The suffix .gz will automatically be added to all filenames when using gzip, and the suffix .lz4 is added when using lz4.
The following command-line options control the database connection parameters. -d *connstr* --dbname=*connstr* Specifies parameters used to connect to the server, as a connection string (see postgresql_16:5.1.1.1); these will override any conflicting command line options. The option is called --dbname for consistency with other client applications, but because pg_receivewal doesn't connect to any particular database in the cluster, database name in the connection string will be ignored. -h *host* --host=*host* Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted. -p *port* --port=*port* Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default. -U *username* --username=*username* User name to connect as. -w --no-password Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. -W --password Force pg_receivewal to prompt for a password before connecting to a database. This option is never essential, since pg_receivewal will automatically prompt for a password if the server demands password authentication. However, pg_receivewal will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt.
pg_receivewal can perform one of the two following actions in order to control physical replication slots: --create-slot Create a new physical replication slot with the name specified in --slot, then exit. --drop-slot Drop the replication slot with the name specified in --slot, then exit.
Other options are also available: -V --version Print the pg_receivewal version and exit. -? --help Show help about pg_receivewal command line arguments, and exit.