Question: What does the "postgres error cluster is disabled" message mean?


The error message "cluster is disabled" in PostgreSQL typically indicates that the server or database cluster you are trying to access has been set to refuse connections. This could happen for several reasons:

  1. PostgreSQL Configuration: PostgreSQL can be configured to deny connections. This is generally controlled by the postgresql.conf file. If listen_addresses is set incorrectly, the server might not accept any connections. For instance, setting listen_addresses = '' will disable TCP/IP listening.

    listen_addresses = '' # no IP address, effectively disabling TCP/IP connections
  2. pg_hba.conf File: The pg_hba.conf file controls which hosts can connect to which databases and whether the connection must be encrypted. If no appropriate rules are set, it might appear as though the cluster is disabled because all connection attempts are refused.

    Example of a restrictive rule:

    # TYPE DATABASE USER ADDRESS METHOD host all all reject
  3. Database Server Not Running: If the PostgreSQL service itself isn't running, attempts to connect to any database will fail. Ensure that the PostgreSQL server is active:

    • On Unix-like systems, you can check with:
      sudo systemctl status postgresql
    • On Windows, check the Services management console to see if the PostgreSQL service is running.
  4. Network Issues: Sometimes network configurations or firewall settings might block connections to the PostgreSQL server, making it seem like the server is disabled.

  5. Maintenance Mode: During upgrades or maintenance, administrators might temporarily disable the cluster to prevent changes. This is less common but is possible in managed environments.

Troubleshooting Steps:

  • Verify that the PostgreSQL server is running.
  • Check postgresql.conf and pg_hba.conf for any configuration that might restrict connections.
  • Investigate any network or firewall issues that might be blocking connections to the PostgreSQL server.

If you're an administrator, adjusting the configuration to correctly specify listen_addresses and updating pg_hba.conf with proper access rules are the first steps to resolving this issue.

Was this content helpful?

White Paper

Free System Design on AWS E-Book

Download this early release of O'Reilly's latest cloud infrastructure e-book: System Design on AWS.

Free System Design on AWS E-Book
Start building today

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement.