| PG_ISREADY(1) | PostgreSQL 18.6 Documentation | PG_ISREADY(1) |
نام (NAME)
pg_isready - check the connection status of a PostgreSQL server
خلاصه دستور (SYNOPSIS)
pg_isready [connection-option...] [option...]
توضیحات (DESCRIPTION)
pg_isready is a utility for checking the connection status of a PostgreSQL database server. The exit status specifies the result of the connection check.
گزینهها (OPTIONS)
-d dbname
--dbname=dbname
-h hostname
--host=hostname
-p port
--port=port
-q
--quiet
-t seconds
--timeout=seconds
-U username
--username=username
-V
--version
-?
--help
وضعیت خروج (EXIT STATUS)
pg_isready returns 0 to the shell if the server is accepting connections normally, 1 if the server is rejecting connections (for example during startup), 2 if there was no response to the connection attempt, and 3 if no attempt was made (for example due to invalid parameters).
محیط (ENVIRONMENT)
pg_isready, like most other PostgreSQL utilities, also uses the environment variables supported by libpq (see Section 32.15).
The environment variable PG_COLOR specifies whether to use color in diagnostic messages. Possible values are always, auto and never.
نکات (NOTES)
It is not necessary to supply correct user name, password, or database name values to obtain the server status; however, if incorrect values are provided, the server will log a failed connection attempt.
مثالها (EXAMPLES)
Standard Usage:
$ pg_isready /tmp:5432 - accepting connections $ echo $? 0
Running with connection parameters to a PostgreSQL cluster in startup:
$ pg_isready -h localhost -p 5433 localhost:5433 - rejecting connections $ echo $? 1
Running with connection parameters to a non-responsive PostgreSQL cluster:
$ pg_isready -h someremotehost someremotehost:5432 - no response $ echo $? 2
| 2026 | PostgreSQL 18.6 |