Hosting Operations
Read-onlyCheck Whether PostgreSQL Is Accepting Connections
An app cannot reach PostgreSQL and you need a quick first-response check before digging into logs or credentials.
Command
pg_isready -h 127.0.0.1 -p 5432
Before you run this
System impact: Read-only. Low when scoped to the shown target.
When not to use it: Do not treat readiness as proof that a specific user, database, or query works.
Expected output
A line showing host, port, and whether PostgreSQL is accepting connections.
System impact
Read-only. Nothing changes. pg_isready reports whether the server accepts connections.
Recovery / rollback: no state is changed.
When to use it
Use during deploys, incident triage, service restarts, and health checks.
When not to use it
Do not treat readiness as proof that a specific user, database, or query works.
Watch this command run
Command transcript
This sanitized transcript shows the commands and output shape without exposing host details.
$ pg_isready -h localhost -p 5432
localhost:5432 - accepting connections
$ pg_isready -h localhost -p 15432 || true
localhost:15432 - no response
$ ss -ltnp | grep ':5432'
LISTEN 0 128 localhost:5432 0.0.0.0:* users:(("postgres",pid=421,fd=5))
View commands shown
These are the commands shown in the sanitized transcript.
Commands shown
pg_isready -h 127.0.0.1 -p 5432pg_isready -h 127.0.0.1 -p 15432 || truess -ltnp | grep ':5432'
next steps
Related commands
Check Whether MySQL Responds
The port was open. MySQL still had to answer.
mysqladmin ping -h 127.0.0.1 -P 3306
Show Active MySQL Sessions
The app was waiting behind busy sessions.
mysql -e "show full processlist;"
Check PostgreSQL Lock Waits
The outage was a queue, not a crash.
psql -X -c "select pid, wait_event_type, wait_event, state, left(query, 80) as query from pg_stat_activity where wait_event_type is not null order by pid;"
Show Active PostgreSQL Connections
The database was not down. It was full.
psql -X -A -F '|' -c "select pid,usename,datname,state,client_addr from pg_stat_activity order by state, pid;"
Check Inodes When Disk Space Looks Fine
Sometimes the disk has free bytes but still cannot create files.
df -ih
Study mapping
Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.
Useful for
- LPIC-1 style command-line practice
- LFCS style performance tasks
- Linux+ style troubleshooting review
Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.