Is my port open?

December 1, 2020
PostgreSQL Administration

As a consultant, I frequently need to install Postgres for customers. Of course I send them a list or prerequisites beforehand but, I don’t know why, there’s always a problem with one of them and, most often, the problem concerns port opening.

Tools? Who needs tools ?

Sysadmins will recommend you to use either nmap or netcat or netstat and you might need to combine those tools (which syntax you will keep forgetting) with grep to find if your port is listed.

Then you will have to remember if the syntax you chose was to display open or close ports…

That’s a little too sophisticated for me. I just want to know if a specific port is open or close!

Linux can help

So, you need to know that Linux works with files. It does not feel like breaking news here, but it means that hosts and ports availability are also files. We can use that to our benefit :

(echo >/dev/tcp/<host>/<port>) &>/dev/null && echo "open" || echo "close"

This command will simply answer “open” or “close” to tell you if the port is open or close. Simple, isn’t it ?

Replica identity for logical replication

December 16, 2020
PostgreSQL Administration

Postgres dress with pockets

November 27, 2020
PostgreSQL

Where do my Postgres settings come from ?

April 19, 2020
Hacking PostgreSQL Administration