Restoring DB backup of PostgreSQL >9.5

When you messed up your database of testing or production servers you usually want to restore a clean state as fast as possible with the backup and not mixing up date from the current state and the backup. An easy way to achieve this is to drop the database and create it again afterwards restore the dump.

But for PostgreSQL >9.5 there is the problem that you cannot drop a database if others are connected to the database which is very likely when you have services running.

Continue reading →

Check for memory over allocation (KVM)

Virtualization brought all the benefits of over allocation (using more resources than physically available) to us. And sharing resources like CPU makes a lot of sense if you for example have a daily distributed workload like daily traffic and nightly jobs to generate reports and don’t need all resources at a time. This works great most of the time and is acceptable to slow down your system because of lack of resources sometimes but you definitely don’t want to crash you system because of lack of resources. This is why you usually don’t want over allocate memory. The following script allows you to check this for KVM hypervisor hosts.

Continue reading →