INT 21h

Hi, I am Vladimir Smagin, SysAdmin and Kaptain. Telegram Email / GIT / Thingiverse / RSS / GPG

GlusterFS as shared disk between computers

№ 11038 В разделе "Sysadmin" от June 25th, 2020,
В подшивках:

You working at home and have 2 or more computers with file server somewhere in basement? Samba is an answer to your needs, but I know you want to do some

Typically GlusterFS used in clusters with many nodes to provide stability and high speed but we made it as single node installation with many clients.

Add repository https://launchpad.net/~gluster/+archive/ubuntu/glusterfs-7 and install glusterfs-server to your home server, glusterfs-client to all client machines. Be sure hostname boroda (or whatever your server is called) added to your local DNS server.

On server create directory for files, I made /srv/glusterfs-shit

Time to gluster volume create shit boroda:/srv/glusterfs-shit force

Disable trash for your shit gluster volume set shit features.trash off

Allow local clients to connect gluster volume set shit auth.allow 192.168.1.0/24

Start u’r shit:

gluster volume start shit
gluster volume status shit

On clients you already installed client software, so just mount new volume:

mkdir /media/shit
sudo chown vlad:vlad /media/shit -R
sudo mount.glusterfs boroda:/shit /media/shit
sudo chown vlad:vlad /media/shit -R

Now try to save something and check it on all installed machines.

Make it permanent

echo 'boroda:/shit /media/shit glusterfs defaults,_netdev 0 0' | sudo tee -a /etc/fstab

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

Centralize fail2ban blacklisting with ip-blocker-db

№ 11031 В разделе "Sysadmin" от June 17th, 2020,
В подшивках: ,

My own IP storage for fail2ban. Written to blacklist fucking botnets bruteforcing my servers. It centalize information about blocks across all my servers in one single watch tower.

https://git.blindage.org/21h/ip-blocker-db

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

История провала: webdav и nginx для Windows

№ 10985. В разделе " Sysadmin " от April 25th, 2020

В подшивках: , ,

How to move snap application between computers with snapshots

№ 10960. В разделе " Sysadmin " от March 29th, 2020

В подшивках: ,

wal-g for Postgresql replication

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

Initials

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

#!/bin/bash
source /etc/profile

export AWS_ENDPOINT=http://minio.myserv.com:9000
export AWS_ACCESS_KEY_ID="KEYNAMEKEYNAMEKEYNAME"
export AWS_SECRET_ACCESS_KEY="SECRETSECRETSECRETSECRETSECRETSECRET"
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 12: recovery settings moved to postgresql.conf. To start infinite recovery create flag file /var/lib/postgresql/12/main/standby.signal.

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

Яндекс.Метрика

Fortune cookie: There once was a lady named Clair, Who posessed a magnificent pair. Or that's what I thought, Till I saw one get caught, On a thorn and begin losing air.