INT 21h

Hi, I am Vladimir Smagin, SysAdmin and Kaptain. Telegram Email / GIT / Микроблог / Thingiverse / RSS / GPG

wal-g and Postgresql

№ 10938 В разделе "Sysadmin" от March 20th, 2020,
В подшивках: , ,


Master database: postgresql-10, in production
Backup storage: minio with empty pg-walg-backup bucket

Task: Create slave postgresql-10 server with recovery

Preparing for both servers

Install wal-g binary manually or use my Ubuntu repository (install walg-lzo).

Create special script for wal-g with variables, save to /var/lib/postgresql/walg-postgresql

source /etc/profile

export WALE_S3_PREFIX="s3://pg-walg-backup/"
export AWS_S3_FORCE_PATH_STYLE="true"
export AWS_REGION=us-east-1
export PGHOST=/var/run/postgresql
export PGUSER=postgres
export PGPORT=5433

wal-g $@

It is not secure to store this file global readable. Best choice to place it in postgres home directory without read by others:

chmod 500 /var/lib/postgresql/walg-postgresql
chown postgres:postgres /var/lib/postgresql/walg-postgresql

Master server

Add to postgresql.conf:

archive_mode = on
archive_command = '/var/lib/postgresql/walg-postgresql wal-push %p'

Ok, now run backup-push to create full backup:

/var/lib/postgresql/walg-postgresql backup-push /pg_data/10/main

Slave server

Stop postgresql and remove data directory, wal-g requires empty directory before restore.

Now run:

/var/lib/postgresql/walg-postgresql backup-fetch /pgdata/10/main LATEST

Create /pgdata/10/main/recovery.conf:

standby_mode = 'on'
restore_command = 'walg-postgresql wal-fetch "%f" "%p"'

Now see logfile for wal restoring, database in recovery mode.

Нет комментариев »

Postgresql logical backup failed, pg_dump said: PQgetResult() failed

№ 10947 В разделе "Sysadmin" от March 20th, 2020,
В подшивках: , ,

You made streaming backups and restoring with walg and now trying to make logical backups.

But some shit ruined your plans:

pg_dump: Dumping the contents of table "<table>" failed: PQgetResult() failed.

Many sites suggests to enable hot_standby_feedback in postgresql.conf, but actually you need also increase max_standby_archive_delay and max_standby_streaming_delay. I set 1 hour.

Нет комментариев »

Midnight Commander (mc) golden color scheme

№ 10915 В разделе "Sysadmin" от February 16th, 2020,
В подшивках:

My own color scheme for Midnight Commander. Nicely looks only on dark backgrounds and much better with transparent backgrounds.


  • Add line export TERM=xterm-256color to the end of ~/.bashrc in your home directory
  • Place slut.ini to home directory ~/.local/share/mc/skins/slut.ini or /usr/share/mc/skins to be system-wide

Download slut.ini

Нет комментариев »

Screensaver “Flying dicks”

№ 10259 В разделе "Sysadmin" от August 30th, 2019,
В подшивках:

It looks like this

Download picture with dick

wget /wp-content/uploads/2019/08/644710-200.png -O /tmp/644710-200.png
sudo mkdir -p /usr/local/share/pixmaps/
sudo mv /tmp/644710-200.png /usr/local/share/pixmaps/644710-200.png

Create file /usr/share/applications/screensavers/floating-penis.desktop with content:

[Desktop Entry]
Name=Floating Dick
Comment=Bubbles the dicks around the screen
Exec=/usr/lib/mate-screensaver/mate-screensaver/floaters /usr/local/share/pixmaps/644710-200.png

Also check out my precious wallpapers with ponies.

Нет комментариев »

FreeLAN Ansible Playbook

№ 9746 В разделе "Sysadmin" от February 20th, 2019,
В подшивках: , ,

Playbook for fast FreeLAN VPN network deployment with following network map:

Нет комментариев »


Fortune cookie: "Jesus Christ: A common exclamation indicating surprise, disgust, anger or bewilderment." [Chaz Bufe, The American Heretic's Dictionary]