Skip to content

Instantly share code, notes, and snippets.

@edib
edib / rsyncwal.sh
Last active November 5, 2018 09:45
postgresql multiple host and pgbacrest wall archive script
#!/bin/bash
rsync -q -ae ssh $1 \ postgres@<replica1>:<xlog_archive_path>/$2
rsync -q -ae ssh $1 \ postgres@<replica2>:<xlog_archive_path>/$2
if [ $? != 0 ]
then
echo "Archiver error:"
exit 1
fi
@cmer
cmer / haproxy.cfg
Last active April 15, 2024 09:54
Simple, no bullshit TCP port forwarding using HAProxy
listen l1
bind 0.0.0.0:443
mode tcp
timeout connect 4000
timeout client 180000
timeout server 180000
server srv1 host.example.com:9443
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active May 3, 2024 16:53
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'