Forrest logo
tool overview
On this page you find all important commands for the CLI tool pg_isready. If the command you are looking for is missing please ask our AI.

pg_isready

pg_isready is a command line tool used for checking the status of a PostgreSQL database server. It provides information about the availability of the database server to accept connections. The tool connects to the server and determines whether it is accepting connections or not.

When executed without any parameters, pg_isready connects to the default PostgreSQL instance running on the localhost, using the default port. It sends a connection request and waits for the server's response. The tool then exits with a return code indicating the server's availability, making it useful for scripting and monitoring purposes.

pg_isready can also be used with custom connection options to check the status of remote PostgreSQL servers. It accepts parameters like host, port, username, database, and connection timeout, allowing you to test the availability of specific database instances.

The exit codes returned by pg_isready provide useful information about the server's status. For example, a return code of 0 means the server is accepting connections, while a non-zero return code indicates that the server is not accepting connections.

The tool can be used in conjunction with system monitoring tools or scripts to automate the checking of PostgreSQL server availability. By periodically running pg_isready, one can ensure the continuous operation of PostgreSQL database servers.

pg_isready is available on various operating systems, including Linux, macOS, and Windows, and is installed along with the PostgreSQL client utilities package.

It is a lightweight and simple tool that provides a quick way to check the status of PostgreSQL servers without the need for complex queries or connecting directly to the database server.

List of commands for pg_isready:

  • pg_isready:tldr:3b7fe pg_isready: Check connection with a specific hostname and port.
    $ pg_isready --host=${hostname} --port=${port}
    try on your machine
    explain this command
  • pg_isready:tldr:7e502 pg_isready: Check connection displaying a message only when the connection fails.
    $ pg_isready --quiet
    try on your machine
    explain this command
  • pg_isready:tldr:e3de3 pg_isready: Check connection.
    $ pg_isready
    try on your machine
    explain this command
tool overview