Debug stolon backup

This commit is contained in:
Quentin 2021-04-15 12:38:31 +02:00
parent 9dfff86cd2
commit 87303033d1
Signed by untrusted user: quentin
GPG key ID: A98E9B769E4FF428
6 changed files with 31 additions and 4 deletions

View file

@ -16,7 +16,7 @@ EOF
echo "export sql" echo "export sql"
# note, -Fc means that postgresql compresses the output # note, -Fc means that postgresql compresses the output
export PGPASSWORD=$MATRIX_PSQL_PWD export PGPASSWORD=$MATRIX_PSQL_PWD
pg_dump -v -Fc -U $MATRIX_PSQL_USER -h datura.machine.deuxfleurs.fr -p 5433 $MATRIX_PSQL_DB | \ pg_dump -v -Fc -U $MATRIX_PSQL_USER -h 192.168.0.2 -p 5433 $MATRIX_PSQL_DB | \
age -r "$(cat /root/.ssh/id_ed25519.pub)" | \ age -r "$(cat /root/.ssh/id_ed25519.pub)" | \
ssh backuphost "cat > $TARGET_SSH_DIR/matrix/db-$(date --iso-8601=minute).gz.age" ssh backuphost "cat > $TARGET_SSH_DIR/matrix/db-$(date --iso-8601=minute).gz.age"

View file

@ -7,7 +7,7 @@ job "backup_manual_matrix" {
driver = "docker" driver = "docker"
config { config {
image = "superboum/backup_matrix:2" image = "superboum/backup_matrix:3"
volumes = [ volumes = [
"secrets/id_ed25519:/root/.ssh/id_ed25519", "secrets/id_ed25519:/root/.ssh/id_ed25519",
"secrets/id_ed25519.pub:/root/.ssh/id_ed25519.pub", "secrets/id_ed25519.pub:/root/.ssh/id_ed25519.pub",

View file

@ -108,4 +108,4 @@ services:
backup-matrix: backup-matrix:
build: build:
context: ./backup/build/backup-matrix context: ./backup/build/backup-matrix
image: superboum/backup_matrix:2 image: superboum/backup_matrix:3

View file

@ -0,0 +1,25 @@
From c4e0e967752868626772a3317a17d25d181daeda Mon Sep 17 00:00:00 2001
From: Quentin Dufour <quentin@deuxfleurs.fr>
Date: Thu, 15 Apr 2021 12:35:12 +0200
Subject: [PATCH] Add max-rate to pg_basebackup
---
internal/postgresql/postgresql.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/internal/postgresql/postgresql.go b/internal/postgresql/postgresql.go
index 00c14bc..a37a28c 100644
--- a/internal/postgresql/postgresql.go
+++ b/internal/postgresql/postgresql.go
@@ -963,7 +963,7 @@ func (p *Manager) SyncFromFollowed(followedConnParams ConnParams, replSlot strin
log.Infow("running pg_basebackup")
name := filepath.Join(p.pgBinPath, "pg_basebackup")
- args := []string{"-R", "-v", "-P", "-Xs", "-D", p.dataDir, "-d", followedConnString}
+ args := []string{"-R", "-v", "-P", "--max-rate", "5M", "-Xs", "-D", p.dataDir, "-d", followedConnString}
if replSlot != "" {
args = append(args, "--slot", replSlot)
}
--
2.30.2

View file

@ -5,6 +5,8 @@ WORKDIR /stolon
RUN git clone https://github.com/sorintlab/stolon . RUN git clone https://github.com/sorintlab/stolon .
RUN git pull && git checkout ${STOLON_VERSION} RUN git pull && git checkout ${STOLON_VERSION}
RUN go mod download RUN go mod download
COPY 0001-Add-max-rate-to-pg_basebackup.patch .
RUN git am 0001-Add-max-rate-to-pg_basebackup.patch
RUN make && chmod +x /stolon/bin/* RUN make && chmod +x /stolon/bin/*
FROM amd64/debian:stretch FROM amd64/debian:stretch

View file

@ -49,7 +49,7 @@ job "postgres9.6" {
"--store-endpoints", "http://consul.service.2.cluster.deuxfleurs.fr:8500", "--store-endpoints", "http://consul.service.2.cluster.deuxfleurs.fr:8500",
"--port", "${NOMAD_PORT_psql_proxy_port}", "--port", "${NOMAD_PORT_psql_proxy_port}",
"--listen-address", "0.0.0.0", "--listen-address", "0.0.0.0",
"--log-level", "debug" "--log-level", "info"
] ]
ports = [ "psql_proxy_port" ] ports = [ "psql_proxy_port" ]
} }