diff --git a/common/pxc-db/templates/bin/_backup.sh.tpl b/common/pxc-db/templates/bin/_backup.sh.tpl index 1cfff03eda..c93959133e 100644 --- a/common/pxc-db/templates/bin/_backup.sh.tpl +++ b/common/pxc-db/templates/bin/_backup.sh.tpl @@ -1,5 +1,9 @@ #!/bin/bash +date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") + +mkdir -p /tmp/${date} + mysqldump \ --port="${PXC_NODE_PORT}" \ --host="${PXC_NODE_NAME}" \ @@ -8,6 +12,12 @@ mysqldump \ --single-transaction \ --quick \ --all-databases \ - --source-data=1 > /tmp/dump.sql + --source-data=1 > /tmp/${date}/dump.sql + +xbstream -C /tmp -c ${date} $XBSTREAM_EXTRA_ARGS \ + | xbcloud put --parallel="$(grep -c processor /proc/cpuinfo)" --storage=s3 --md5 --s3-bucket="$S3_BUCKET" "$S3_BUCKET_PATH" 2>&1 \ + | (grep -v "error: http request failed: Couldn't resolve host name" || exit 1) + +rm -fr /tmp/${date} -sleep 3600 +sleep 600 diff --git a/common/pxc-db/values.yaml b/common/pxc-db/values.yaml index 21223d69ae..d431bffbb9 100644 --- a/common/pxc-db/values.yaml +++ b/common/pxc-db/values.yaml @@ -500,7 +500,7 @@ backup: schedule: "15 0 * * *" s3: config: - bucket: "pxc-backup-{{ .Values.global.region }}" + bucket: "pxc-logical-{{ .Values.global.region }}" prefix: "{{ .Values.name }}/" # -- Default Prometheus alerts and rules.