1PG_RECEIVEXLOG(1)       PostgreSQL 9.2.24 Documentation      PG_RECEIVEXLOG(1)
2
3
4

NAME

6       pg_receivexlog - streams transaction logs from a PostgreSQL cluster
7

SYNOPSIS

9       pg_receivexlog [option...]
10

DESCRIPTION

12       pg_receivexlog is used to stream transaction log from a running
13       PostgreSQL cluster. The transaction log is streamed using the streaming
14       replication protocol, and is written to a local directory of files.
15       This directory can be used as the archive location for doing a restore
16       using point-in-time recovery (see Section 24.3, “Continuous Archiving
17       and Point-in-Time Recovery (PITR)”, in the documentation).
18
19       pg_receivexlog streams the transaction log in real time as it's being
20       generated on the server, and does not wait for segments to complete
21       like archive_command does. For this reason, it is not necessary to set
22       archive_timeout when using pg_receivexlog.
23
24       The transaction log is streamed over a regular PostgreSQL connection,
25       and uses the replication protocol. The connection must be made with a
26       superuser or a user having REPLICATION permissions (see Section 20.2,
27       “Role Attributes”, in the documentation), and pg_hba.conf must
28       explicitly permit the replication connection. The server must also be
29       configured with max_wal_senders set high enough to leave at least one
30       session available for the stream.
31
32       If the connection is lost, or if it cannot be initially established,
33       with a non-fatal error, pg_receivexlog will retry the connection
34       indefinitely, and reestablish streaming as soon as possible. To avoid
35       this behavior, use the -n parameter.
36

OPTIONS

38       The following command-line options control the location and format of
39       the output.
40
41       -D directory, --directory=directory
42           Directory to write the output to.
43
44           This parameter is required.
45
46       The following command-line options control the running of the program.
47
48       -n, --no-loop
49           Don't loop on connection errors. Instead, exit right away with an
50           error.
51
52       -v, --verbose
53           Enables verbose mode.
54
55       The following command-line options control the database connection
56       parameters.
57
58       -h host, --host=host
59           Specifies the host name of the machine on which the server is
60           running. If the value begins with a slash, it is used as the
61           directory for the Unix domain socket. The default is taken from the
62           PGHOST environment variable, if set, else a Unix domain socket
63           connection is attempted.
64
65       -p port, --port=port
66           Specifies the TCP port or local Unix domain socket file extension
67           on which the server is listening for connections. Defaults to the
68           PGPORT environment variable, if set, or a compiled-in default.
69
70       -s interval, --status-interval=interval
71           Specifies the number of seconds between status packets sent back to
72           the server. This is required if replication timeout is configured
73           on the server, and allows for easier monitoring. A value of zero
74           disables the status updates completely. The default value is 10
75           seconds.
76
77       -U username, --username=username
78           User name to connect as.
79
80       -w, --no-password
81           Never issue a password prompt. If the server requires password
82           authentication and a password is not available by other means such
83           as a .pgpass file, the connection attempt will fail. This option
84           can be useful in batch jobs and scripts where no user is present to
85           enter a password.
86
87       -W, --password
88           Force pg_receivexlog to prompt for a password before connecting to
89           a database.
90
91           This option is never essential, since pg_receivexlog will
92           automatically prompt for a password if the server demands password
93           authentication. However, pg_receivexlog will waste a connection
94           attempt finding out that the server wants a password. In some cases
95           it is worth typing -W to avoid the extra connection attempt.
96
97       Other options are also available:
98
99       -V, --version
100           Print the pg_receivexlog version and exit.
101
102       -?, --help
103           Show help about pg_receivexlog command line arguments, and exit.
104

ENVIRONMENT

106       This utility, like most other PostgreSQL utilities, uses the
107       environment variables supported by libpq (see Section 31.14,
108       “Environment Variables”, in the documentation).
109

NOTES

111       When using pg_receivexlog instead of archive_command, the server will
112       continue to recycle transaction log files even if the backups are not
113       properly archived, since there is no command that fails. This can be
114       worked around by having an archive_command that fails when the file has
115       not been properly archived yet, for example:
116
117           archive_command = 'sleep 5 && test -f /mnt/server/archivedir/%f'
118
119       The initial timeout is necessary because pg_receivexlog works using
120       asynchronous replication and can therefore be slightly behind the
121       master.
122

EXAMPLES

124       To stream the transaction log from the server at mydbserver and store
125       it in the local directory /usr/local/pgsql/archive:
126
127           $ pg_receivexlog -h mydbserver -D /usr/local/pgsql/archive
128

SEE ALSO

130       pg_basebackup(1)
131
132
133
134PostgreSQL 9.2.24                 2017-11-06                 PG_RECEIVEXLOG(1)
Impressum