Run ssh-agent when you login, and kill it when you logout. Put the following into your ~/.bash_profile:
eval `/usr/bin/ssh-agent -s` trap "kill $SSH_AGENT_PID" 0
PostgreSQL streaming replication status
There is a handy view which shows the state of streaming replication:
You can add an “application_name” parameter in your database connection string to identify your application. This is also the name that PostgreSQL uses for “synchronous_standby_names”.
Note that you can set “synchronous_standby_names” to “*” to let PostgreSQL choose any slave to be the synchronous one.
Pretty print JSON from the command-line
This simple Python tool will pretty print the JSON it receives on stdin.
Clone partition map
When setting up new disks for software raid it’s easiest to have an identical partition map. If you have one disk already partitioned, then just duplicate that partition map across to the other:
sfdisk -d /dev/sda | sfdisk /dev/sdb
For goodness sake be careful!