Getting ready

Luckily, PostgreSQL provides most of the tools we need. However, there is a more advanced command-line utility named tcpkill that we may need to use later. If it's not already installed, we recommend that you do so before continuing. Debian or Ubuntu-based systems can use this command as a root-capable user:

sudo apt-get install dsniff
For lucky users of 9.6 and above, we suggest setting the new idle_in_transaction_session_timeout setting to 3600 or lower in postgresql.conf. This parameter will tell Postgres to automatically cut any connection that is idle for longer than an hour.

Get PostgreSQL High Availability Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.