1PG_RECVLOGICAL(1)        PostgreSQL 11.6 Documentation       PG_RECVLOGICAL(1)
2
3
4

NAME

6       pg_recvlogical - control PostgreSQL logical decoding streams
7

SYNOPSIS

9       pg_recvlogical [option...]
10

DESCRIPTION

12       pg_recvlogical controls logical decoding replication slots and streams
13       data from such replication slots.
14
15       It creates a replication-mode connection, so it is subject to the same
16       constraints as pg_receivewal(1), plus those for logical replication
17       (see Chapter 49).
18
19       pg_recvlogical has no equivalent to the logical decoding SQL
20       interface's peek and get modes. It sends replay confirmations for data
21       lazily as it receives it and on clean exit. To examine pending data on
22       a slot without consuming it, use pg_logical_slot_peek_changes.
23

OPTIONS

25       At least one of the following options must be specified to select an
26       action:
27
28       --create-slot
29           Create a new logical replication slot with the name specified by
30           --slot, using the output plugin specified by --plugin, for the
31           database specified by --dbname.
32
33       --drop-slot
34           Drop the replication slot with the name specified by --slot, then
35           exit.
36
37       --start
38           Begin streaming changes from the logical replication slot specified
39           by --slot, continuing until terminated by a signal. If the server
40           side change stream ends with a server shutdown or disconnect, retry
41           in a loop unless --no-loop is specified.
42
43           The stream format is determined by the output plugin specified when
44           the slot was created.
45
46           The connection must be to the same database used to create the
47           slot.
48
49       --create-slot and --start can be specified together.  --drop-slot
50       cannot be combined with another action.
51
52       The following command-line options control the location and format of
53       the output and other replication behavior:
54
55       -E lsn
56       --endpos=lsn
57           In --start mode, automatically stop replication and exit with
58           normal exit status 0 when receiving reaches the specified LSN. If
59           specified when not in --start mode, an error is raised.
60
61           If there's a record with LSN exactly equal to lsn, the record will
62           be output.
63
64           The --endpos option is not aware of transaction boundaries and may
65           truncate output partway through a transaction. Any partially output
66           transaction will not be consumed and will be replayed again when
67           the slot is next read from. Individual messages are never
68           truncated.
69
70       -f filename
71       --file=filename
72           Write received and decoded transaction data into this file. Use -
73           for stdout.
74
75       -F interval_seconds
76       --fsync-interval=interval_seconds
77           Specifies how often pg_recvlogical should issue fsync() calls to
78           ensure the output file is safely flushed to disk.
79
80           The server will occasionally request the client to perform a flush
81           and report the flush position to the server. This setting is in
82           addition to that, to perform flushes more frequently.
83
84           Specifying an interval of 0 disables issuing fsync() calls
85           altogether, while still reporting progress to the server. In this
86           case, data could be lost in the event of a crash.
87
88       -I lsn
89       --startpos=lsn
90           In --start mode, start replication from the given LSN. For details
91           on the effect of this, see the documentation in Chapter 49 and
92           Section 53.4. Ignored in other modes.
93
94       --if-not-exists
95           Do not error out when --create-slot is specified and a slot with
96           the specified name already exists.
97
98       -n
99       --no-loop
100           When the connection to the server is lost, do not retry in a loop,
101           just exit.
102
103       -o name[=value]
104       --option=name[=value]
105           Pass the option name to the output plugin with, if specified, the
106           option value value. Which options exist and their effects depends
107           on the used output plugin.
108
109       -P plugin
110       --plugin=plugin
111           When creating a slot, use the specified logical decoding output
112           plugin. See Chapter 49. This option has no effect if the slot
113           already exists.
114
115       -s interval_seconds
116       --status-interval=interval_seconds
117           This option has the same effect as the option of the same name in
118           pg_receivewal(1). See the description there.
119
120       -S slot_name
121       --slot=slot_name
122           In --start mode, use the existing logical replication slot named
123           slot_name. In --create-slot mode, create the slot with this name.
124           In --drop-slot mode, delete the slot with this name.
125
126       -v
127       --verbose
128           Enables verbose mode.
129
130       The following command-line options control the database connection
131       parameters.
132
133       -d database
134       --dbname=database
135           The database to connect to. See the description of the actions for
136           what this means in detail. This can be a libpq connection string;
137           see Section 34.1.1 for more information. Defaults to user name.
138
139       -h hostname-or-ip
140       --host=hostname-or-ip
141           Specifies the host name of the machine on which the server is
142           running. If the value begins with a slash, it is used as the
143           directory for the Unix domain socket. The default is taken from the
144           PGHOST environment variable, if set, else a Unix domain socket
145           connection is attempted.
146
147       -p port
148       --port=port
149           Specifies the TCP port or local Unix domain socket file extension
150           on which the server is listening for connections. Defaults to the
151           PGPORT environment variable, if set, or a compiled-in default.
152
153       -U user
154       --username=user
155           User name to connect as. Defaults to current operating system user
156           name.
157
158       -w
159       --no-password
160           Never issue a password prompt. If the server requires password
161           authentication and a password is not available by other means such
162           as a .pgpass file, the connection attempt will fail. This option
163           can be useful in batch jobs and scripts where no user is present to
164           enter a password.
165
166       -W
167       --password
168           Force pg_recvlogical to prompt for a password before connecting to
169           a database.
170
171           This option is never essential, since pg_recvlogical will
172           automatically prompt for a password if the server demands password
173           authentication. However, pg_recvlogical will waste a connection
174           attempt finding out that the server wants a password. In some cases
175           it is worth typing -W to avoid the extra connection attempt.
176
177       The following additional options are available:
178
179       -V
180       --version
181           Print the pg_recvlogical version and exit.
182
183       -?
184       --help
185           Show help about pg_recvlogical command line arguments, and exit.
186

ENVIRONMENT

188       This utility, like most other PostgreSQL utilities, uses the
189       environment variables supported by libpq (see Section 34.14).
190

NOTES

192       pg_recvlogical will preserve group permissions on the received WAL
193       files if group permissions are enabled on the source cluster.
194

EXAMPLES

196       See Section 49.1 for an example.
197

SEE ALSO

199       pg_receivewal(1)
200
201
202
203PostgreSQL 11.6                      2019                    PG_RECVLOGICAL(1)
Impressum