<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>PostgreSQL :: Ay Docs</title>
    <link>https://ops.docs.72602.space/buckup/postgresql/index.html</link>
    <description>Prerequisites alias pgk=&#39;kubectl -n database exec deployment/postgresql --&#39; 全量备份所有数据库 pgk pg_dumpall -U postgres &gt; postgresql-full-$(date +%Y%m%d).sql 备份单个数据库 pgk pg_dump -U postgres &lt;dbname&gt; &gt; &lt;dbname&gt;-$(date +%Y%m%d).sql 备份到 PVC 内 pgk sh -c &#39;pg_dumpall -U postgres &gt; /bitnami/postgresql/backup-$(date +%Y%m%d).sql&#39; 从备份文件恢复 # 全量恢复 cat postgresql-full-20260512.sql | pgk psql -U postgres # 单库恢复（先创建空库） pgk psql -U postgres -c &#34;CREATE DATABASE &lt;dbname&gt;;&#34; cat &lt;dbname&gt;-20260512.sql | pgk psql -U postgres -d &lt;dbname&gt; 定时备份（CronJob） apiVersion: batch/v1 kind: CronJob metadata: name: postgresql-backup namespace: database spec: schedule: &#34;0 3 * * *&#34; jobTemplate: spec: template: spec: containers: - name: backup image: m.daocloud.io/docker.io/bitnami/postgresql:latest command: - sh - -c - | pg_dumpall -U postgres -h postgresql \ &gt; /backup/postgresql-$(date +%Y%m%d%H%M).sql find /backup -name &#34;*.sql&#34; -mtime +7 -delete volumeMounts: - name: backup mountPath: /backup restartPolicy: Never volumes: - name: backup hostPath: path: /data/backups/postgresql</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate></lastBuildDate>
    <atom:link href="https://ops.docs.72602.space/buckup/postgresql/index.xml" rel="self" type="application/rss+xml" />
  </channel>
</rss>