snippetsqlMinor
How to quickly test if postgres database is accessible?
Viewed 0 times
quicklypostgresaccessibledatabasetesthow
Problem
I whished there were a tool like ping for databases? I just want to ping the database and see if it is accessible from a remote server from Linux command line (bash).
I read about telnet, but I am not sure how it works.
Any suggestions?
I read about telnet, but I am not sure how it works.
Any suggestions?
Solution
Something like:
192.168.79.8:5432 - no response
Another solutions is telnet:
Which returns:
Trying 192.168.79.8...
Connected to 192.168.79.8.
Escape character is '^]'.
If the database is accessible.
pg_isready --host=192.168.79.8 --username=test --port=5432192.168.79.8:5432 - no response
Another solutions is telnet:
telnet 192.168.79.8 5432Which returns:
Trying 192.168.79.8...
Connected to 192.168.79.8.
Escape character is '^]'.
If the database is accessible.
Code Snippets
pg_isready --host=192.168.79.8 --username=test --port=5432telnet 192.168.79.8 5432Context
StackExchange DevOps Q#14789, answer score: 7
Revisions (0)
No revisions yet.