gooderp18绿色标准版
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

170 rindas
17KB

  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>pg_recvlogical</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="prev" href="app-pgreceivewal.html" title="pg_receivewal" /><link rel="next" href="app-pgrestore.html" title="pg_restore" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center"><span xmlns="http://www.w3.org/1999/xhtml" class="application">pg_recvlogical</span></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="app-pgreceivewal.html" title="pg_receivewal">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="reference-client.html" title="PostgreSQL Client Applications">Up</a></td><th width="60%" align="center">PostgreSQL Client Applications</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 12.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="app-pgrestore.html" title="pg_restore">Next</a></td></tr></table><hr></hr></div><div class="refentry" id="APP-PGRECVLOGICAL"><div class="titlepage"></div><a id="id-1.9.4.16.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle"><span class="application">pg_recvlogical</span></span></h2><p>pg_recvlogical — control <span class="productname">PostgreSQL</span> logical decoding streams</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p id="id-1.9.4.16.4.1"><code class="command">pg_recvlogical</code> [<em class="replaceable"><code>option</code></em>...]</p></div></div><div class="refsect1" id="id-1.9.4.16.5"><h2>Description</h2><p>
  3. <code class="command">pg_recvlogical</code> controls logical decoding replication
  4. slots and streams data from such replication slots.
  5. </p><p>
  6. It creates a replication-mode connection, so it is subject to the same
  7. constraints as <a class="xref" href="app-pgreceivewal.html" title="pg_receivewal"><span class="refentrytitle">pg_receivewal</span></a>, plus those for logical
  8. replication (see <a class="xref" href="logicaldecoding.html" title="Chapter 48. Logical Decoding">Chapter 48</a>).
  9. </p><p>
  10. <code class="command">pg_recvlogical</code> has no equivalent to the logical decoding
  11. SQL interface's peek and get modes. It sends replay confirmations for
  12. data lazily as it receives it and on clean exit. To examine pending data on
  13. a slot without consuming it, use
  14. <a class="link" href="functions-admin.html#FUNCTIONS-REPLICATION" title="9.26.6. Replication Functions"><code class="function">pg_logical_slot_peek_changes</code></a>.
  15. </p></div><div class="refsect1" id="id-1.9.4.16.6"><h2>Options</h2><p>
  16. At least one of the following options must be specified to select an action:
  17. </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">--create-slot</code></span></dt><dd><p>
  18. Create a new logical replication slot with the name specified by
  19. <code class="option">--slot</code>, using the output plugin specified by
  20. <code class="option">--plugin</code>, for the database specified
  21. by <code class="option">--dbname</code>.
  22. </p></dd><dt><span class="term"><code class="option">--drop-slot</code></span></dt><dd><p>
  23. Drop the replication slot with the name specified
  24. by <code class="option">--slot</code>, then exit.
  25. </p></dd><dt><span class="term"><code class="option">--start</code></span></dt><dd><p>
  26. Begin streaming changes from the logical replication slot specified
  27. by <code class="option">--slot</code>, continuing until terminated by a
  28. signal. If the server side change stream ends with a server shutdown
  29. or disconnect, retry in a loop unless
  30. <code class="option">--no-loop</code> is specified.
  31. </p><p>
  32. The stream format is determined by the output plugin specified when
  33. the slot was created.
  34. </p><p>
  35. The connection must be to the same database used to create the slot.
  36. </p></dd></dl></div><p>
  37. </p><p>
  38. <code class="option">--create-slot</code> and <code class="option">--start</code> can be
  39. specified together. <code class="option">--drop-slot</code> cannot be combined with
  40. another action.
  41. </p><p>
  42. The following command-line options control the location and format of the
  43. output and other replication behavior:
  44. </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-E <em class="replaceable"><code>lsn</code></em></code><br /></span><span class="term"><code class="option">--endpos=<em class="replaceable"><code>lsn</code></em></code></span></dt><dd><p>
  45. In <code class="option">--start</code> mode, automatically stop replication
  46. and exit with normal exit status 0 when receiving reaches the
  47. specified LSN. If specified when not in <code class="option">--start</code>
  48. mode, an error is raised.
  49. </p><p>
  50. If there's a record with LSN exactly equal to <em class="replaceable"><code>lsn</code></em>,
  51. the record will be output.
  52. </p><p>
  53. The <code class="option">--endpos</code> option is not aware of transaction
  54. boundaries and may truncate output partway through a transaction.
  55. Any partially output transaction will not be consumed and will be
  56. replayed again when the slot is next read from. Individual messages
  57. are never truncated.
  58. </p></dd><dt><span class="term"><code class="option">-f <em class="replaceable"><code>filename</code></em></code><br /></span><span class="term"><code class="option">--file=<em class="replaceable"><code>filename</code></em></code></span></dt><dd><p>
  59. Write received and decoded transaction data into this
  60. file. Use <code class="literal">-</code> for <span class="systemitem">stdout</span>.
  61. </p></dd><dt><span class="term"><code class="option">-F <em class="replaceable"><code>interval_seconds</code></em></code><br /></span><span class="term"><code class="option">--fsync-interval=<em class="replaceable"><code>interval_seconds</code></em></code></span></dt><dd><p>
  62. Specifies how often <span class="application">pg_recvlogical</span> should
  63. issue <code class="function">fsync()</code> calls to ensure the output file is
  64. safely flushed to disk.
  65. </p><p>
  66. The server will occasionally request the client to perform a flush and
  67. report the flush position to the server. This setting is in addition
  68. to that, to perform flushes more frequently.
  69. </p><p>
  70. Specifying an interval of <code class="literal">0</code> disables
  71. issuing <code class="function">fsync()</code> calls altogether, while still
  72. reporting progress to the server. In this case, data could be lost in
  73. the event of a crash.
  74. </p></dd><dt><span class="term"><code class="option">-I <em class="replaceable"><code>lsn</code></em></code><br /></span><span class="term"><code class="option">--startpos=<em class="replaceable"><code>lsn</code></em></code></span></dt><dd><p>
  75. In <code class="option">--start</code> mode, start replication from the given
  76. LSN. For details on the effect of this, see the documentation
  77. in <a class="xref" href="logicaldecoding.html" title="Chapter 48. Logical Decoding">Chapter 48</a>
  78. and <a class="xref" href="protocol-replication.html" title="52.4. Streaming Replication Protocol">Section 52.4</a>. Ignored in other modes.
  79. </p></dd><dt><span class="term"><code class="option">--if-not-exists</code></span></dt><dd><p>
  80. Do not error out when <code class="option">--create-slot</code> is specified
  81. and a slot with the specified name already exists.
  82. </p></dd><dt><span class="term"><code class="option">-n</code><br /></span><span class="term"><code class="option">--no-loop</code></span></dt><dd><p>
  83. When the connection to the server is lost, do not retry in a loop, just exit.
  84. </p></dd><dt><span class="term"><code class="option">-o <em class="replaceable"><code>name</code></em>[=<em class="replaceable"><code>value</code></em>]</code><br /></span><span class="term"><code class="option">--option=<em class="replaceable"><code>name</code></em>[=<em class="replaceable"><code>value</code></em>]</code></span></dt><dd><p>
  85. Pass the option <em class="replaceable"><code>name</code></em> to the output plugin with,
  86. if specified, the option value <em class="replaceable"><code>value</code></em>. Which
  87. options exist and their effects depends on the used output plugin.
  88. </p></dd><dt><span class="term"><code class="option">-P <em class="replaceable"><code>plugin</code></em></code><br /></span><span class="term"><code class="option">--plugin=<em class="replaceable"><code>plugin</code></em></code></span></dt><dd><p>
  89. When creating a slot, use the specified logical decoding output
  90. plugin. See <a class="xref" href="logicaldecoding.html" title="Chapter 48. Logical Decoding">Chapter 48</a>. This option has no
  91. effect if the slot already exists.
  92. </p></dd><dt><span class="term"><code class="option">-s <em class="replaceable"><code>interval_seconds</code></em></code><br /></span><span class="term"><code class="option">--status-interval=<em class="replaceable"><code>interval_seconds</code></em></code></span></dt><dd><p>
  93. This option has the same effect as the option of the same name
  94. in <a class="xref" href="app-pgreceivewal.html" title="pg_receivewal"><span class="refentrytitle">pg_receivewal</span></a>. See the description there.
  95. </p></dd><dt><span class="term"><code class="option">-S <em class="replaceable"><code>slot_name</code></em></code><br /></span><span class="term"><code class="option">--slot=<em class="replaceable"><code>slot_name</code></em></code></span></dt><dd><p>
  96. In <code class="option">--start</code> mode, use the existing logical replication slot named
  97. <em class="replaceable"><code>slot_name</code></em>. In <code class="option">--create-slot</code>
  98. mode, create the slot with this name. In <code class="option">--drop-slot</code>
  99. mode, delete the slot with this name.
  100. </p></dd><dt><span class="term"><code class="option">-v</code><br /></span><span class="term"><code class="option">--verbose</code></span></dt><dd><p>
  101. Enables verbose mode.
  102. </p></dd></dl></div><p>
  103. </p><p>
  104. The following command-line options control the database connection parameters.
  105. </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-d <em class="replaceable"><code>database</code></em></code><br /></span><span class="term"><code class="option">--dbname=<em class="replaceable"><code>database</code></em></code></span></dt><dd><p>
  106. The database to connect to. See the description of the actions for
  107. what this means in detail. This can be a <span class="application">libpq</span> connection string;
  108. see <a class="xref" href="libpq-connect.html#LIBPQ-CONNSTRING" title="33.1.1. Connection Strings">Section 33.1.1</a> for more information. Defaults
  109. to user name.
  110. </p></dd><dt><span class="term"><code class="option">-h <em class="replaceable"><code>hostname-or-ip</code></em></code><br /></span><span class="term"><code class="option">--host=<em class="replaceable"><code>hostname-or-ip</code></em></code></span></dt><dd><p>
  111. Specifies the host name of the machine on which the server is
  112. running. If the value begins with a slash, it is used as the
  113. directory for the Unix domain socket. The default is taken
  114. from the <code class="envar">PGHOST</code> environment variable, if set,
  115. else a Unix domain socket connection is attempted.
  116. </p></dd><dt><span class="term"><code class="option">-p <em class="replaceable"><code>port</code></em></code><br /></span><span class="term"><code class="option">--port=<em class="replaceable"><code>port</code></em></code></span></dt><dd><p>
  117. Specifies the TCP port or local Unix domain socket file
  118. extension on which the server is listening for connections.
  119. Defaults to the <code class="envar">PGPORT</code> environment variable, if
  120. set, or a compiled-in default.
  121. </p></dd><dt><span class="term"><code class="option">-U <em class="replaceable"><code>user</code></em></code><br /></span><span class="term"><code class="option">--username=<em class="replaceable"><code>user</code></em></code></span></dt><dd><p>
  122. User name to connect as. Defaults to current operating system user
  123. name.
  124. </p></dd><dt><span class="term"><code class="option">-w</code><br /></span><span class="term"><code class="option">--no-password</code></span></dt><dd><p>
  125. Never issue a password prompt. If the server requires
  126. password authentication and a password is not available by
  127. other means such as a <code class="filename">.pgpass</code> file, the
  128. connection attempt will fail. This option can be useful in
  129. batch jobs and scripts where no user is present to enter a
  130. password.
  131. </p></dd><dt><span class="term"><code class="option">-W</code><br /></span><span class="term"><code class="option">--password</code></span></dt><dd><p>
  132. Force <span class="application">pg_recvlogical</span> to prompt for a
  133. password before connecting to a database.
  134. </p><p>
  135. This option is never essential, since
  136. <span class="application">pg_recvlogical</span> will automatically prompt
  137. for a password if the server demands password authentication.
  138. However, <span class="application">pg_recvlogical</span> will waste a
  139. connection attempt finding out that the server wants a password.
  140. In some cases it is worth typing <code class="option">-W</code> to avoid the extra
  141. connection attempt.
  142. </p></dd></dl></div><p>
  143. </p><p>
  144. The following additional options are available:
  145. </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-V</code><br /></span><span class="term"><code class="option">--version</code></span></dt><dd><p>
  146. Print the <span class="application">pg_recvlogical</span> version and exit.
  147. </p></dd><dt><span class="term"><code class="option">-?</code><br /></span><span class="term"><code class="option">--help</code></span></dt><dd><p>
  148. Show help about <span class="application">pg_recvlogical</span> command line
  149. arguments, and exit.
  150. </p></dd></dl></div><p>
  151. </p></div><div class="refsect1" id="id-1.9.4.16.7"><h2>Environment</h2><p>
  152. This utility, like most other <span class="productname">PostgreSQL</span> utilities,
  153. uses the environment variables supported by <span class="application">libpq</span>
  154. (see <a class="xref" href="libpq-envars.html" title="33.14. Environment Variables">Section 33.14</a>).
  155. </p><p>
  156. The environment variable <code class="envar">PG_COLOR</code> specifies whether to use
  157. color in diagnostic messages. Possible values are
  158. <code class="literal">always</code>, <code class="literal">auto</code> and
  159. <code class="literal">never</code>.
  160. </p></div><div class="refsect1" id="id-1.9.4.16.8"><h2>Notes</h2><p>
  161. <span class="application">pg_recvlogical</span> will preserve group permissions on
  162. the received WAL files if group permissions are enabled on the source
  163. cluster.
  164. </p></div><div class="refsect1" id="id-1.9.4.16.9"><h2>Examples</h2><p>
  165. See <a class="xref" href="logicaldecoding-example.html" title="48.1. Logical Decoding Examples">Section 48.1</a> for an example.
  166. </p></div><div class="refsect1" id="id-1.9.4.16.10"><h2>See Also</h2><span class="simplelist"><a class="xref" href="app-pgreceivewal.html" title="pg_receivewal"><span class="refentrytitle">pg_receivewal</span></a></span></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="app-pgreceivewal.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-client.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="app-pgrestore.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">pg_receivewal </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> pg_restore</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1