gooderp18绿色标准版
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

82 行
9.1KB

  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_isready</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-pg-dumpall.html" title="pg_dumpall" /><link rel="next" href="app-pgreceivewal.html" title="pg_receivewal" /></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_isready</span></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="app-pg-dumpall.html" title="pg_dumpall">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-pgreceivewal.html" title="pg_receivewal">Next</a></td></tr></table><hr></hr></div><div class="refentry" id="APP-PG-ISREADY"><div class="titlepage"></div><a id="id-1.9.4.14.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle"><span class="application">pg_isready</span></span></h2><p>pg_isready — check the connection status of a <span class="productname">PostgreSQL</span> server</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p id="id-1.9.4.14.4.1"><code class="command">pg_isready</code> [<em class="replaceable"><code>connection-option</code></em>...] [<em class="replaceable"><code>option</code></em>...]</p></div></div><div class="refsect1" id="APP-PG-ISREADY-DESCRIPTION"><h2>Description</h2><p>
  3. <span class="application">pg_isready</span> is a utility for checking the connection
  4. status of a <span class="productname">PostgreSQL</span> database server. The exit
  5. status specifies the result of the connection check.
  6. </p></div><div class="refsect1" id="APP-PG-ISREADY-OPTIONS"><h2>Options</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-d <em class="replaceable"><code>dbname</code></em></code><br /></span><span class="term"><code class="option">--dbname=<em class="replaceable"><code>dbname</code></em></code></span></dt><dd><p>
  7. Specifies the name of the database to connect to.
  8. </p><p>
  9. If this parameter contains an <code class="symbol">=</code> sign or starts
  10. with a valid <acronym class="acronym">URI</acronym> prefix
  11. (<code class="literal">postgresql://</code>
  12. or <code class="literal">postgres://</code>), it is treated as a
  13. <em class="parameter"><code>conninfo</code></em> string. See <a class="xref" href="libpq-connect.html#LIBPQ-CONNSTRING" title="33.1.1. Connection Strings">Section 33.1.1</a> for more information.
  14. </p></dd><dt><span class="term"><code class="option">-h <em class="replaceable"><code>hostname</code></em></code><br /></span><span class="term"><code class="option">--host=<em class="replaceable"><code>hostname</code></em></code></span></dt><dd><p>
  15. Specifies the host name of the machine on which the
  16. server is running. If the value begins
  17. with a slash, it is used as the directory for the Unix-domain
  18. socket.
  19. </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>
  20. Specifies the TCP port or the local Unix-domain
  21. socket file extension on which the server is listening for
  22. connections. Defaults to the value of the <code class="envar">PGPORT</code>
  23. environment variable or, if not set, to the port specified at
  24. compile time, usually 5432.
  25. </p></dd><dt><span class="term"><code class="option">-q</code><br /></span><span class="term"><code class="option">--quiet</code></span></dt><dd><p>
  26. Do not display status message. This is useful when scripting.
  27. </p></dd><dt><span class="term"><code class="option">-t <em class="replaceable"><code>seconds</code></em></code><br /></span><span class="term"><code class="option">--timeout=<em class="replaceable"><code>seconds</code></em></code></span></dt><dd><p>
  28. The maximum number of seconds to wait when attempting connection before
  29. returning that the server is not responding. Setting to 0 disables. The
  30. default is 3 seconds.
  31. </p></dd><dt><span class="term"><code class="option">-U <em class="replaceable"><code>username</code></em></code><br /></span><span class="term"><code class="option">--username=<em class="replaceable"><code>username</code></em></code></span></dt><dd><p>
  32. Connect to the database as the user <em class="replaceable"><code>username</code></em> instead of the default.
  33. </p></dd><dt><span class="term"><code class="option">-V</code><br /></span><span class="term"><code class="option">--version</code></span></dt><dd><p>
  34. Print the <span class="application">pg_isready</span> version and exit.
  35. </p></dd><dt><span class="term"><code class="option">-?</code><br /></span><span class="term"><code class="option">--help</code></span></dt><dd><p>
  36. Show help about <span class="application">pg_isready</span> command line
  37. arguments, and exit.
  38. </p></dd></dl></div></div><div class="refsect1" id="id-1.9.4.14.7"><h2>Exit Status</h2><p>
  39. <span class="application">pg_isready</span> returns <code class="literal">0</code> to the shell if the server
  40. is accepting connections normally, <code class="literal">1</code> if the server is rejecting
  41. connections (for example during startup), <code class="literal">2</code> if there was no response to the
  42. connection attempt, and <code class="literal">3</code> if no attempt was made (for example due to invalid
  43. parameters).
  44. </p></div><div class="refsect1" id="id-1.9.4.14.8"><h2>Environment</h2><p>
  45. <code class="command">pg_isready</code>, like most other <span class="productname">PostgreSQL</span>
  46. utilities,
  47. also uses the environment variables supported by <span class="application">libpq</span>
  48. (see <a class="xref" href="libpq-envars.html" title="33.14. Environment Variables">Section 33.14</a>).
  49. </p><p>
  50. The environment variable <code class="envar">PG_COLOR</code> specifies whether to use
  51. color in diagnostic messages. Possible values are
  52. <code class="literal">always</code>, <code class="literal">auto</code> and
  53. <code class="literal">never</code>.
  54. </p></div><div class="refsect1" id="APP-PG-ISREADY-NOTES"><h2>Notes</h2><p>
  55. It is not necessary to supply correct user name, password, or database
  56. name values to obtain the server status; however, if incorrect values
  57. are provided, the server will log a failed connection attempt.
  58. </p></div><div class="refsect1" id="APP-PG-ISREADY-EXAMPLES"><h2>Examples</h2><p>
  59. Standard Usage:
  60. </p><pre class="screen">
  61. <code class="prompt">$</code> <strong class="userinput"><code>pg_isready</code></strong>
  62. <code class="computeroutput">/tmp:5432 - accepting connections</code>
  63. <code class="prompt">$</code> <strong class="userinput"><code>echo $?</code></strong>
  64. <code class="computeroutput">0</code>
  65. </pre><p>
  66. </p><p>
  67. Running with connection parameters to a <span class="productname">PostgreSQL</span> cluster in startup:
  68. </p><pre class="screen">
  69. <code class="prompt">$ </code><strong class="userinput"><code>pg_isready -h localhost -p 5433</code></strong>
  70. <code class="computeroutput">localhost:5433 - rejecting connections</code>
  71. <code class="prompt">$</code> <strong class="userinput"><code>echo $?</code></strong>
  72. <code class="computeroutput">1</code>
  73. </pre><p>
  74. </p><p>
  75. Running with connection parameters to a non-responsive <span class="productname">PostgreSQL</span> cluster:
  76. </p><pre class="screen">
  77. <code class="prompt">$ </code><strong class="userinput"><code>pg_isready -h someremotehost</code></strong>
  78. <code class="computeroutput">someremotehost:5432 - no response</code>
  79. <code class="prompt">$</code> <strong class="userinput"><code>echo $?</code></strong>
  80. <code class="computeroutput">2</code>
  81. </pre><p>
  82. </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="app-pg-dumpall.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-pgreceivewal.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="application">pg_dumpall</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> pg_receivewal</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1