Skip to content

Instantly share code, notes, and snippets.

python3 ./patronictl.py -c postgres0.yml list batman
+---------+-------------+-----------+--------+---------+-----------+---------------------------------------------+
| Cluster | Member | Host | Role | State | Lag in MB | Scheduled restart |
+---------+-------------+-----------+--------+---------+-----------+---------------------------------------------+
| batman | postgresql0 | 127.0.0.1 | Leader | running | 0 | 2017-12-05T14:30:00+01:00 if version < 10.1 |
| batman | postgresql1 | 127.0.0.1 | | running | unknown | |
+---------+-------------+-----------+--------+---------+-----------+---------------------------------------------+
etcdctl get /service/batman/optime/leader
50332128
@alexeyklyukin
alexeyklyukin / gist:0227addac5f30f80feea616f459bfa4c
Created February 13, 2018 09:58
Spilo configuration environment variable
SPILO_CONFIGURATION: | ## https://github.com/zalando/patroni#yaml-configuration
tags:
clonefrom: true
postgresql:
bin_dir: /usr/lib/postgresql/9.6/bin
bootstrap:
initdb:
- auth-host: md5
- auth-local: trust
pg_hba:
@alexeyklyukin
alexeyklyukin / tasks.json
Created November 14, 2018 10:32
tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"options": {
"cwd": "${workspaceRoot}/../../../build/pg/master/",
"env": {
"CPPFLAGS": "-I/usr/local/opt/openssl/include",
"LDFLAGS": "-L/usr/local/opt/openssl/lib",
"CFLAGS": "-ggdb -Og -g3 -fno-omit-frame-pointer"

Intro

pg_repack is a well-known tool to perform online cluster or vacuum on one or more target tables without locking them for concurrent readers and writers. Below is the description of its inner working obtained by reading the source code; it is followed by the risk assessment.

Process