{"kind": "tool", "major": "18", "item": {"slug": "pg-basebackup", "name": "pg_basebackup", "name_zh": "", "category": "\u5ba2\u6237\u7aef\u7a0b\u5e8f", "summary": "pg_basebackup \u2014 \u83b7\u53d6 PostgreSQL \u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd", "aliases": ["pg_basebackup"], "content_hash": "3e7dd8ca16f9c3d2b877a90c8e07259c8ae31c69375087c826dc9e3d51b89760", "versions": {"10": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_basebackup"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "10.23"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "26"}], "tables": [{"key": "options", "rows": [{"summary": "\u8bbe\u7f6e\u5199\u5165\u8f93\u51fa\u7684\u76ee\u6807\u76ee\u5f55\u3002\u5982\u679c\u8be5\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c pg_basebackup \u4f1a\u521b\u5efa\u5b83\uff08\u4ee5\u53ca\u6240\u6709\u7f3a\u5931\u7684\u7236\u76ee\u5f55\uff09\u3002\u5982\u679c\u8be5\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "-D directory --pgdata= directory"}}, {"summary": "\u9009\u62e9\u8f93\u51fa\u683c\u5f0f\u3002 format \u53ef\u4ee5\u662f\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "-F format --format= format"}}, {"summary": "\u4ece\u670d\u52a1\u5668\u4f20\u8f93\u6570\u636e\u7684\u6700\u5927\u901f\u7387\u3002\u5355\u4f4d\u4e3a\u6bcf\u79d2\u5343\u5b57\u8282\u3002\u4f7f\u7528\u540e\u7f00 M \u8868\u793a\u6bcf\u79d2\u5146\u5b57\u8282\u3002\u4e5f\u63a5\u53d7\u540e\u7f00 k \uff0c\u4f46\u5b83\u6ca1\u6709\u6548\u679c\u3002\u6709\u6548\u503c\u4ecb\u4e8e\u6bcf\u79d2 32 \u5343\u5b57\u8282\u548c\u6bcf\u79d2 1024 \u5146\u5b57\u8282\u4e4b\u95f4\u3002", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "-r rate --max-rate= rate"}}, {"summary": "\u5728\u8f93\u51fa\u76ee\u5f55\u4e2d\uff08\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u5219\u5728\u57fa\u7840\u5f52\u6863\u6587\u4ef6\u4e2d\uff09\u5199\u5165\u4e00\u4e2a\u6700\u5c0f\u7684 recovery.conf \uff0c\u4ee5\u4fbf\u8bbe\u7f6e\u5907\u5e93\u3002 recovery.conf \u6587\u4ef6\u4f1a\u8bb0\u5f55 pg_basebackup \u6240\u7528\u7684\u8fde\u63a5\u8bbe\u7f6e\uff0c\u4ee5\u53ca\u590d\u5236\u69fd\uff08\u5982\u679c\u6307\u5b9a\u4e86\uff09\uff0c\u4ee5\u4fbf\u6d41\u590d\u5236\u4ee5\u540e\u4f7f\u7528\u76f8\u540c\u7684\u8bbe\u7f6e\u3002", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "-R --write-recovery-conf"}}, {"summary": "\u6b64\u9009\u9879\u53ea\u80fd\u4e0e -X stream \u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u4f1a\u4f7f WAL \u6d41\u5f0f\u4f20\u8f93\u4f7f\u7528\u6307\u5b9a\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u6b64\u57fa\u7840\u5907\u4efd\u6253\u7b97\u7528\u4f5c\u4f7f\u7528\u590d\u5236\u69fd\u7684\u6d41\u590d\u5236\u5907\u5e93\uff0c\u90a3\u4e48\u8be5\u5907\u5e93\u5e94\u5728 recovery.conf \u4e2d\u4f7f\u7528\u540c\u4e00\u4e2a\u590d\u5236\u69fd\u540d\u79f0\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u670d\u52a1\u5668\u5728\u57fa\u7840\u5907\u4efd\u7ed3\u675f\u4e0e\u5f00\u59cb\u6d41\u590d\u5236\u4e4b\u95f4\u7684\u8fd9\u6bb5\u65f6\u95f4\u5185\uff0c\u4e0d\u4f1a\u79fb\u9664\u4efb\u4f55\u5fc5\u9700\u7684 WAL \u6570\u636e\u3002", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "-S slotname --slot= slotname"}}, {"summary": "\u5373\u4f7f\u670d\u52a1\u5668\u652f\u6301\uff0c\u6b64\u9009\u9879\u4e5f\u4f1a\u963b\u6b62\u5728\u5907\u4efd\u671f\u95f4\u521b\u5efa\u4e34\u65f6\u590d\u5236\u69fd\u3002", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "--no-slot"}}, {"summary": "\u5728\u5907\u4efd\u671f\u95f4\uff0c\u5c06\u76ee\u5f55 olddir \u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230 newdir \u3002\u8981\u4f7f\u6b64\u9009\u9879\u751f\u6548\uff0c olddir \u5fc5\u987b\u4e0e\u8be5\u8868\u7a7a\u95f4\u5f53\u524d\u5b9a\u4e49\u7684\u8def\u5f84\u5b8c\u5168\u4e00\u81f4\u3002\uff08\u4f46\u5982\u679c\u5907\u4efd\u4e2d\u6ca1\u6709\u4f4d\u4e8e olddir \u4e2d\u7684\u8868\u7a7a\u95f4\uff0c\u4e5f\u4e0d\u7b97\u9519\u8bef\u3002\uff09 olddir \u548c newdir \u90fd\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u5982\u679c\u8def\u5f84\u4e2d\u5305\u542b = \u7b26\u53f7\uff0c\u8bf7\u7528\u53cd\u659c\u7ebf\u8f6c\u4e49\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u4ee5\u5904\u7406\u591a\u4e2a\u8868\u7a7a\u95f4\u3002\u53c2\u89c1\u4e0b\u6587\u793a\u4f8b\u3002", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "-T olddir = newdir --tablespace-mapping= olddir = newdir"}}, {"summary": "\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\u7684\u4f4d\u7f6e\u3002 waldir \u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u53ea\u6709\u5728\u5907\u4efd\u91c7\u7528\u666e\u901a\u6587\u4ef6\u6a21\u5f0f\u65f6\uff0c\u624d\u80fd\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\u3002", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "--waldir= waldir"}}, {"summary": "\u5728\u5907\u4efd\u4e2d\u5305\u542b\u6240\u9700\u7684 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u3002\u8fd9\u5c06\u5305\u62ec\u5907\u4efd\u671f\u95f4\u751f\u6210\u7684\u6240\u6709\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u9664\u975e\u6307\u5b9a\u65b9\u6cd5 none \uff0c\u5426\u5219\u5c31\u53ef\u4ee5\u5728\u89e3\u5305\u540e\u7684\u76ee\u5f55\u4e2d\u542f\u52a8 postmaster\uff0c\u800c\u65e0\u9700\u67e5\u9605 WAL \u5f52\u6863\uff0c\u4ece\u800c\u4f7f\u8f93\u51fa\u6210\u4e3a\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u5907\u4efd\u3002", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "-X method --wal-method= method"}}, {"summary": "\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u4f7f\u7528\u9ed8\u8ba4\u538b\u7f29\u7ea7\u522b\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0 .gz \u540e\u7f00\u3002", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "-z --gzip"}}, {"summary": "\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u5e76\u6307\u5b9a\u538b\u7f29\u7ea7\u522b\uff080 \u5230 9\uff0c\u5176\u4e2d 0 \u8868\u793a\u4e0d\u538b\u7f29\uff0c9 \u8868\u793a\u6700\u4f73\u538b\u7f29\uff09\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0 .gz \u540e\u7f00\u3002", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "-Z level --compress= level"}}, {"summary": "\u5c06\u68c0\u67e5\u70b9\u6a21\u5f0f\u8bbe\u7f6e\u4e3a fast\uff08\u7acb\u5373\uff09\u6216 spread\uff08\u9ed8\u8ba4\uff09\uff08\u89c1 \u7b2c 25.3.3 \u8282 \uff09\u3002", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "-c fast|spread --checkpoint= fast|spread"}}, {"summary": "\u8bbe\u7f6e\u5907\u4efd\u6807\u7b7e\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u503c \u201c pg_basebackup base backup \u201d \u3002", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "-l label --label= label"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53 pg_basebackup \u56e0\u9519\u8bef\u4e2d\u6b62\u65f6\uff0c\u5b83\u4f1a\u5220\u9664\u5728\u53d1\u73b0\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u76ee\u5f55\uff08\u4f8b\u5982\u6570\u636e\u76ee\u5f55\u548c\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\uff09\u3002\u6b64\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u5f88\u6709\u5e2e\u52a9\u3002", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "-n --no-clean"}}, {"summary": "\u542f\u7528\u8fdb\u5ea6\u62a5\u544a\u3002\u6253\u5f00\u6b64\u9009\u9879\u540e\uff0c\u4f1a\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u7ed9\u51fa\u4e00\u4e2a\u8fd1\u4f3c\u7684\u8fdb\u5ea6\u62a5\u544a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u53d1\u751f\u53d8\u5316\uff0c\u56e0\u6b64\u8fd9\u53ea\u662f\u8fd1\u4f3c\u503c\uff0c\u6700\u7ec8\u672a\u5fc5\u6070\u597d\u7ed3\u675f\u5728 100% \u3002\u7279\u522b\u662f\u5f53\u5907\u4efd\u4e2d\u5305\u542b WAL \u65f6\uff0c\u603b\u6570\u636e\u91cf\u65e0\u6cd5\u9884\u5148\u4f30\u8ba1\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u65e6\u8fdb\u5ea6\u8d85\u8fc7\u4e0d\u542b WAL \u65f6\u7684\u603b\u4f30\u8ba1\u503c\uff0c\u4f30\u8ba1\u76ee\u6807\u5927\u5c0f\u5c31\u4f1a\u7ee7\u7eed\u589e\u52a0\u3002", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "-P --progress"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_basebackup \u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u88ab\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f1a\u4f7f pg_basebackup \u4e0d\u7ecf\u7b49\u5f85\u5c31\u76f4\u63a5\u8fd4\u56de\uff0c\u56e0\u6b64\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u968f\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u57fa\u7840\u5907\u4efd\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u5408\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "-N --no-sync"}}, {"summary": "\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\u3002\u5b83\u4f1a\u5728\u542f\u52a8\u548c\u5173\u95ed\u8fc7\u7a0b\u4e2d\u8f93\u51fa\u4e00\u4e9b\u989d\u5916\u6b65\u9aa4\uff1b\u5982\u679c\u540c\u65f6\u542f\u7528\u4e86\u8fdb\u5ea6\u62a5\u544a\uff0c\u8fd8\u4f1a\u663e\u793a\u5f53\u524d\u6b63\u5728\u5904\u7406\u7684\u786e\u5207\u6587\u4ef6\u540d\u3002", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "-v --verbose"}}, {"summary": "\u4ee5 \u8fde\u63a5\u5b57\u7b26\u4e32 \u7684\u5f62\u5f0f\u6307\u5b9a\u7528\u4e8e\u8fde\u63a5\u670d\u52a1\u5668\u7684\u53c2\u6570\uff1b\u8fd9\u4e9b\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u76f8\u4e92\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "-d connstr --dbname= connstr"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGHOST \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff1b\u5426\u5219\u4f1a\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "-h host --host= host"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u6240\u4f7f\u7528\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u4e2d\u7684\u503c\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u786e\u5b9a\u7684\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "-p port --port= port"}}, {"summary": "\u6307\u5b9a\u5411\u670d\u52a1\u5668\u56de\u9001\u72b6\u6001\u5305\u7684\u65f6\u95f4\u95f4\u9694\uff08\u79d2\uff09\u3002\u8fd9\u6837\u66f4\u4fbf\u4e8e\u4ece\u670d\u52a1\u5668\u7aef\u76d1\u89c6\u8fdb\u5ea6\u3002\u503c\u4e3a\u96f6\u5c06\u5b8c\u5168\u7981\u7528\u5468\u671f\u6027\u72b6\u6001\u66f4\u65b0\uff0c\u4e0d\u8fc7\u5728\u670d\u52a1\u5668\u8bf7\u6c42\u65f6\u4ecd\u4f1a\u53d1\u9001\u66f4\u65b0\uff0c\u4ee5\u907f\u514d\u56e0\u8d85\u65f6\u800c\u65ad\u5f00\u8fde\u63a5\u3002\u9ed8\u8ba4\u503c\u662f 10 \u79d2\u3002", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "-s interval --status-interval= interval"}}, {"summary": "\u6307\u5b9a\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "-U username --username= username"}}, {"summary": "\u7981\u6b62\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\uff08\u4f8b\u5982 .pgpass \u6587\u4ef6\uff09\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u6b64\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u79cd\u573a\u666f\u4e0b\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 pg_basebackup \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "-W --password"}}, {"summary": "\u8f93\u51fa pg_basebackup \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "-V --version"}}, {"summary": "\u663e\u793a pg_basebackup \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/10/app-pgbasebackup.html", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}], "options": [{"names": ["-D directory", "--pgdata= directory"], "summary": "Directory to write the output to. pg_basebackup will create the directory and any parent directories if necessary. The directory may already exist, but it is an error if the directory already exists and is not empty.", "signature": "-D directory --pgdata= directory", "source_url": "/docs/10/app-pgbasebackup.html", "description": "Directory to write the output to. pg_basebackup will create the directory and any parent directories if necessary. The directory may already exist, but it is an error if the directory already exists and is not empty. When the backup is in tar mode, and the directory is specified as - (dash), the tar file will be written to stdout . This option is required."}, {"names": ["-F format", "--format= format"], "summary": "Selects the format for the output. format can be one of the following:", "signature": "-F format --format= format", "source_url": "/docs/10/app-pgbasebackup.html", "description": "Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the current data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory will be written to a file named base.tar , and all other tablespaces will be named after the tablespace OID. If the value - (dash) is specified as target directory, the tar contents will be written to standard output, suitable for piping to for example gzip . This is only possible if the cluster has no additional tablespaces and WAL streaming is not used."}, {"names": ["-r rate", "--max-rate= rate"], "summary": "The maximum transfer rate of data transferred from the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second.", "signature": "-r rate --max-rate= rate", "source_url": "/docs/10/app-pgbasebackup.html", "description": "The maximum transfer rate of data transferred from the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. The purpose is to limit the impact of pg_basebackup on the running server. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch ."}, {"names": ["-R", "--write-recovery-conf"], "summary": "Write a minimal recovery.conf in the output directory (or into the base archive file when using tar format) to ease setting up a standby server. The recovery.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that the streaming replication will use the same settings later on.", "signature": "-R --write-recovery-conf", "source_url": "/docs/10/app-pgbasebackup.html", "description": "Write a minimal recovery.conf in the output directory (or into the base archive file when using tar format) to ease setting up a standby server. The recovery.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that the streaming replication will use the same settings later on."}, {"names": ["-S slotname", "--slot= slotname"], "summary": "This option can only be used together with -X stream . It causes the WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming replication standby using replication slots, it should then use the same replication slot name in recovery.conf . That way, it is ensured that the server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication.", "signature": "-S slotname --slot= slotname", "source_url": "/docs/10/app-pgbasebackup.html", "description": "This option can only be used together with -X stream . It causes the WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming replication standby using replication slots, it should then use the same replication slot name in recovery.conf . That way, it is ensured that the server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming."}, {"names": ["--no-slot"], "summary": "This option prevents the creation of a temporary replication slot during the backup even if it's supported by the server.", "signature": "--no-slot", "source_url": "/docs/10/app-pgbasebackup.html", "description": "This option prevents the creation of a temporary replication slot during the backup even if it's supported by the server. Temporary replication slots are created by default if no slot name is given with the option -S when using log streaming. The main purpose of this option is to allow taking a base backup when the server is out of free replication slots. Using replication slots is almost always preferred, because it prevents needed WAL from being removed by the server during the backup."}, {"names": ["-T olddir = newdir", "--tablespace-mapping= olddir = newdir"], "summary": "Relocate the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is currently defined. (But it is not an error if there is no tablespace in olddir contained in the backup.) Both olddir and newdir must be absolute paths. If a path happens to contain a = sign, escape it with a backslash. This option can be specified multiple times for multiple tablespaces. See examples below.", "signature": "-T olddir = newdir --tablespace-mapping= olddir = newdir", "source_url": "/docs/10/app-pgbasebackup.html", "description": "Relocate the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is currently defined. (But it is not an error if there is no tablespace in olddir contained in the backup.) Both olddir and newdir must be absolute paths. If a path happens to contain a = sign, escape it with a backslash. This option can be specified multiple times for multiple tablespaces. See examples below. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected."}, {"names": ["--waldir= waldir"], "summary": "Specifies the location for the write-ahead log directory. waldir must be an absolute path. The write-ahead log directory can only be specified when the backup is in plain mode.", "signature": "--waldir= waldir", "source_url": "/docs/10/app-pgbasebackup.html", "description": "Specifies the location for the write-ahead log directory. waldir must be an absolute path. The write-ahead log directory can only be specified when the backup is in plain mode."}, {"names": ["-X method", "--wal-method= method"], "summary": "Includes the required write-ahead log files (WAL files) in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster directly in the extracted directory without the need to consult the log archive, thus making this a completely standalone backup.", "signature": "-X method --wal-method= method", "source_url": "/docs/10/app-pgbasebackup.html", "description": "Includes the required write-ahead log files (WAL files) in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster directly in the extracted directory without the need to consult the log archive, thus making this a completely standalone backup. The following methods for collecting the write-ahead logs are supported: n none Don't include write-ahead log in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the wal_keep_segments parameter to be set high enough that the log is not removed before the end of the backup. If the log has been rotated when it's time to transfer it, the backup will fail and be unusable. When tar format mode is used, the write-ahead log files will be written to the base.tar file. s stream Stream the write-ahead log while the backup is created. This will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will use up two connections configured by the max_wal_senders parameter. As long as the client can keep up with write-ahead log received, using this mode requires no extra write-ahead logs to be saved on the master. When tar format mode is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default."}, {"names": ["-z", "--gzip"], "summary": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "signature": "-z --gzip", "source_url": "/docs/10/app-pgbasebackup.html", "description": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-Z level", "--compress= level"], "summary": "Enables gzip compression of tar file output, and specifies the compression level (0 through 9, 0 being no compression and 9 being best compression). Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "signature": "-Z level --compress= level", "source_url": "/docs/10/app-pgbasebackup.html", "description": "Enables gzip compression of tar file output, and specifies the compression level (0 through 9, 0 being no compression and 9 being best compression). Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-c fast|spread", "--checkpoint= fast|spread"], "summary": "Sets checkpoint mode to fast (immediate) or spread (default) (see Section 25.3.3 ).", "signature": "-c fast|spread --checkpoint= fast|spread", "source_url": "/docs/10/app-pgbasebackup.html", "description": "Sets checkpoint mode to fast (immediate) or spread (default) (see Section 25.3.3 )."}, {"names": ["-l label", "--label= label"], "summary": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used.", "signature": "-l label --label= label", "source_url": "/docs/10/app-pgbasebackup.html", "description": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used."}, {"names": ["-n", "--no-clean"], "summary": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, data directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging.", "signature": "-n --no-clean", "source_url": "/docs/10/app-pgbasebackup.html", "description": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, data directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way."}, {"names": ["-P", "--progress"], "summary": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.", "signature": "-P --progress", "source_url": "/docs/10/app-pgbasebackup.html", "description": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL. When this is enabled, the backup will start by enumerating the size of the entire database, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent."}, {"names": ["-N", "--no-sync"], "summary": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.", "signature": "-N --no-sync", "source_url": "/docs/10/app-pgbasebackup.html", "description": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."}, {"names": ["-v", "--verbose"], "summary": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.", "signature": "-v --verbose", "source_url": "/docs/10/app-pgbasebackup.html", "description": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."}, {"names": ["-d connstr", "--dbname= connstr"], "summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": "-d connstr --dbname= connstr", "source_url": "/docs/10/app-pgbasebackup.html", "description": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. The option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, database name in the connection string will be ignored."}, {"names": ["-h host", "--host= host"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "signature": "-h host --host= host", "source_url": "/docs/10/app-pgbasebackup.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "signature": "-p port --port= port", "source_url": "/docs/10/app-pgbasebackup.html", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-s interval", "--status-interval= interval"], "summary": "Specifies the number of seconds between status packets sent back to the server. This allows for easier monitoring of the progress from server. A value of zero disables the periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout disconnect. The default value is 10 seconds.", "signature": "-s interval --status-interval= interval", "source_url": "/docs/10/app-pgbasebackup.html", "description": "Specifies the number of seconds between status packets sent back to the server. This allows for easier monitoring of the progress from server. A value of zero disables the periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout disconnect. The default value is 10 seconds."}, {"names": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/10/app-pgbasebackup.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/10/app-pgbasebackup.html", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "summary": "Force pg_basebackup to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/10/app-pgbasebackup.html", "description": "Force pg_basebackup to prompt for a password before connecting to a database. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["-V", "--version"], "summary": "Print the pg_basebackup version and exit.", "signature": "-V --version", "source_url": "/docs/10/app-pgbasebackup.html", "description": "Print the pg_basebackup version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about pg_basebackup command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/10/app-pgbasebackup.html", "description": "Show help about pg_basebackup command line arguments, and exit."}], "related": [{"url": "/wiki/conn/?v=10", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v10.23/postgresql-10.23.tar.bz2", "label": "10.23", "major": "10", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/10/postgresql-10-A4.pdf", "bytes": 12631706, "pages": 2591, "sha256": "34497ab9efb45c5bdf1bd11b9016b5451354feb462fa029cf74557a5fa5fbbc1", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/10/postgresql-10-US.pdf", "bytes": 12531684, "pages": 2724, "sha256": "429cc7133ddf4f97c560aa466dc9caea4b718721a8321e293357037cf0af4733", "built_at": "2026-09-26"}}, "tree": "10", "index": "index.html", "major": "10", "pages": 1085, "release": "10.23", "source_url": "https://ftp.postgresql.org/pub/source/v10.23/postgresql-10.23.tar.bz2", "svg_assets": 0, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "94a4b2528372458e5662c18d406629266667c437198160a18cdfd2c4a4d6eee9"}, "revision": "f9301feba91e2e2566038a36b8cee0e4402db68989538f88670fddd20b1f78ea", "evidence_kind": "English manual and source declarations", "source_sha256": "94a4b2528372458e5662c18d406629266667c437198160a18cdfd2c4a4d6eee9"}, "sources": [{"url": "https://pg.center/docs/10/app-pgbasebackup.html", "file": "app-pgbasebackup.html", "label": "10.23 English manual \u00b7 app-pgbasebackup.html", "anchor": "", "sha256": "78d415a7754d35812c98554f42b369c4da6bfd3d369cb250a4d5b5c9f70ab0f1", "language": "en", "original_url": "/docs/10/app-pgbasebackup.html"}, {"url": "https://pg.center/docs/10/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "e4330732b6acd6c025a1fbdce45574b23d964de847a1b849ea88b98ab628d2e2", "language": "en", "original_url": "/docs/10/reference-client.html"}], "sections": [], "synopsis": ["pg_basebackup [ option ...]"], "signature": "pg_basebackup [ option ...]", "description": ["pg_basebackup \u2014 \u83b7\u53d6 PostgreSQL \u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd"], "environment": [], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGBASEBACKUP\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\">pg_basebackup</span></h2>\n<p lang=\"zh\">pg_basebackup \u2014 \u83b7\u53d6<span class=\"productname\">PostgreSQL</span>\u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.9.4.1\"><code class=\"command\">pg_basebackup</code> [<em class=\"replaceable\"><code>option</code></em>...]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.9.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u7528\u4e8e\u83b7\u53d6\u6b63\u5728\u8fd0\u884c\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd\u3002\u5907\u4efd\u8fc7\u7a0b\u4e0d\u4f1a\u5f71\u54cd\u6570\u636e\u5e93\u7684\u5176\u4ed6\u5ba2\u6237\u7aef\uff0c\u5e76\u4e14\u8be5\u5907\u4efd\u65e2\u53ef\u7528\u4e8e\u65f6\u95f4\u70b9\u6062\u590d\uff08\u89c1<a class=\"xref\" href=\"/docs/10/continuous-archiving.html\" title=\"25.3.\u00a0\u6301\u7eed\u5f52\u6863\u548c\u65f6\u95f4\u70b9\u6062\u590d\uff08PITR\uff09\">\u7b2c\u00a025.3\u00a0\u8282</a>\uff09\uff0c\u4e5f\u53ef\u7528\u4f5c\u65e5\u5fd7\u4f20\u9001\u6216\u6d41\u590d\u5236\u5907\u5e93\u7684\u8d77\u70b9\uff08\u89c1<a class=\"xref\" href=\"/docs/10/warm-standby.html\" title=\"26.2.\u00a0\u65e5\u5fd7\u4f20\u9001\u5907\u5e93\">\u7b2c\u00a026.2\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u6587\u4ef6\u7684\u4e8c\u8fdb\u5236\u526f\u672c\uff0c\u540c\u65f6\u786e\u4fdd\u7cfb\u7edf\u81ea\u52a8\u8fdb\u5165\u548c\u9000\u51fa\u5907\u4efd\u6a21\u5f0f\u3002\u5907\u4efd\u59cb\u7ec8\u9488\u5bf9\u6574\u4e2a\u6570\u636e\u5e93\u96c6\u7c07\uff1b\u65e0\u6cd5\u53ea\u5907\u4efd\u5355\u4e2a\u6570\u636e\u5e93\u6216\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u8981\u5907\u4efd\u5355\u4e2a\u6570\u636e\u5e93\uff0c\u5fc5\u987b\u4f7f\u7528<a class=\"xref\" href=\"/docs/10/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a>\u4e4b\u7c7b\u7684\u5de5\u5177\u3002</p>\n<p lang=\"zh\">\u5907\u4efd\u901a\u8fc7\u4f7f\u7528\u590d\u5236\u534f\u8bae\u7684\u666e\u901a<span class=\"productname\">PostgreSQL</span>\u8fde\u63a5\u8fdb\u884c\u3002\u5efa\u7acb\u8fde\u63a5\u65f6\u5fc5\u987b\u4f7f\u7528\u8d85\u7ea7\u7528\u6237\u6216\u5177\u6709<code class=\"literal\">REPLICATION</code>\u6743\u9650\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/10/role-attributes.html\" title=\"21.2.\u00a0\u89d2\u8272\u5c5e\u6027\">\u7b2c\u00a021.2\u00a0\u8282</a>\uff09\u7684\u7528\u6237\uff0c\u5e76\u4e14<code class=\"filename\">pg_hba.conf</code>\u5fc5\u987b\u660e\u786e\u5141\u8bb8\u590d\u5236\u8fde\u63a5\u3002\u670d\u52a1\u5668\u8fd8\u5fc5\u987b\u5c06<a class=\"xref\" href=\"/docs/10/runtime-config-replication.html#GUC-MAX-WAL-SENDERS\">max_wal_senders</a>\u8bbe\u7f6e\u5f97\u8db3\u591f\u9ad8\uff0c\u4ee5\u4fbf\u81f3\u5c11\u4e3a\u5907\u4efd\u4fdd\u7559\u4e00\u4e2a\u53ef\u7528\u4f1a\u8bdd\uff0c\u5e76\u5728\u4f7f\u7528 WAL \u6d41\u5f0f\u4f20\u8f93\u65f6\u518d\u4e3a\u5176\u4fdd\u7559\u4e00\u4e2a\u4f1a\u8bdd\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u540c\u65f6\u8fd0\u884c\u591a\u4e2a<code class=\"command\">pg_basebackup</code>\uff0c\u4f46\u4ece\u6027\u80fd\u89d2\u5ea6\u6765\u770b\uff0c\u6700\u597d\u53ea\u6267\u884c\u4e00\u6b21\u5907\u4efd\uff0c\u7136\u540e\u590d\u5236\u5176\u7ed3\u679c\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u4e0d\u4ec5\u53ef\u4ee5\u4ece\u4e3b\u5e93\u83b7\u53d6\u57fa\u7840\u5907\u4efd\uff0c\u4e5f\u53ef\u4ee5\u4ece\u5907\u5e93\u83b7\u53d6\u3002\u8981\u4ece\u5907\u5e93\u83b7\u53d6\u5907\u4efd\uff0c\u9700\u8981\u5c06\u5907\u5e93\u914d\u7f6e\u4e3a\u80fd\u591f\u63a5\u53d7\u590d\u5236\u8fde\u63a5\uff08\u5373\u8bbe\u7f6e<code class=\"varname\">max_wal_senders</code>\u548c<a class=\"xref\" href=\"/docs/10/runtime-config-replication.html#GUC-HOT-STANDBY\">hot_standby</a>\uff0c\u5e76\u914d\u7f6e<a class=\"link\" href=\"/docs/10/client-authentication.html#AUTH-PG-HBA-CONF\" title=\"20.1.\u00a0pg_hba.conf \u6587\u4ef6\">\u57fa\u4e8e\u4e3b\u673a\u7684\u8ba4\u8bc1</a>\uff09\u3002\u8fd8\u9700\u8981\u5728\u4e3b\u5e93\u4e0a\u542f\u7528<a class=\"xref\" href=\"/docs/10/runtime-config-wal.html#GUC-FULL-PAGE-WRITES\">full_page_writes</a>\u3002</p>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u4ece\u5907\u5e93\u83b7\u53d6\u5728\u7ebf\u5907\u4efd\u65f6\u6709\u4e00\u4e9b\u9650\u5236\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5907\u4efd\u5386\u53f2\u6587\u4ef6\u4e0d\u4f1a\u5728\u88ab\u5907\u4efd\u7684\u6570\u636e\u5e93\u96c6\u7c07\u4e2d\u521b\u5efa\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">pg_basebackup</span>\u65e0\u6cd5\u5f3a\u5236\u5907\u5e93\u5728\u5907\u4efd\u7ed3\u675f\u65f6\u5207\u6362\u5230\u65b0\u7684 WAL \u6587\u4ef6\u3002\u5f53\u4f7f\u7528<code class=\"literal\">-X none</code>\u65f6\uff0c\u5982\u679c\u4e3b\u5e93\u4e0a\u7684\u5199\u5165\u6d3b\u52a8\u8f83\u5c11\uff0c<span class=\"application\">pg_basebackup</span>\u53ef\u80fd\u9700\u8981\u957f\u65f6\u95f4\u7b49\u5f85\uff0c\u76f4\u5230\u5907\u4efd\u6240\u9700\u7684\u6700\u540e\u4e00\u4e2a WAL \u6587\u4ef6\u88ab\u5207\u6362\u5e76\u5f52\u6863\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5728\u4e3b\u5e93\u4e0a\u8fd0\u884c<code class=\"function\">pg_switch_wal</code>\uff0c\u4ee5\u7acb\u5373\u89e6\u53d1 WAL \u6587\u4ef6\u5207\u6362\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5982\u679c\u5907\u5e93\u5728\u5728\u7ebf\u5907\u4efd\u8fc7\u7a0b\u4e2d\u88ab\u63d0\u5347\u4e3a\u4e3b\u5e93\uff0c\u5219\u5907\u4efd\u4f1a\u5931\u8d25\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5907\u4efd\u6240\u9700\u7684\u6240\u6709 WAL \u8bb0\u5f55\u90fd\u5fc5\u987b\u5305\u542b\u8db3\u591f\u7684\u6574\u9875\u5199\u5165\uff0c\u56e0\u6b64\u5fc5\u987b\u5728\u4e3b\u5e93\u4e0a\u542f\u7528<code class=\"varname\">full_page_writes</code>\uff0c\u5e76\u4e14\u4e0d\u80fd\u628a<span class=\"application\">pg_compresslog</span>\u4e4b\u7c7b\u7684\u5de5\u5177\u7528\u4f5c<code class=\"varname\">archive_command</code>\uff0c\u4ece WAL \u6587\u4ef6\u4e2d\u79fb\u9664\u6574\u9875\u5199\u5165\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.9.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u8f93\u51fa\u7684\u4f4d\u7f6e\u548c\u683c\u5f0f\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>directory</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u5199\u5165\u8f93\u51fa\u7684\u76ee\u6807\u76ee\u5f55\u3002\u5982\u679c\u8be5\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u521b\u5efa\u5b83\uff08\u4ee5\u53ca\u6240\u6709\u7f3a\u5931\u7684\u7236\u76ee\u5f55\uff09\u3002\u5982\u679c\u8be5\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002</p>\n<p lang=\"zh\">\u5f53\u5907\u4efd\u91c7\u7528 tar \u683c\u5f0f\u65f6\uff0c\u76ee\u6807\u76ee\u5f55\u53ef\u4ee5\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff08\u77ed\u6a2a\u7ebf\uff09\uff0c\u4ece\u800c\u5c06 tar \u6587\u4ef6\u5199\u5230<code class=\"literal\">stdout</code>\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u662f\u5fc5\u9700\u7684\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>format</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--format=<em class=\"replaceable\"><code>format</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u9009\u62e9\u8f93\u51fa\u683c\u5f0f\u3002<em class=\"replaceable\"><code>format</code></em>\u53ef\u4ee5\u662f\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">p</code><br/></span><span class=\"term\"><code class=\"literal\">plain</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u5199\u4e3a\u666e\u901a\u6587\u4ef6\uff0c\u5176\u5e03\u5c40\u4e0e\u6e90\u670d\u52a1\u5668\u7684\u6570\u636e\u76ee\u5f55\u548c\u8868\u7a7a\u95f4\u76f8\u540c\u3002\u5f53\u96c6\u7c07\u6ca1\u6709\u989d\u5916\u8868\u7a7a\u95f4\u65f6\uff0c\u6574\u4e2a\u6570\u636e\u5e93\u90fd\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u3002\u5982\u679c\u96c6\u7c07\u5305\u542b\u989d\u5916\u8868\u7a7a\u95f4\uff0c\u5219\u4e3b\u6570\u636e\u76ee\u5f55\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\uff0c\u800c\u5176\u4ed6\u6240\u6709\u8868\u7a7a\u95f4\u90fd\u4f1a\u653e\u5728\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u76f8\u540c\u7684\u7edd\u5bf9\u8def\u5f84\u4e2d\u3002\uff08\u5982\u9700\u6539\u53d8\u8fd9\u4e00\u70b9\uff0c\u89c1<code class=\"option\">--tablespace-mapping</code>\u3002\uff09</p>\n<p lang=\"zh\">\u8fd9\u662f\u9ed8\u8ba4\u683c\u5f0f\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">t</code><br/></span><span class=\"term\"><code class=\"literal\">tar</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u5199\u4e3a\u76ee\u6807\u76ee\u5f55\u4e2d\u7684 tar \u6587\u4ef6\u3002\u4e3b\u6570\u636e\u76ee\u5f55\u7684\u5185\u5bb9\u4f1a\u5199\u5165\u540d\u4e3a<code class=\"filename\">base.tar</code>\u7684\u6587\u4ef6\u4e2d\uff0c\u800c\u6bcf\u4e2a\u5176\u4ed6\u8868\u7a7a\u95f4\u90fd\u4f1a\u5199\u5165\u4e00\u4e2a\u4ee5\u8be5\u8868\u7a7a\u95f4 OID \u547d\u540d\u7684\u72ec\u7acb tar \u6587\u4ef6\u4e2d\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u76ee\u6807\u76ee\u5f55\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff08\u77ed\u6a2a\u7ebf\uff09\uff0ctar \u5185\u5bb9\u5c06\u5199\u5165\u6807\u51c6\u8f93\u51fa\uff0c\u9002\u5408\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u4f8b\u5982<span class=\"productname\">gzip</span>\u3002\u53ea\u6709\u5f53\u96c6\u7c07\u6ca1\u6709\u989d\u5916\u8868\u7a7a\u95f4\u4e14\u672a\u4f7f\u7528 WAL \u6d41\u5f0f\u4f20\u8f93\u65f6\uff0c\u624d\u5141\u8bb8\u8fd9\u6837\u505a\u3002</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r <em class=\"replaceable\"><code>rate</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--max-rate=<em class=\"replaceable\"><code>rate</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ece\u670d\u52a1\u5668\u4f20\u8f93\u6570\u636e\u7684\u6700\u5927\u901f\u7387\u3002\u5355\u4f4d\u4e3a\u6bcf\u79d2\u5343\u5b57\u8282\u3002\u4f7f\u7528\u540e\u7f00<code class=\"literal\">M</code>\u8868\u793a\u6bcf\u79d2\u5146\u5b57\u8282\u3002\u4e5f\u63a5\u53d7\u540e\u7f00<code class=\"literal\">k</code>\uff0c\u4f46\u5b83\u6ca1\u6709\u6548\u679c\u3002\u6709\u6548\u503c\u4ecb\u4e8e\u6bcf\u79d2 32 \u5343\u5b57\u8282\u548c\u6bcf\u79d2 1024 \u5146\u5b57\u8282\u4e4b\u95f4\u3002</p>\n<p lang=\"zh\">\u76ee\u7684\u662f\u9650\u5236<span class=\"application\">pg_basebackup</span>\u5bf9\u8fd0\u884c\u4e2d\u7684\u670d\u52a1\u5668\u7684\u5f71\u54cd\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u59cb\u7ec8\u5f71\u54cd\u6570\u636e\u76ee\u5f55\u7684\u4f20\u8f93\u3002\u53ea\u6709\u5f53\u6536\u96c6\u65b9\u6cd5\u4e3a<code class=\"literal\">fetch</code>\u65f6\uff0cWAL \u6587\u4ef6\u7684\u4f20\u8f93\u624d\u4f1a\u53d7\u5230\u5f71\u54cd\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code><br/></span><span class=\"term\"><code class=\"option\">--write-recovery-conf</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8f93\u51fa\u76ee\u5f55\u4e2d\uff08\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u5219\u5728\u57fa\u7840\u5f52\u6863\u6587\u4ef6\u4e2d\uff09\u5199\u5165\u4e00\u4e2a\u6700\u5c0f\u7684<code class=\"filename\">recovery.conf</code>\uff0c\u4ee5\u4fbf\u8bbe\u7f6e\u5907\u5e93\u3002<code class=\"filename\">recovery.conf</code>\u6587\u4ef6\u4f1a\u8bb0\u5f55<span class=\"application\">pg_basebackup</span>\u6240\u7528\u7684\u8fde\u63a5\u8bbe\u7f6e\uff0c\u4ee5\u53ca\u590d\u5236\u69fd\uff08\u5982\u679c\u6307\u5b9a\u4e86\uff09\uff0c\u4ee5\u4fbf\u6d41\u590d\u5236\u4ee5\u540e\u4f7f\u7528\u76f8\u540c\u7684\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>slotname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--slot=<em class=\"replaceable\"><code>slotname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u53ea\u80fd\u4e0e<code class=\"literal\">-X stream</code>\u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u4f1a\u4f7f WAL \u6d41\u5f0f\u4f20\u8f93\u4f7f\u7528\u6307\u5b9a\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u6b64\u57fa\u7840\u5907\u4efd\u6253\u7b97\u7528\u4f5c\u4f7f\u7528\u590d\u5236\u69fd\u7684\u6d41\u590d\u5236\u5907\u5e93\uff0c\u90a3\u4e48\u8be5\u5907\u5e93\u5e94\u5728<code class=\"filename\">recovery.conf</code>\u4e2d\u4f7f\u7528\u540c\u4e00\u4e2a\u590d\u5236\u69fd\u540d\u79f0\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u670d\u52a1\u5668\u5728\u57fa\u7840\u5907\u4efd\u7ed3\u675f\u4e0e\u5f00\u59cb\u6d41\u590d\u5236\u4e4b\u95f4\u7684\u8fd9\u6bb5\u65f6\u95f4\u5185\uff0c\u4e0d\u4f1a\u79fb\u9664\u4efb\u4f55\u5fc5\u9700\u7684 WAL \u6570\u636e\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5e76\u4e14\u670d\u52a1\u5668\u652f\u6301\u4e34\u65f6\u590d\u5236\u69fd\uff0810 \u53ca\u4ee5\u4e0a\u7248\u672c\uff09\uff0c\u5219\u4f1a\u81ea\u52a8\u4f7f\u7528\u4e34\u65f6\u590d\u5236\u69fd\u8fdb\u884c WAL \u6d41\u5f0f\u4f20\u8f93\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-slot</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5373\u4f7f\u670d\u52a1\u5668\u652f\u6301\uff0c\u6b64\u9009\u9879\u4e5f\u4f1a\u963b\u6b62\u5728\u5907\u4efd\u671f\u95f4\u521b\u5efa\u4e34\u65f6\u590d\u5236\u69fd\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u9009\u62e9\u4e86 WAL \u6d41\u5f0f\u4f20\u8f93\uff0c\u4f46\u6ca1\u6709\u4f7f\u7528<code class=\"option\">-S</code>\u9009\u9879\u7ed9\u51fa\u69fd\u540d\uff0c\u90a3\u4e48\u4f1a\u521b\u5efa\u4e00\u4e2a\u4e34\u65f6\u590d\u5236\u69fd\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7684\u4e3b\u8981\u76ee\u7684\u662f\u5728\u670d\u52a1\u5668\u6ca1\u6709\u7a7a\u95f2\u590d\u5236\u69fd\u65f6\uff0c\u4ecd\u7136\u5141\u8bb8\u6267\u884c\u57fa\u7840\u5907\u4efd\u3002\u51e0\u4e4e\u603b\u662f\u9996\u9009\u4f7f\u7528\u590d\u5236\u69fd\uff0c\u56e0\u4e3a\u5b83\u80fd\u9632\u6b62\u670d\u52a1\u5668\u5728\u5907\u4efd\u671f\u95f4\u79fb\u9664\u6240\u9700\u7684 WAL\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>olddir</code></em>=<em class=\"replaceable\"><code>newdir</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--tablespace-mapping=<em class=\"replaceable\"><code>olddir</code></em>=<em class=\"replaceable\"><code>newdir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u671f\u95f4\uff0c\u5c06\u76ee\u5f55<em class=\"replaceable\"><code>olddir</code></em>\u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230<em class=\"replaceable\"><code>newdir</code></em>\u3002\u8981\u4f7f\u6b64\u9009\u9879\u751f\u6548\uff0c<em class=\"replaceable\"><code>olddir</code></em>\u5fc5\u987b\u4e0e\u8be5\u8868\u7a7a\u95f4\u5f53\u524d\u5b9a\u4e49\u7684\u8def\u5f84\u5b8c\u5168\u4e00\u81f4\u3002\uff08\u4f46\u5982\u679c\u5907\u4efd\u4e2d\u6ca1\u6709\u4f4d\u4e8e<em class=\"replaceable\"><code>olddir</code></em>\u4e2d\u7684\u8868\u7a7a\u95f4\uff0c\u4e5f\u4e0d\u7b97\u9519\u8bef\u3002\uff09<em class=\"replaceable\"><code>olddir</code></em>\u548c<em class=\"replaceable\"><code>newdir</code></em>\u90fd\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u5982\u679c\u8def\u5f84\u4e2d\u5305\u542b<code class=\"literal\">=</code>\u7b26\u53f7\uff0c\u8bf7\u7528\u53cd\u659c\u7ebf\u8f6c\u4e49\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u4ee5\u5904\u7406\u591a\u4e2a\u8868\u7a7a\u95f4\u3002\u53c2\u89c1\u4e0b\u6587\u793a\u4f8b\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u91cd\u5b9a\u4f4d\u8868\u7a7a\u95f4\uff0c\u4e3b\u6570\u636e\u76ee\u5f55\u4e2d\u7684\u7b26\u53f7\u94fe\u63a5\u5c06\u88ab\u66f4\u65b0\u4e3a\u6307\u5411\u65b0\u4f4d\u7f6e\u3002\u56e0\u6b64\uff0c\u65b0\u6570\u636e\u76ee\u5f55\u5df2\u53ef\u76f4\u63a5\u7528\u4e8e\u542f\u52a8\u4e00\u4e2a\u6240\u6709\u8868\u7a7a\u95f4\u90fd\u4f4d\u4e8e\u66f4\u65b0\u540e\u4f4d\u7f6e\u7684\u65b0\u670d\u52a1\u5668\u5b9e\u4f8b\u3002</p>\n<p lang=\"zh\">\u76ee\u524d\uff0c\u6b64\u9009\u9879\u4ec5\u9002\u7528\u4e8e\u666e\u901a\u6587\u4ef6\u8f93\u51fa\u683c\u5f0f\uff1b\u5982\u679c\u9009\u62e9\u4e86 tar \u683c\u5f0f\uff0c\u5219\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--waldir=<em class=\"replaceable\"><code>waldir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\u7684\u4f4d\u7f6e\u3002<em class=\"replaceable\"><code>waldir</code></em>\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u53ea\u6709\u5728\u5907\u4efd\u91c7\u7528\u666e\u901a\u6587\u4ef6\u6a21\u5f0f\u65f6\uff0c\u624d\u80fd\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-X <em class=\"replaceable\"><code>method</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--wal-method=<em class=\"replaceable\"><code>method</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u4e2d\u5305\u542b\u6240\u9700\u7684 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u3002\u8fd9\u5c06\u5305\u62ec\u5907\u4efd\u671f\u95f4\u751f\u6210\u7684\u6240\u6709\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u9664\u975e\u6307\u5b9a\u65b9\u6cd5<code class=\"literal\">none</code>\uff0c\u5426\u5219\u5c31\u53ef\u4ee5\u5728\u89e3\u5305\u540e\u7684\u76ee\u5f55\u4e2d\u542f\u52a8 postmaster\uff0c\u800c\u65e0\u9700\u67e5\u9605 WAL \u5f52\u6863\uff0c\u4ece\u800c\u4f7f\u8f93\u51fa\u6210\u4e3a\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u5907\u4efd\u3002</p>\n<p lang=\"zh\">\u652f\u6301\u4ee5\u4e0b\u6536\u96c6\u9884\u5199\u5f0f\u65e5\u5fd7\u7684\u65b9\u6cd5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">n</code><br/></span><span class=\"term\"><code class=\"literal\">none</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u5728\u5907\u4efd\u4e2d\u5305\u542b\u9884\u5199\u5f0f\u65e5\u5fd7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">f</code><br/></span><span class=\"term\"><code class=\"literal\">fetch</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u7ed3\u675f\u65f6\u6536\u96c6\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u3002\u56e0\u6b64\uff0c<a class=\"xref\" href=\"/docs/10/runtime-config-replication.html#GUC-WAL-KEEP-SEGMENTS\">wal_keep_segments</a>\u53c2\u6570\u5fc5\u987b\u8bbe\u7f6e\u5f97\u8db3\u591f\u9ad8\uff0c\u4ee5\u786e\u4fdd\u5728\u5907\u4efd\u7ed3\u675f\u524d\u4e0d\u4f1a\u79fb\u9664\u6240\u9700\u7684\u65e5\u5fd7\u6570\u636e\u3002\u5982\u679c\u5728\u4f20\u8f93\u8fd9\u4e9b\u6570\u636e\u4e4b\u524d\u5b83\u4eec\u5df2\u7ecf\u88ab\u56de\u6536\uff0c\u5219\u5907\u4efd\u4f1a\u5931\u8d25\u5e76\u4e14\u65e0\u6cd5\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u4f1a\u5305\u542b\u5728<code class=\"filename\">base.tar</code>\u6587\u4ef6\u4e2d\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">s</code><br/></span><span class=\"term\"><code class=\"literal\">stream</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u521b\u5efa\u5907\u4efd\u7684\u540c\u65f6\u6d41\u5f0f\u4f20\u8f93\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u8fd9\u4f1a\u6253\u5f00\u4e0e\u670d\u52a1\u5668\u7684\u7b2c\u4e8c\u4e2a\u8fde\u63a5\uff0c\u5e76\u5728\u6267\u884c\u5907\u4efd\u65f6\u5e76\u884c\u5f00\u59cb\u6d41\u5f0f\u4f20\u8f93\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u56e0\u6b64\uff0c\u5b83\u4f1a\u5360\u7528\u7531<a class=\"xref\" href=\"/docs/10/runtime-config-replication.html#GUC-MAX-WAL-SENDERS\">max_wal_senders</a>\u53c2\u6570\u914d\u7f6e\u7684\u4e24\u4e2a\u8fde\u63a5\u3002\u53ea\u8981\u5ba2\u6237\u7aef\u80fd\u591f\u8ddf\u4e0a\u63a5\u6536\u5230\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\uff0c\u4f7f\u7528\u6b64\u6a21\u5f0f\u5c31\u4e0d\u9700\u8981\u5728\u4e3b\u5e93\u4e0a\u989d\u5916\u4fdd\u7559\u9884\u5199\u5f0f\u65e5\u5fd7\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u4f1a\u5199\u5165\u4e00\u4e2a\u540d\u4e3a<code class=\"filename\">pg_wal.tar</code>\u7684\u72ec\u7acb\u6587\u4ef6\u4e2d\uff08\u5982\u679c\u670d\u52a1\u5668\u7248\u672c\u65e9\u4e8e 10\uff0c\u5219\u6587\u4ef6\u540d\u4e3a<code class=\"filename\">pg_xlog.tar</code>\uff09\u3002</p>\n<p lang=\"zh\">\u8fd9\u662f\u9ed8\u8ba4\u503c\u3002</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-z</code><br/></span><span class=\"term\"><code class=\"option\">--gzip</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u4f7f\u7528\u9ed8\u8ba4\u538b\u7f29\u7ea7\u522b\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0<code class=\"filename\">.gz</code>\u540e\u7f00\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-Z <em class=\"replaceable\"><code>level</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--compress=<em class=\"replaceable\"><code>level</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u5e76\u6307\u5b9a\u538b\u7f29\u7ea7\u522b\uff080 \u5230 9\uff0c\u5176\u4e2d 0 \u8868\u793a\u4e0d\u538b\u7f29\uff0c9 \u8868\u793a\u6700\u4f73\u538b\u7f29\uff09\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0<code class=\"filename\">.gz</code>\u540e\u7f00\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u5907\u4efd\u7684\u751f\u6210\u548c\u7a0b\u5e8f\u7684\u8fd0\u884c\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>fast|spread</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--checkpoint=<em class=\"replaceable\"><code>fast|spread</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u68c0\u67e5\u70b9\u6a21\u5f0f\u8bbe\u7f6e\u4e3a fast\uff08\u7acb\u5373\uff09\u6216 spread\uff08\u9ed8\u8ba4\uff09\uff08\u89c1<a class=\"xref\" href=\"/docs/10/continuous-archiving.html#BACKUP-LOWLEVEL-BASE-BACKUP\" title=\"25.3.3.\u00a0\u4f7f\u7528\u4f4e\u7ea7 API \u8fdb\u884c\u57fa\u7840\u5907\u4efd\">\u7b2c\u00a025.3.3\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>label</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--label=<em class=\"replaceable\"><code>label</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5907\u4efd\u6807\u7b7e\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u503c<span class=\"quote\">\u201c<span class=\"quote\"><code class=\"literal\">pg_basebackup base backup</code></span>\u201d</span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-clean</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53<code class=\"command\">pg_basebackup</code>\u56e0\u9519\u8bef\u4e2d\u6b62\u65f6\uff0c\u5b83\u4f1a\u5220\u9664\u5728\u53d1\u73b0\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u76ee\u5f55\uff08\u4f8b\u5982\u6570\u636e\u76ee\u5f55\u548c\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\uff09\u3002\u6b64\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u5f88\u6709\u5e2e\u52a9\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u65e0\u8bba\u662f\u5426\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u8868\u7a7a\u95f4\u76ee\u5f55\u90fd\u4e0d\u4f1a\u88ab\u6e05\u7406\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P</code><br/></span><span class=\"term\"><code class=\"option\">--progress</code></span></dt>\n<dd>\n<p lang=\"zh\">\u542f\u7528\u8fdb\u5ea6\u62a5\u544a\u3002\u6253\u5f00\u6b64\u9009\u9879\u540e\uff0c\u4f1a\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u7ed9\u51fa\u4e00\u4e2a\u8fd1\u4f3c\u7684\u8fdb\u5ea6\u62a5\u544a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u53d1\u751f\u53d8\u5316\uff0c\u56e0\u6b64\u8fd9\u53ea\u662f\u8fd1\u4f3c\u503c\uff0c\u6700\u7ec8\u672a\u5fc5\u6070\u597d\u7ed3\u675f\u5728<code class=\"literal\">100%</code>\u3002\u7279\u522b\u662f\u5f53\u5907\u4efd\u4e2d\u5305\u542b WAL \u65f6\uff0c\u603b\u6570\u636e\u91cf\u65e0\u6cd5\u9884\u5148\u4f30\u8ba1\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u65e6\u8fdb\u5ea6\u8d85\u8fc7\u4e0d\u542b WAL \u65f6\u7684\u603b\u4f30\u8ba1\u503c\uff0c\u4f30\u8ba1\u76ee\u6807\u5927\u5c0f\u5c31\u4f1a\u7ee7\u7eed\u589e\u52a0\u3002</p>\n<p lang=\"zh\">\u542f\u7528\u6b64\u9009\u9879\u540e\uff0c\u5907\u4efd\u4f1a\u5148\u904d\u5386\u6574\u4e2a\u6570\u636e\u5e93\u4ee5\u7edf\u8ba1\u5176\u5927\u5c0f\uff0c\u7136\u540e\u518d\u8fd4\u56de\u53d1\u9001\u5b9e\u9645\u5185\u5bb9\u3002\u8fd9\u53ef\u80fd\u4f7f\u5907\u4efd\u7a0d\u5fae\u8017\u65f6\u66f4\u957f\uff0c\u5c24\u5176\u4f1a\u4f7f\u9996\u6b21\u53d1\u9001\u6570\u636e\u4e4b\u524d\u7684\u7b49\u5f85\u65f6\u95f4\u66f4\u957f\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N</code><br/></span><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">pg_basebackup</code>\u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u88ab\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f1a\u4f7f<code class=\"command\">pg_basebackup</code>\u4e0d\u7ecf\u7b49\u5f85\u5c31\u76f4\u63a5\u8fd4\u56de\uff0c\u56e0\u6b64\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u968f\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u57fa\u7840\u5907\u4efd\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u5408\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\u3002\u5b83\u4f1a\u5728\u542f\u52a8\u548c\u5173\u95ed\u8fc7\u7a0b\u4e2d\u8f93\u51fa\u4e00\u4e9b\u989d\u5916\u6b65\u9aa4\uff1b\u5982\u679c\u540c\u65f6\u542f\u7528\u4e86\u8fdb\u5ea6\u62a5\u544a\uff0c\u8fd8\u4f1a\u663e\u793a\u5f53\u524d\u6b63\u5728\u5904\u7406\u7684\u786e\u5207\u6587\u4ef6\u540d\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u6570\u636e\u5e93\u8fde\u63a5\u53c2\u6570\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>connstr</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>connstr</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ee5<a class=\"link\" href=\"/docs/10/libpq.html#LIBPQ-CONNSTRING\" title=\"33.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u7684\u5f62\u5f0f\u6307\u5b9a\u7528\u4e8e\u8fde\u63a5\u670d\u52a1\u5668\u7684\u53c2\u6570\uff1b\u8fd9\u4e9b\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u76f8\u4e92\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u51fa\u4e8e\u4e0e\u5176\u4ed6\u5ba2\u6237\u7aef\u5e94\u7528\u4fdd\u6301\u4e00\u81f4\u7684\u8003\u8651\uff0c\u6b64\u9009\u9879\u540d\u4e3a<code class=\"literal\">--dbname</code>\uff1b\u4f46\u7531\u4e8e<span class=\"application\">pg_basebackup</span>\u5e76\u4e0d\u8fde\u63a5\u5230\u96c6\u7c07\u4e2d\u7684\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u4e2d\u7684\u6570\u636e\u5e93\u540d\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea<code class=\"envar\">PGHOST</code>\u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff1b\u5426\u5219\u4f1a\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u6240\u4f7f\u7528\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u4f7f\u7528<code class=\"envar\">PGPORT</code>\u73af\u5883\u53d8\u91cf\u4e2d\u7684\u503c\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u786e\u5b9a\u7684\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s <em class=\"replaceable\"><code>interval</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--status-interval=<em class=\"replaceable\"><code>interval</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5411\u670d\u52a1\u5668\u56de\u9001\u72b6\u6001\u5305\u7684\u65f6\u95f4\u95f4\u9694\uff08\u79d2\uff09\u3002\u8fd9\u6837\u66f4\u4fbf\u4e8e\u4ece\u670d\u52a1\u5668\u7aef\u76d1\u89c6\u8fdb\u5ea6\u3002\u503c\u4e3a\u96f6\u5c06\u5b8c\u5168\u7981\u7528\u5468\u671f\u6027\u72b6\u6001\u66f4\u65b0\uff0c\u4e0d\u8fc7\u5728\u670d\u52a1\u5668\u8bf7\u6c42\u65f6\u4ecd\u4f1a\u53d1\u9001\u66f4\u65b0\uff0c\u4ee5\u907f\u514d\u56e0\u8d85\u65f6\u800c\u65ad\u5f00\u8fde\u63a5\u3002\u9ed8\u8ba4\u503c\u662f 10 \u79d2\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7981\u6b62\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\uff08\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff09\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u6b64\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u79cd\u573a\u666f\u4e0b\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236<span class=\"application\">pg_basebackup</span>\u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7edd\u975e\u5fc5\u9700\uff0c\u56e0\u4e3a\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u81ea\u52a8\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\u6765\u53d1\u73b0\u670d\u52a1\u5668\u9700\u8981\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u8f93\u5165<code class=\"option\">-W</code>\u4ee5\u907f\u514d\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u662f\u503c\u5f97\u7684\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5176\u4ed6\u9009\u9879\u4e5f\u53ef\u7528\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa<span class=\"application\">pg_basebackup</span>\u7684\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"application\">pg_basebackup</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.9.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6<span class=\"productname\">PostgreSQL</span>\u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528<span class=\"application\">libpq</span>\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/10/libpq-envars.html\" title=\"33.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a033.14\u00a0\u8282</a>\uff09\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.9.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u5728\u5907\u4efd\u5f00\u59cb\u65f6\uff0c\u9700\u8981\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u6267\u884c\u4e00\u6b21\u68c0\u67e5\u70b9\u3002\u8fd9\u53ef\u80fd\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\uff08\u5c24\u5176\u662f\u5728\u672a\u4f7f\u7528<code class=\"literal\">--checkpoint=fast</code>\u9009\u9879\u65f6\uff09\uff1b\u5728\u6b64\u671f\u95f4\uff0c<span class=\"application\">pg_basebackup</span>\u770b\u8d77\u6765\u4f1a\u5904\u4e8e\u7a7a\u95f2\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u5907\u4efd\u5c06\u5305\u62ec\u6570\u636e\u76ee\u5f55\u548c\u8868\u7a7a\u95f4\u4e2d\u7684\u6240\u6709\u6587\u4ef6\uff0c\u5305\u62ec\u914d\u7f6e\u6587\u4ef6\u4ee5\u53ca\u7b2c\u4e09\u65b9\u653e\u5728\u8fd9\u4e9b\u76ee\u5f55\u4e2d\u7684\u4efb\u4f55\u989d\u5916\u6587\u4ef6\uff0c\u4f46\u7531 PostgreSQL \u7ba1\u7406\u7684\u67d0\u4e9b\u4e34\u65f6\u6587\u4ef6\u9664\u5916\u3002\u4e0d\u8fc7\uff0c\u53ea\u6709\u666e\u901a\u6587\u4ef6\u548c\u76ee\u5f55\u4f1a\u88ab\u590d\u5236\uff0c\u4f46\u7528\u4e8e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u4f1a\u88ab\u4fdd\u7559\u3002\u6307\u5411 PostgreSQL \u5df2\u77e5\u7684\u67d0\u4e9b\u76ee\u5f55\u7684\u7b26\u53f7\u94fe\u63a5\u4f1a\u88ab\u590d\u5236\u4e3a\u7a7a\u76ee\u5f55\u3002\u5176\u4ed6\u7b26\u53f7\u94fe\u63a5\u548c\u7279\u6b8a\u8bbe\u5907\u6587\u4ef6\u5219\u4f1a\u88ab\u8df3\u8fc7\u3002\u5177\u4f53\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/10/protocol-replication.html\" title=\"52.4.\u00a0\u6d41\u590d\u5236\u534f\u8bae\">\u7b2c\u00a052.4\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5728\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u4e2d\uff0c\u9664\u975e\u4f7f\u7528\u4e86<code class=\"literal\">--tablespace-mapping</code>\u9009\u9879\uff0c\u5426\u5219\u8868\u7a7a\u95f4\u4f1a\u5907\u4efd\u5230\u5176\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u7684\u76f8\u540c\u8def\u5f84\u3002\u5982\u679c\u4e0d\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u90a3\u4e48\u5f53\u8868\u7a7a\u95f4\u6b63\u5728\u4f7f\u7528\u65f6\uff0c\u5c31\u65e0\u6cd5\u5728\u4e0e\u670d\u52a1\u5668\u76f8\u540c\u7684\u4e3b\u673a\u4e0a\u6267\u884c\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u7684\u57fa\u7840\u5907\u4efd\uff0c\u56e0\u4e3a\u5907\u4efd\u5c06\u4e0d\u5f97\u4e0d\u5199\u5165\u4e0e\u539f\u59cb\u8868\u7a7a\u95f4\u76f8\u540c\u7684\u76ee\u5f55\u4f4d\u7f6e\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u7528\u6237\u6709\u8d23\u4efb\u5728\u542f\u52a8 PostgreSQL \u670d\u52a1\u5668\u4e4b\u524d\u89e3\u5305\u6bcf\u4e2a tar \u6587\u4ef6\u3002\u5982\u679c\u5b58\u5728\u989d\u5916\u8868\u7a7a\u95f4\uff0c\u5219\u5176 tar \u6587\u4ef6\u5fc5\u987b\u89e3\u5305\u5230\u6b63\u786e\u7684\u4f4d\u7f6e\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u670d\u52a1\u5668\u4f1a\u6839\u636e<code class=\"filename\">tablespace_map</code>\u6587\u4ef6\u7684\u5185\u5bb9\uff0c\u4e3a\u8fd9\u4e9b\u8868\u7a7a\u95f4\u521b\u5efa\u7b26\u53f7\u94fe\u63a5\uff0c\u8be5\u6587\u4ef6\u5305\u542b\u5728<code class=\"filename\">base.tar</code>\u6587\u4ef6\u4e2d\u3002</p>\n<p lang=\"zh\">pg_basebackup \u53ef\u4e0e\u76f8\u540c\u6216\u66f4\u65e9\u4e3b\u8981\u7248\u672c\u7684\u670d\u52a1\u5668\u914d\u5408\u4f7f\u7528\uff0c\u6700\u4f4e\u652f\u6301 9.1\u3002\u4e0d\u8fc7\uff0cWAL \u6d41\u5f0f\u4f20\u8f93\u6a21\u5f0f\uff08-X stream\uff09\u53ea\u9002\u7528\u4e8e 9.3 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\uff0c\u5f53\u524d\u7248\u672c\u7684 tar \u683c\u5f0f\u6a21\u5f0f\uff08--format=tar\uff09\u53ea\u9002\u7528\u4e8e 9.5 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.9.9\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u8981\u4e3a\u670d\u52a1\u5668<code class=\"literal\">mydbserver</code>\u521b\u5efa\u4e00\u4e2a\u57fa\u7840\u5907\u4efd\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5230\u672c\u5730\u76ee\u5f55<code class=\"filename\">/usr/local/pgsql/data</code>\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -h mydbserver -D /usr/local/pgsql/data</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u672c\u5730\u670d\u52a1\u5668\u521b\u5efa\u4e00\u4e2a\u5907\u4efd\uff0c\u4e3a\u6bcf\u4e2a\u8868\u7a7a\u95f4\u5404\u751f\u6210\u4e00\u4e2a\u538b\u7f29\u7684 tar \u6587\u4ef6\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5728\u76ee\u5f55<code class=\"filename\">backup</code>\u4e2d\uff0c\u540c\u65f6\u5728\u8fd0\u884c\u671f\u95f4\u663e\u793a\u8fdb\u5ea6\u62a5\u544a\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup -Ft -z -P</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u4e00\u4e2a\u4ec5\u5305\u542b\u5355\u4e2a\u8868\u7a7a\u95f4\u7684\u672c\u5730\u6570\u636e\u5e93\u521b\u5efa\u5907\u4efd\uff0c\u5e76\u4f7f\u7528<span class=\"productname\">bzip2</span>\u8fdb\u884c\u538b\u7f29\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D - -Ft -X fetch | bzip2 &gt; backup.tar.bz2</code></strong>\n</pre>\n<p lang=\"zh\">\uff08\u5982\u679c\u8be5\u6570\u636e\u5e93\u4e2d\u6709\u591a\u4e2a\u8868\u7a7a\u95f4\uff0c\u6b64\u547d\u4ee4\u5c06\u5931\u8d25\u3002\uff09</p>\n<p lang=\"zh\">\u8981\u521b\u5efa\u4e00\u4e2a\u672c\u5730\u6570\u636e\u5e93\u7684\u5907\u4efd\uff0c\u5e76\u5c06\u4f4d\u4e8e<code class=\"filename\">/opt/ts</code>\u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230<code class=\"filename\">./backup/ts</code>\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup/data -T /opt/ts=$(pwd)/backup/ts</code></strong>\n</pre></div>\n<div class=\"refsect1\" id=\"id-1.9.4.9.10\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2>\n<span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/10/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a></span></div>\n</div></div>", "manual_path": "app-pgbasebackup.html", "localization": {"status": "complete", "sources": [{"url": "/docs/10/app-pgbasebackup.html", "method": "same-major semantic node", "sha256": "335e824a587432d11abdd12b69a0968c305ec548f4c392d60ae1562c36aa011f", "language": "zh", "matched_nodes": ["#APP-PGBASEBACKUP/div[2]/p[1]", "#APP-PGBASEBACKUP/div[3]/h2[0]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[0]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[1]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[2]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[3]", "#APP-PGBASEBACKUP/div[4]/p[1]", "#APP-PGBASEBACKUP/div[4]/p[2]", "#APP-PGBASEBACKUP/div[4]/p[3]", "#APP-PGBASEBACKUP/div[4]/p[4]", "#APP-PGBASEBACKUP/div[4]/p[5]", "#APP-PGBASEBACKUP/div[4]/p[6]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[17]/div[2]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[17]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[17]/div[2]/dl[0]/dd[3]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[17]/div[2]/dl[0]/dd[5]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[17]/div[2]/dl[0]/dd[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[17]/div[2]/dl[0]/dd[5]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[17]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[17]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[19]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[21]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[3]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[5]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[5]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[7]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[5]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[7]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[7]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[7]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[8]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[8]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/p[3]", "#APP-PGBASEBACKUP/div[5]/p[5]", "#APP-PGBASEBACKUP/div[5]/p[7]", "#APP-PGBASEBACKUP/div[6]/h2[0]", "#APP-PGBASEBACKUP/div[6]/p[1]", "#APP-PGBASEBACKUP/div[7]/h2[0]", "#APP-PGBASEBACKUP/div[7]/p[1]", "#APP-PGBASEBACKUP/div[7]/p[2]", "#APP-PGBASEBACKUP/div[7]/p[3]", "#APP-PGBASEBACKUP/div[7]/p[4]", "#APP-PGBASEBACKUP/div[8]/h2[0]", "#APP-PGBASEBACKUP/div[8]/p[1]", "#APP-PGBASEBACKUP/div[8]/p[3]", "#APP-PGBASEBACKUP/div[8]/p[5]", "#APP-PGBASEBACKUP/div[8]/p[7]", "#APP-PGBASEBACKUP/div[8]/p[8]", "#APP-PGBASEBACKUP/div[9]/h2[0]"]}], "language": "zh", "original_text": {"/versions/10/description/0": "pg_basebackup \u2014 take a base backup of a PostgreSQL cluster", "/versions/10/facts/0/label": "Documented executable", "/versions/10/facts/1/label": "Executable version", "/versions/10/facts/2/label": "Reference inventory", "/versions/10/facts/2/value": "Client applications", "/versions/10/facts/3/label": "Option definition groups", "/versions/10/tables/0/title": "Documented options", "/versions/10/related/0/label": "libpq connection parameters", "/versions/10/tables/0/rows/0/summary": "Directory to write the output to. pg_basebackup will create the directory and any parent directories if necessary. The directory may already exist, but it is an error if the directory already exists and is not empty.", "/versions/10/tables/0/rows/1/summary": "Selects the format for the output. format can be one of the following:", "/versions/10/tables/0/rows/2/summary": "The maximum transfer rate of data transferred from the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second.", "/versions/10/tables/0/rows/3/summary": "Write a minimal recovery.conf in the output directory (or into the base archive file when using tar format) to ease setting up a standby server. The recovery.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that the streaming replication will use the same settings later on.", "/versions/10/tables/0/rows/4/summary": "This option can only be used together with -X stream . It causes the WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming replication standby using replication slots, it should then use the same replication slot name in recovery.conf . That way, it is ensured that the server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication.", "/versions/10/tables/0/rows/5/summary": "This option prevents the creation of a temporary replication slot during the backup even if it's supported by the server.", "/versions/10/tables/0/rows/6/summary": "Relocate the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is currently defined. (But it is not an error if there is no tablespace in olddir contained in the backup.) Both olddir and newdir must be absolute paths. If a path happens to contain a = sign, escape it with a backslash. This option can be specified multiple times for multiple tablespaces. See examples below.", "/versions/10/tables/0/rows/7/summary": "Specifies the location for the write-ahead log directory. waldir must be an absolute path. The write-ahead log directory can only be specified when the backup is in plain mode.", "/versions/10/tables/0/rows/8/summary": "Includes the required write-ahead log files (WAL files) in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster directly in the extracted directory without the need to consult the log archive, thus making this a completely standalone backup.", "/versions/10/tables/0/rows/9/summary": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "/versions/10/tables/0/columns/0/label": "Option and arguments", "/versions/10/tables/0/columns/1/label": "Description", "/versions/10/tables/0/rows/10/summary": "Enables gzip compression of tar file output, and specifies the compression level (0 through 9, 0 being no compression and 9 being best compression). Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "/versions/10/tables/0/rows/11/summary": "Sets checkpoint mode to fast (immediate) or spread (default) (see Section 25.3.3 ).", "/versions/10/tables/0/rows/12/summary": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used.", "/versions/10/tables/0/rows/13/summary": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, data directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging.", "/versions/10/tables/0/rows/14/summary": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.", "/versions/10/tables/0/rows/15/summary": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.", "/versions/10/tables/0/rows/16/summary": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.", "/versions/10/tables/0/rows/17/summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "/versions/10/tables/0/rows/18/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "/versions/10/tables/0/rows/19/summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "/versions/10/tables/0/rows/20/summary": "Specifies the number of seconds between status packets sent back to the server. This allows for easier monitoring of the progress from server. A value of zero disables the periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout disconnect. The default value is 10 seconds.", "/versions/10/tables/0/rows/21/summary": "User name to connect as.", "/versions/10/tables/0/rows/22/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/10/tables/0/rows/23/summary": "Force pg_basebackup to prompt for a password before connecting to a database.", "/versions/10/tables/0/rows/24/summary": "Print the pg_basebackup version and exit.", "/versions/10/tables/0/rows/25/summary": "Show help about pg_basebackup command line arguments, and exit."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "a35b69fdea7ff288c4e5d1112f7780bdc55c9a91146657f7efca090c6f419066"}, "comparison_data": {"options": [{"names": ["-D directory", "--pgdata= directory"], "signature": "-D directory --pgdata= directory", "description": "Directory to write the output to. pg_basebackup will create the directory and any parent directories if necessary. The directory may already exist, but it is an error if the directory already exists and is not empty. When the backup is in tar mode, and the directory is specified as - (dash), the tar file will be written to stdout . This option is required."}, {"names": ["-F format", "--format= format"], "signature": "-F format --format= format", "description": "Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the current data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory will be written to a file named base.tar , and all other tablespaces will be named after the tablespace OID. If the value - (dash) is specified as target directory, the tar contents will be written to standard output, suitable for piping to for example gzip . This is only possible if the cluster has no additional tablespaces and WAL streaming is not used."}, {"names": ["-r rate", "--max-rate= rate"], "signature": "-r rate --max-rate= rate", "description": "The maximum transfer rate of data transferred from the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. The purpose is to limit the impact of pg_basebackup on the running server. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch ."}, {"names": ["-R", "--write-recovery-conf"], "signature": "-R --write-recovery-conf", "description": "Write a minimal recovery.conf in the output directory (or into the base archive file when using tar format) to ease setting up a standby server. The recovery.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that the streaming replication will use the same settings later on."}, {"names": ["-S slotname", "--slot= slotname"], "signature": "-S slotname --slot= slotname", "description": "This option can only be used together with -X stream . It causes the WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming replication standby using replication slots, it should then use the same replication slot name in recovery.conf . That way, it is ensured that the server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming."}, {"names": ["--no-slot"], "signature": "--no-slot", "description": "This option prevents the creation of a temporary replication slot during the backup even if it's supported by the server. Temporary replication slots are created by default if no slot name is given with the option -S when using log streaming. The main purpose of this option is to allow taking a base backup when the server is out of free replication slots. Using replication slots is almost always preferred, because it prevents needed WAL from being removed by the server during the backup."}, {"names": ["-T olddir = newdir", "--tablespace-mapping= olddir = newdir"], "signature": "-T olddir = newdir --tablespace-mapping= olddir = newdir", "description": "Relocate the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is currently defined. (But it is not an error if there is no tablespace in olddir contained in the backup.) Both olddir and newdir must be absolute paths. If a path happens to contain a = sign, escape it with a backslash. This option can be specified multiple times for multiple tablespaces. See examples below. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected."}, {"names": ["--waldir= waldir"], "signature": "--waldir= waldir", "description": "Specifies the location for the write-ahead log directory. waldir must be an absolute path. The write-ahead log directory can only be specified when the backup is in plain mode."}, {"names": ["-X method", "--wal-method= method"], "signature": "-X method --wal-method= method", "description": "Includes the required write-ahead log files (WAL files) in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster directly in the extracted directory without the need to consult the log archive, thus making this a completely standalone backup. The following methods for collecting the write-ahead logs are supported: n none Don't include write-ahead log in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the wal_keep_segments parameter to be set high enough that the log is not removed before the end of the backup. If the log has been rotated when it's time to transfer it, the backup will fail and be unusable. When tar format mode is used, the write-ahead log files will be written to the base.tar file. s stream Stream the write-ahead log while the backup is created. This will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will use up two connections configured by the max_wal_senders parameter. As long as the client can keep up with write-ahead log received, using this mode requires no extra write-ahead logs to be saved on the master. When tar format mode is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default."}, {"names": ["-z", "--gzip"], "signature": "-z --gzip", "description": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-Z level", "--compress= level"], "signature": "-Z level --compress= level", "description": "Enables gzip compression of tar file output, and specifies the compression level (0 through 9, 0 being no compression and 9 being best compression). Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-c fast|spread", "--checkpoint= fast|spread"], "signature": "-c fast|spread --checkpoint= fast|spread", "description": "Sets checkpoint mode to fast (immediate) or spread (default) (see Section 25.3.3 )."}, {"names": ["-l label", "--label= label"], "signature": "-l label --label= label", "description": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used."}, {"names": ["-n", "--no-clean"], "signature": "-n --no-clean", "description": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, data directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way."}, {"names": ["-P", "--progress"], "signature": "-P --progress", "description": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL. When this is enabled, the backup will start by enumerating the size of the entire database, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent."}, {"names": ["-N", "--no-sync"], "signature": "-N --no-sync", "description": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."}, {"names": ["-d connstr", "--dbname= connstr"], "signature": "-d connstr --dbname= connstr", "description": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. The option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, database name in the connection string will be ignored."}, {"names": ["-h host", "--host= host"], "signature": "-h host --host= host", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-s interval", "--status-interval= interval"], "signature": "-s interval --status-interval= interval", "description": "Specifies the number of seconds between status packets sent back to the server. This allows for easier monitoring of the progress from server. A value of zero disables the periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout disconnect. The default value is 10 seconds."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force pg_basebackup to prompt for a password before connecting to a database. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pg_basebackup version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_basebackup command line arguments, and exit."}], "synopsis": ["pg_basebackup [ option ...]"], "environment": []}, "comparison_hash": "a58cdfebc241478acd58f0ca9cd95c9af3b5abb5a8d9ef8e1b16670207b0acb9", "manual_language": "zh"}, "11": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_basebackup"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "11.22"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "28"}], "tables": [{"key": "options", "rows": [{"summary": "\u8bbe\u7f6e\u5199\u5165\u8f93\u51fa\u7684\u76ee\u6807\u76ee\u5f55\u3002\u5982\u679c\u8be5\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c pg_basebackup \u4f1a\u521b\u5efa\u5b83\uff08\u4ee5\u53ca\u6240\u6709\u7f3a\u5931\u7684\u7236\u76ee\u5f55\uff09\u3002\u5982\u679c\u8be5\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "-D directory --pgdata= directory"}}, {"summary": "\u9009\u62e9\u8f93\u51fa\u683c\u5f0f\u3002 format \u53ef\u4ee5\u662f\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "-F format --format= format"}}, {"summary": "\u4ece\u670d\u52a1\u5668\u4f20\u8f93\u6570\u636e\u7684\u6700\u5927\u901f\u7387\u3002\u5355\u4f4d\u4e3a\u6bcf\u79d2\u5343\u5b57\u8282\u3002\u4f7f\u7528\u540e\u7f00 M \u8868\u793a\u6bcf\u79d2\u5146\u5b57\u8282\u3002\u4e5f\u63a5\u53d7\u540e\u7f00 k \uff0c\u4f46\u5b83\u6ca1\u6709\u6548\u679c\u3002\u6709\u6548\u503c\u4ecb\u4e8e\u6bcf\u79d2 32 \u5343\u5b57\u8282\u548c\u6bcf\u79d2 1024 \u5146\u5b57\u8282\u4e4b\u95f4\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "-r rate --max-rate= rate"}}, {"summary": "\u5728\u8f93\u51fa\u76ee\u5f55\u4e2d\uff08\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u5219\u5728\u57fa\u7840\u5f52\u6863\u6587\u4ef6\u4e2d\uff09\u5199\u5165\u4e00\u4e2a\u6700\u5c0f\u7684 recovery.conf \uff0c\u4ee5\u4fbf\u8bbe\u7f6e\u5907\u5e93\u3002 recovery.conf \u6587\u4ef6\u4f1a\u8bb0\u5f55 pg_basebackup \u6240\u7528\u7684\u8fde\u63a5\u8bbe\u7f6e\uff0c\u4ee5\u53ca\u590d\u5236\u69fd\uff08\u5982\u679c\u6307\u5b9a\u4e86\uff09\uff0c\u4ee5\u4fbf\u6d41\u590d\u5236\u4ee5\u540e\u4f7f\u7528\u76f8\u540c\u7684\u8bbe\u7f6e\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "-R --write-recovery-conf"}}, {"summary": "\u5728\u5907\u4efd\u671f\u95f4\uff0c\u5c06\u76ee\u5f55 olddir \u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230 newdir \u3002\u8981\u4f7f\u6b64\u9009\u9879\u751f\u6548\uff0c olddir \u5fc5\u987b\u4e0e\u8be5\u8868\u7a7a\u95f4\u5f53\u524d\u5b9a\u4e49\u7684\u8def\u5f84\u5b8c\u5168\u4e00\u81f4\u3002\uff08\u4f46\u5982\u679c\u5907\u4efd\u4e2d\u6ca1\u6709\u4f4d\u4e8e olddir \u4e2d\u7684\u8868\u7a7a\u95f4\uff0c\u4e5f\u4e0d\u7b97\u9519\u8bef\u3002\uff09 olddir \u548c newdir \u90fd\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u5982\u679c\u8def\u5f84\u4e2d\u5305\u542b = \u7b26\u53f7\uff0c\u8bf7\u7528\u53cd\u659c\u7ebf\u8f6c\u4e49\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u4ee5\u5904\u7406\u591a\u4e2a\u8868\u7a7a\u95f4\u3002\u53c2\u89c1\u4e0b\u6587\u793a\u4f8b\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "-T olddir = newdir --tablespace-mapping= olddir = newdir"}}, {"summary": "\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\u7684\u4f4d\u7f6e\u3002 waldir \u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u53ea\u6709\u5728\u5907\u4efd\u91c7\u7528\u666e\u901a\u6587\u4ef6\u6a21\u5f0f\u65f6\uff0c\u624d\u80fd\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "--waldir= waldir"}}, {"summary": "\u5728\u5907\u4efd\u4e2d\u5305\u542b\u6240\u9700\u7684 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u3002\u8fd9\u5c06\u5305\u62ec\u5907\u4efd\u671f\u95f4\u751f\u6210\u7684\u6240\u6709\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u9664\u975e\u6307\u5b9a\u65b9\u6cd5 none \uff0c\u5426\u5219\u5c31\u53ef\u4ee5\u5728\u89e3\u5305\u540e\u7684\u76ee\u5f55\u4e2d\u542f\u52a8 postmaster\uff0c\u800c\u65e0\u9700\u67e5\u9605 WAL \u5f52\u6863\uff0c\u4ece\u800c\u4f7f\u8f93\u51fa\u6210\u4e3a\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u5907\u4efd\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "-X method --wal-method= method"}}, {"summary": "\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u4f7f\u7528\u9ed8\u8ba4\u538b\u7f29\u7ea7\u522b\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0 .gz \u540e\u7f00\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "-z --gzip"}}, {"summary": "\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u5e76\u6307\u5b9a\u538b\u7f29\u7ea7\u522b\uff080 \u5230 9\uff0c\u5176\u4e2d 0 \u8868\u793a\u4e0d\u538b\u7f29\uff0c9 \u8868\u793a\u6700\u4f73\u538b\u7f29\uff09\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0 .gz \u540e\u7f00\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "-Z level --compress= level"}}, {"summary": "\u5c06\u68c0\u67e5\u70b9\u6a21\u5f0f\u8bbe\u7f6e\u4e3a fast\uff08\u7acb\u5373\uff09\u6216 spread\uff08\u9ed8\u8ba4\uff09\uff08\u89c1 \u7b2c 25.3.3 \u8282 \uff09\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "-c fast|spread --checkpoint= fast|spread"}}, {"summary": "\u6307\u5b9a\u5728\u5f00\u59cb\u5907\u4efd\u4e4b\u524d\uff0c\u5e94\u521b\u5efa\u7531 --slot \u9009\u9879\u6307\u5b9a\u540d\u79f0\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u8be5\u69fd\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u9519\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "-C --create-slot"}}, {"summary": "\u8bbe\u7f6e\u5907\u4efd\u6807\u7b7e\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u503c \u201c pg_basebackup base backup \u201d \u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "-l label --label= label"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53 pg_basebackup \u56e0\u9519\u8bef\u4e2d\u6b62\u65f6\uff0c\u5b83\u4f1a\u5220\u9664\u5728\u53d1\u73b0\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u76ee\u5f55\uff08\u4f8b\u5982\u6570\u636e\u76ee\u5f55\u548c\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\uff09\u3002\u6b64\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u5f88\u6709\u5e2e\u52a9\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "-n --no-clean"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_basebackup \u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u88ab\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f1a\u4f7f pg_basebackup \u4e0d\u7ecf\u7b49\u5f85\u5c31\u76f4\u63a5\u8fd4\u56de\uff0c\u56e0\u6b64\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u968f\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u57fa\u7840\u5907\u4efd\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u5408\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "-N --no-sync"}}, {"summary": "\u542f\u7528\u8fdb\u5ea6\u62a5\u544a\u3002\u6253\u5f00\u6b64\u9009\u9879\u540e\uff0c\u4f1a\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u7ed9\u51fa\u4e00\u4e2a\u8fd1\u4f3c\u7684\u8fdb\u5ea6\u62a5\u544a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u53d1\u751f\u53d8\u5316\uff0c\u56e0\u6b64\u8fd9\u53ea\u662f\u8fd1\u4f3c\u503c\uff0c\u6700\u7ec8\u672a\u5fc5\u6070\u597d\u7ed3\u675f\u5728 100% \u3002\u7279\u522b\u662f\u5f53\u5907\u4efd\u4e2d\u5305\u542b WAL \u65f6\uff0c\u603b\u6570\u636e\u91cf\u65e0\u6cd5\u9884\u5148\u4f30\u8ba1\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u65e6\u8fdb\u5ea6\u8d85\u8fc7\u4e0d\u542b WAL \u65f6\u7684\u603b\u4f30\u8ba1\u503c\uff0c\u4f30\u8ba1\u76ee\u6807\u5927\u5c0f\u5c31\u4f1a\u7ee7\u7eed\u589e\u52a0\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "-P --progress"}}, {"summary": "\u6b64\u9009\u9879\u53ea\u80fd\u4e0e -X stream \u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u4f1a\u4f7f WAL \u6d41\u5f0f\u4f20\u8f93\u4f7f\u7528\u6307\u5b9a\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u6b64\u57fa\u7840\u5907\u4efd\u6253\u7b97\u7528\u4f5c\u4f7f\u7528\u590d\u5236\u69fd\u7684\u6d41\u590d\u5236\u5907\u5e93\uff0c\u90a3\u4e48\u8be5\u5907\u5e93\u5e94\u5728 recovery.conf \u4e2d\u4f7f\u7528\u540c\u4e00\u4e2a\u590d\u5236\u69fd\u540d\u79f0\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u670d\u52a1\u5668\u5728\u57fa\u7840\u5907\u4efd\u7ed3\u675f\u4e0e\u5f00\u59cb\u6d41\u590d\u5236\u4e4b\u95f4\u7684\u8fd9\u6bb5\u65f6\u95f4\u5185\uff0c\u4e0d\u4f1a\u79fb\u9664\u4efb\u4f55\u5fc5\u9700\u7684 WAL \u6570\u636e\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "-S slotname --slot= slotname"}}, {"summary": "\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\u3002\u5b83\u4f1a\u5728\u542f\u52a8\u548c\u5173\u95ed\u8fc7\u7a0b\u4e2d\u8f93\u51fa\u4e00\u4e9b\u989d\u5916\u6b65\u9aa4\uff1b\u5982\u679c\u540c\u65f6\u542f\u7528\u4e86\u8fdb\u5ea6\u62a5\u544a\uff0c\u8fd8\u4f1a\u663e\u793a\u5f53\u524d\u6b63\u5728\u5904\u7406\u7684\u786e\u5207\u6587\u4ef6\u540d\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "-v --verbose"}}, {"summary": "\u5373\u4f7f\u670d\u52a1\u5668\u652f\u6301\uff0c\u6b64\u9009\u9879\u4e5f\u4f1a\u963b\u6b62\u5728\u5907\u4efd\u671f\u95f4\u521b\u5efa\u4e34\u65f6\u590d\u5236\u69fd\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "--no-slot"}}, {"summary": "\u5982\u679c\u83b7\u53d6\u57fa\u7840\u5907\u4efd\u7684\u670d\u52a1\u5668\u542f\u7528\u4e86\u6821\u9a8c\u548c\uff0c\u5219\u7981\u7528\u5bf9\u8fd9\u4e9b\u6821\u9a8c\u548c\u7684\u9a8c\u8bc1\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "--no-verify-checksums"}}, {"summary": "\u4ee5 \u8fde\u63a5\u5b57\u7b26\u4e32 \u7684\u5f62\u5f0f\u6307\u5b9a\u7528\u4e8e\u8fde\u63a5\u670d\u52a1\u5668\u7684\u53c2\u6570\uff1b\u8fd9\u4e9b\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u76f8\u4e92\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "-d connstr --dbname= connstr"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGHOST \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff1b\u5426\u5219\u4f1a\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "-h host --host= host"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u6240\u4f7f\u7528\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u4e2d\u7684\u503c\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u786e\u5b9a\u7684\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "-p port --port= port"}}, {"summary": "\u6307\u5b9a\u5411\u670d\u52a1\u5668\u56de\u9001\u72b6\u6001\u5305\u7684\u65f6\u95f4\u95f4\u9694\uff08\u79d2\uff09\u3002\u8fd9\u6837\u66f4\u4fbf\u4e8e\u4ece\u670d\u52a1\u5668\u7aef\u76d1\u89c6\u8fdb\u5ea6\u3002\u503c\u4e3a\u96f6\u5c06\u5b8c\u5168\u7981\u7528\u5468\u671f\u6027\u72b6\u6001\u66f4\u65b0\uff0c\u4e0d\u8fc7\u5728\u670d\u52a1\u5668\u8bf7\u6c42\u65f6\u4ecd\u4f1a\u53d1\u9001\u66f4\u65b0\uff0c\u4ee5\u907f\u514d\u56e0\u8d85\u65f6\u800c\u65ad\u5f00\u8fde\u63a5\u3002\u9ed8\u8ba4\u503c\u662f 10 \u79d2\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "-s interval --status-interval= interval"}}, {"summary": "\u6307\u5b9a\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "-U username --username= username"}}, {"summary": "\u7981\u6b62\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\uff08\u4f8b\u5982 .pgpass \u6587\u4ef6\uff09\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u6b64\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u79cd\u573a\u666f\u4e0b\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 pg_basebackup \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "-W --password"}}, {"summary": "\u8f93\u51fa pg_basebackup \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "-V --version"}}, {"summary": "\u663e\u793a pg_basebackup \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/11/app-pgbasebackup.html", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}], "options": [{"names": ["-D directory", "--pgdata= directory"], "summary": "Directory to write the output to. pg_basebackup will create the directory and any parent directories if necessary. The directory may already exist, but it is an error if the directory already exists and is not empty.", "signature": "-D directory --pgdata= directory", "source_url": "/docs/11/app-pgbasebackup.html", "description": "Directory to write the output to. pg_basebackup will create the directory and any parent directories if necessary. The directory may already exist, but it is an error if the directory already exists and is not empty. When the backup is in tar mode, and the directory is specified as - (dash), the tar file will be written to stdout . This option is required."}, {"names": ["-F format", "--format= format"], "summary": "Selects the format for the output. format can be one of the following:", "signature": "-F format --format= format", "source_url": "/docs/11/app-pgbasebackup.html", "description": "Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the current data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory will be written to a file named base.tar , and all other tablespaces will be named after the tablespace OID. If the value - (dash) is specified as target directory, the tar contents will be written to standard output, suitable for piping to for example gzip . This is only possible if the cluster has no additional tablespaces and WAL streaming is not used."}, {"names": ["-r rate", "--max-rate= rate"], "summary": "The maximum transfer rate of data transferred from the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second.", "signature": "-r rate --max-rate= rate", "source_url": "/docs/11/app-pgbasebackup.html", "description": "The maximum transfer rate of data transferred from the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. The purpose is to limit the impact of pg_basebackup on the running server. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch ."}, {"names": ["-R", "--write-recovery-conf"], "summary": "Write a minimal recovery.conf in the output directory (or into the base archive file when using tar format) to ease setting up a standby server. The recovery.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that the streaming replication will use the same settings later on.", "signature": "-R --write-recovery-conf", "source_url": "/docs/11/app-pgbasebackup.html", "description": "Write a minimal recovery.conf in the output directory (or into the base archive file when using tar format) to ease setting up a standby server. The recovery.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that the streaming replication will use the same settings later on."}, {"names": ["-T olddir = newdir", "--tablespace-mapping= olddir = newdir"], "summary": "Relocate the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is currently defined. (But it is not an error if there is no tablespace in olddir contained in the backup.) Both olddir and newdir must be absolute paths. If a path happens to contain a = sign, escape it with a backslash. This option can be specified multiple times for multiple tablespaces. See examples below.", "signature": "-T olddir = newdir --tablespace-mapping= olddir = newdir", "source_url": "/docs/11/app-pgbasebackup.html", "description": "Relocate the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is currently defined. (But it is not an error if there is no tablespace in olddir contained in the backup.) Both olddir and newdir must be absolute paths. If a path happens to contain a = sign, escape it with a backslash. This option can be specified multiple times for multiple tablespaces. See examples below. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected."}, {"names": ["--waldir= waldir"], "summary": "Specifies the location for the write-ahead log directory. waldir must be an absolute path. The write-ahead log directory can only be specified when the backup is in plain mode.", "signature": "--waldir= waldir", "source_url": "/docs/11/app-pgbasebackup.html", "description": "Specifies the location for the write-ahead log directory. waldir must be an absolute path. The write-ahead log directory can only be specified when the backup is in plain mode."}, {"names": ["-X method", "--wal-method= method"], "summary": "Includes the required write-ahead log files (WAL files) in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster directly in the extracted directory without the need to consult the log archive, thus making this a completely standalone backup.", "signature": "-X method --wal-method= method", "source_url": "/docs/11/app-pgbasebackup.html", "description": "Includes the required write-ahead log files (WAL files) in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster directly in the extracted directory without the need to consult the log archive, thus making this a completely standalone backup. The following methods for collecting the write-ahead logs are supported: n none Don't include write-ahead log in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the wal_keep_segments parameter to be set high enough that the log is not removed before the end of the backup. If the log has been rotated when it's time to transfer it, the backup will fail and be unusable. When tar format mode is used, the write-ahead log files will be written to the base.tar file. s stream Stream the write-ahead log while the backup is created. This will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will use up two connections configured by the max_wal_senders parameter. As long as the client can keep up with write-ahead log received, using this mode requires no extra write-ahead logs to be saved on the master. When tar format mode is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default."}, {"names": ["-z", "--gzip"], "summary": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "signature": "-z --gzip", "source_url": "/docs/11/app-pgbasebackup.html", "description": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-Z level", "--compress= level"], "summary": "Enables gzip compression of tar file output, and specifies the compression level (0 through 9, 0 being no compression and 9 being best compression). Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "signature": "-Z level --compress= level", "source_url": "/docs/11/app-pgbasebackup.html", "description": "Enables gzip compression of tar file output, and specifies the compression level (0 through 9, 0 being no compression and 9 being best compression). Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-c fast|spread", "--checkpoint= fast|spread"], "summary": "Sets checkpoint mode to fast (immediate) or spread (default) (see Section 25.3.3 ).", "signature": "-c fast|spread --checkpoint= fast|spread", "source_url": "/docs/11/app-pgbasebackup.html", "description": "Sets checkpoint mode to fast (immediate) or spread (default) (see Section 25.3.3 )."}, {"names": ["-C", "--create-slot"], "summary": "This option causes creation of a replication slot named by the --slot option before starting the backup. An error is raised if the slot already exists.", "signature": "-C --create-slot", "source_url": "/docs/11/app-pgbasebackup.html", "description": "This option causes creation of a replication slot named by the --slot option before starting the backup. An error is raised if the slot already exists."}, {"names": ["-l label", "--label= label"], "summary": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used.", "signature": "-l label --label= label", "source_url": "/docs/11/app-pgbasebackup.html", "description": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used."}, {"names": ["-n", "--no-clean"], "summary": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, data directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging.", "signature": "-n --no-clean", "source_url": "/docs/11/app-pgbasebackup.html", "description": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, data directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way."}, {"names": ["-N", "--no-sync"], "summary": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.", "signature": "-N --no-sync", "source_url": "/docs/11/app-pgbasebackup.html", "description": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."}, {"names": ["-P", "--progress"], "summary": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.", "signature": "-P --progress", "source_url": "/docs/11/app-pgbasebackup.html", "description": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL. When this is enabled, the backup will start by enumerating the size of the entire database, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent."}, {"names": ["-S slotname", "--slot= slotname"], "summary": "This option can only be used together with -X stream . It causes the WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming replication standby using replication slots, it should then use the same replication slot name in recovery.conf . That way, it is ensured that the server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication.", "signature": "-S slotname --slot= slotname", "source_url": "/docs/11/app-pgbasebackup.html", "description": "This option can only be used together with -X stream . It causes the WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming replication standby using replication slots, it should then use the same replication slot name in recovery.conf . That way, it is ensured that the server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication. The specified replication slot has to exist unless the option -C is also used. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming."}, {"names": ["-v", "--verbose"], "summary": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.", "signature": "-v --verbose", "source_url": "/docs/11/app-pgbasebackup.html", "description": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."}, {"names": ["--no-slot"], "summary": "This option prevents the creation of a temporary replication slot during the backup even if it's supported by the server.", "signature": "--no-slot", "source_url": "/docs/11/app-pgbasebackup.html", "description": "This option prevents the creation of a temporary replication slot during the backup even if it's supported by the server. Temporary replication slots are created by default if no slot name is given with the option -S when using log streaming. The main purpose of this option is to allow taking a base backup when the server is out of free replication slots. Using replication slots is almost always preferred, because it prevents needed WAL from being removed by the server during the backup."}, {"names": ["--no-verify-checksums"], "summary": "Disables verification of checksums, if they are enabled on the server the base backup is taken from.", "signature": "--no-verify-checksums", "source_url": "/docs/11/app-pgbasebackup.html", "description": "Disables verification of checksums, if they are enabled on the server the base backup is taken from. By default, checksums are verified and checksum failures will result in a non-zero exit status. However, the base backup will not be removed in such a case, as if the --no-clean option had been used."}, {"names": ["-d connstr", "--dbname= connstr"], "summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": "-d connstr --dbname= connstr", "source_url": "/docs/11/app-pgbasebackup.html", "description": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. The option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, database name in the connection string will be ignored."}, {"names": ["-h host", "--host= host"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "signature": "-h host --host= host", "source_url": "/docs/11/app-pgbasebackup.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "signature": "-p port --port= port", "source_url": "/docs/11/app-pgbasebackup.html", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-s interval", "--status-interval= interval"], "summary": "Specifies the number of seconds between status packets sent back to the server. This allows for easier monitoring of the progress from server. A value of zero disables the periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout disconnect. The default value is 10 seconds.", "signature": "-s interval --status-interval= interval", "source_url": "/docs/11/app-pgbasebackup.html", "description": "Specifies the number of seconds between status packets sent back to the server. This allows for easier monitoring of the progress from server. A value of zero disables the periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout disconnect. The default value is 10 seconds."}, {"names": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/11/app-pgbasebackup.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/11/app-pgbasebackup.html", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "summary": "Force pg_basebackup to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/11/app-pgbasebackup.html", "description": "Force pg_basebackup to prompt for a password before connecting to a database. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["-V", "--version"], "summary": "Print the pg_basebackup version and exit.", "signature": "-V --version", "source_url": "/docs/11/app-pgbasebackup.html", "description": "Print the pg_basebackup version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about pg_basebackup command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/11/app-pgbasebackup.html", "description": "Show help about pg_basebackup command line arguments, and exit."}], "related": [{"url": "/wiki/conn/?v=11", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v11.22/postgresql-11.22.tar.bz2", "label": "11.22", "major": "11", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/11/postgresql-11-A4.pdf", "bytes": 13057499, "pages": 2732, "sha256": "41d75855e610d0d9b8802b87dc5b080bef8d7e91c7cf69401fbf8d3cf801b4b5", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/11/postgresql-11-US.pdf", "bytes": 12961189, "pages": 2883, "sha256": "6a8899ef36935a5b7ed2b436207564a567a4ef1eb1c2200195876b8de4d4fa30", "built_at": "2026-09-26"}}, "tree": "11", "index": "index.html", "major": "11", "pages": 1125, "release": "11.22", "source_url": "https://ftp.postgresql.org/pub/source/v11.22/postgresql-11.22.tar.bz2", "svg_assets": 0, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "2cb7c97d7a0d7278851bbc9c61f467b69c094c72b81740b751108e7892ebe1f0"}, "revision": "53315ddaf3b3f9e6669fd1edc096bbb2cd4a65ea3e836c89e542b43af9ba3a7f", "evidence_kind": "English manual and source declarations", "source_sha256": "2cb7c97d7a0d7278851bbc9c61f467b69c094c72b81740b751108e7892ebe1f0"}, "sources": [{"url": "https://pg.center/docs/11/app-pgbasebackup.html", "file": "app-pgbasebackup.html", "label": "11.22 English manual \u00b7 app-pgbasebackup.html", "anchor": "", "sha256": "a1fe2815bbf7e45e5898613140825a53f784037cbb6dcf9459c8a18b558b0df3", "language": "en", "original_url": "/docs/11/app-pgbasebackup.html"}, {"url": "https://pg.center/docs/11/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "3a30e696058b118a55cc42892c39671d9bae86f77e1024d5ebcc4688ad9ab4c3", "language": "en", "original_url": "/docs/11/reference-client.html"}], "sections": [], "synopsis": ["pg_basebackup [ option ...]"], "signature": "pg_basebackup [ option ...]", "description": ["pg_basebackup \u2014 \u83b7\u53d6 PostgreSQL \u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd"], "environment": [], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGBASEBACKUP\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\">pg_basebackup</span></h2>\n<p lang=\"zh\">pg_basebackup \u2014 \u83b7\u53d6<span class=\"productname\">PostgreSQL</span>\u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.9.4.1\"><code class=\"command\">pg_basebackup</code> [<em class=\"replaceable\"><code>option</code></em>...]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.9.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u7528\u4e8e\u83b7\u53d6\u6b63\u5728\u8fd0\u884c\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd\u3002\u5907\u4efd\u8fc7\u7a0b\u4e0d\u4f1a\u5f71\u54cd\u6570\u636e\u5e93\u7684\u5176\u4ed6\u5ba2\u6237\u7aef\uff0c\u5e76\u4e14\u8be5\u5907\u4efd\u65e2\u53ef\u7528\u4e8e\u65f6\u95f4\u70b9\u6062\u590d\uff08\u89c1<a class=\"xref\" href=\"/docs/11/continuous-archiving.html\" title=\"25.3.\u00a0\u6301\u7eed\u5f52\u6863\u548c\u65f6\u95f4\u70b9\u6062\u590d\uff08PITR\uff09\">\u7b2c\u00a025.3\u00a0\u8282</a>\uff09\uff0c\u4e5f\u53ef\u7528\u4f5c\u65e5\u5fd7\u4f20\u9001\u6216\u6d41\u590d\u5236\u5907\u5e93\u7684\u8d77\u70b9\uff08\u89c1<a class=\"xref\" href=\"/docs/11/warm-standby.html\" title=\"26.2.\u00a0\u65e5\u5fd7\u4f20\u9001\u5907\u5e93\">\u7b2c\u00a026.2\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u6587\u4ef6\u7684\u4e8c\u8fdb\u5236\u526f\u672c\uff0c\u540c\u65f6\u786e\u4fdd\u7cfb\u7edf\u81ea\u52a8\u8fdb\u5165\u548c\u9000\u51fa\u5907\u4efd\u6a21\u5f0f\u3002\u5907\u4efd\u59cb\u7ec8\u9488\u5bf9\u6574\u4e2a\u6570\u636e\u5e93\u96c6\u7c07\uff1b\u65e0\u6cd5\u53ea\u5907\u4efd\u5355\u4e2a\u6570\u636e\u5e93\u6216\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u8981\u5907\u4efd\u5355\u4e2a\u6570\u636e\u5e93\uff0c\u5fc5\u987b\u4f7f\u7528<a class=\"xref\" href=\"/docs/11/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a>\u4e4b\u7c7b\u7684\u5de5\u5177\u3002</p>\n<p lang=\"zh\">\u5907\u4efd\u901a\u8fc7\u4f7f\u7528\u590d\u5236\u534f\u8bae\u7684\u666e\u901a<span class=\"productname\">PostgreSQL</span>\u8fde\u63a5\u8fdb\u884c\u3002\u5efa\u7acb\u8fde\u63a5\u65f6\u5fc5\u987b\u4f7f\u7528\u8d85\u7ea7\u7528\u6237\u6216\u5177\u6709<code class=\"literal\">REPLICATION</code>\u6743\u9650\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/11/role-attributes.html\" title=\"21.2.\u00a0\u89d2\u8272\u5c5e\u6027\">\u7b2c\u00a021.2\u00a0\u8282</a>\uff09\u7684\u7528\u6237\uff0c\u5e76\u4e14<code class=\"filename\">pg_hba.conf</code>\u5fc5\u987b\u660e\u786e\u5141\u8bb8\u590d\u5236\u8fde\u63a5\u3002\u670d\u52a1\u5668\u8fd8\u5fc5\u987b\u5c06<a class=\"xref\" href=\"/docs/11/runtime-config-replication.html#GUC-MAX-WAL-SENDERS\">max_wal_senders</a>\u8bbe\u7f6e\u5f97\u8db3\u591f\u9ad8\uff0c\u4ee5\u4fbf\u81f3\u5c11\u4e3a\u5907\u4efd\u4fdd\u7559\u4e00\u4e2a\u53ef\u7528\u4f1a\u8bdd\uff0c\u5e76\u5728\u4f7f\u7528 WAL \u6d41\u5f0f\u4f20\u8f93\u65f6\u518d\u4e3a\u5176\u4fdd\u7559\u4e00\u4e2a\u4f1a\u8bdd\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u540c\u65f6\u8fd0\u884c\u591a\u4e2a<code class=\"command\">pg_basebackup</code>\uff0c\u4f46\u4ece\u6027\u80fd\u89d2\u5ea6\u6765\u770b\uff0c\u6700\u597d\u53ea\u6267\u884c\u4e00\u6b21\u5907\u4efd\uff0c\u7136\u540e\u590d\u5236\u5176\u7ed3\u679c\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u4e0d\u4ec5\u53ef\u4ee5\u4ece\u4e3b\u5e93\u83b7\u53d6\u57fa\u7840\u5907\u4efd\uff0c\u4e5f\u53ef\u4ee5\u4ece\u5907\u5e93\u83b7\u53d6\u3002\u8981\u4ece\u5907\u5e93\u83b7\u53d6\u5907\u4efd\uff0c\u9700\u8981\u5c06\u5907\u5e93\u914d\u7f6e\u4e3a\u80fd\u591f\u63a5\u53d7\u590d\u5236\u8fde\u63a5\uff08\u5373\u8bbe\u7f6e<code class=\"varname\">max_wal_senders</code>\u548c<a class=\"xref\" href=\"/docs/11/runtime-config-replication.html#GUC-HOT-STANDBY\">hot_standby</a>\uff0c\u5e76\u914d\u7f6e<a class=\"link\" href=\"/docs/11/client-authentication.html#AUTH-PG-HBA-CONF\" title=\"20.1.\u00a0pg_hba.conf \u6587\u4ef6\">\u57fa\u4e8e\u4e3b\u673a\u7684\u8ba4\u8bc1</a>\uff09\u3002\u8fd8\u9700\u8981\u5728\u4e3b\u5e93\u4e0a\u542f\u7528<a class=\"xref\" href=\"/docs/11/runtime-config-wal.html#GUC-FULL-PAGE-WRITES\">full_page_writes</a>\u3002</p>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u4ece\u5907\u5e93\u83b7\u53d6\u5728\u7ebf\u5907\u4efd\u65f6\u6709\u4e00\u4e9b\u9650\u5236\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5907\u4efd\u5386\u53f2\u6587\u4ef6\u4e0d\u4f1a\u5728\u88ab\u5907\u4efd\u7684\u6570\u636e\u5e93\u96c6\u7c07\u4e2d\u521b\u5efa\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">pg_basebackup</span>\u65e0\u6cd5\u5f3a\u5236\u5907\u5e93\u5728\u5907\u4efd\u7ed3\u675f\u65f6\u5207\u6362\u5230\u65b0\u7684 WAL \u6587\u4ef6\u3002\u5f53\u4f7f\u7528<code class=\"literal\">-X none</code>\u65f6\uff0c\u5982\u679c\u4e3b\u5e93\u4e0a\u7684\u5199\u5165\u6d3b\u52a8\u8f83\u5c11\uff0c<span class=\"application\">pg_basebackup</span>\u53ef\u80fd\u9700\u8981\u957f\u65f6\u95f4\u7b49\u5f85\uff0c\u76f4\u5230\u5907\u4efd\u6240\u9700\u7684\u6700\u540e\u4e00\u4e2a WAL \u6587\u4ef6\u88ab\u5207\u6362\u5e76\u5f52\u6863\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5728\u4e3b\u5e93\u4e0a\u8fd0\u884c<code class=\"function\">pg_switch_wal</code>\uff0c\u4ee5\u7acb\u5373\u89e6\u53d1 WAL \u6587\u4ef6\u5207\u6362\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5982\u679c\u5907\u5e93\u5728\u5728\u7ebf\u5907\u4efd\u8fc7\u7a0b\u4e2d\u88ab\u63d0\u5347\u4e3a\u4e3b\u5e93\uff0c\u5219\u5907\u4efd\u4f1a\u5931\u8d25\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5907\u4efd\u6240\u9700\u7684\u6240\u6709 WAL \u8bb0\u5f55\u90fd\u5fc5\u987b\u5305\u542b\u8db3\u591f\u7684\u6574\u9875\u5199\u5165\uff0c\u56e0\u6b64\u5fc5\u987b\u5728\u4e3b\u5e93\u4e0a\u542f\u7528<code class=\"varname\">full_page_writes</code>\uff0c\u5e76\u4e14\u4e0d\u80fd\u628a<span class=\"application\">pg_compresslog</span>\u4e4b\u7c7b\u7684\u5de5\u5177\u7528\u4f5c<code class=\"varname\">archive_command</code>\uff0c\u4ece WAL \u6587\u4ef6\u4e2d\u79fb\u9664\u6574\u9875\u5199\u5165\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.9.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u8f93\u51fa\u7684\u4f4d\u7f6e\u548c\u683c\u5f0f\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>directory</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u5199\u5165\u8f93\u51fa\u7684\u76ee\u6807\u76ee\u5f55\u3002\u5982\u679c\u8be5\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u521b\u5efa\u5b83\uff08\u4ee5\u53ca\u6240\u6709\u7f3a\u5931\u7684\u7236\u76ee\u5f55\uff09\u3002\u5982\u679c\u8be5\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002</p>\n<p lang=\"zh\">\u5f53\u5907\u4efd\u91c7\u7528 tar \u683c\u5f0f\u65f6\uff0c\u76ee\u6807\u76ee\u5f55\u53ef\u4ee5\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff08\u77ed\u6a2a\u7ebf\uff09\uff0c\u4ece\u800c\u5c06 tar \u6587\u4ef6\u5199\u5230<code class=\"literal\">stdout</code>\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u662f\u5fc5\u9700\u7684\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>format</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--format=<em class=\"replaceable\"><code>format</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u9009\u62e9\u8f93\u51fa\u683c\u5f0f\u3002<em class=\"replaceable\"><code>format</code></em>\u53ef\u4ee5\u662f\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">p</code><br/></span><span class=\"term\"><code class=\"literal\">plain</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u5199\u4e3a\u666e\u901a\u6587\u4ef6\uff0c\u5176\u5e03\u5c40\u4e0e\u6e90\u670d\u52a1\u5668\u7684\u6570\u636e\u76ee\u5f55\u548c\u8868\u7a7a\u95f4\u76f8\u540c\u3002\u5f53\u96c6\u7c07\u6ca1\u6709\u989d\u5916\u8868\u7a7a\u95f4\u65f6\uff0c\u6574\u4e2a\u6570\u636e\u5e93\u90fd\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u3002\u5982\u679c\u96c6\u7c07\u5305\u542b\u989d\u5916\u8868\u7a7a\u95f4\uff0c\u5219\u4e3b\u6570\u636e\u76ee\u5f55\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\uff0c\u800c\u5176\u4ed6\u6240\u6709\u8868\u7a7a\u95f4\u90fd\u4f1a\u653e\u5728\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u76f8\u540c\u7684\u7edd\u5bf9\u8def\u5f84\u4e2d\u3002\uff08\u5982\u9700\u6539\u53d8\u8fd9\u4e00\u70b9\uff0c\u89c1<code class=\"option\">--tablespace-mapping</code>\u3002\uff09</p>\n<p lang=\"zh\">\u8fd9\u662f\u9ed8\u8ba4\u683c\u5f0f\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">t</code><br/></span><span class=\"term\"><code class=\"literal\">tar</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u5199\u4e3a\u76ee\u6807\u76ee\u5f55\u4e2d\u7684 tar \u6587\u4ef6\u3002\u4e3b\u6570\u636e\u76ee\u5f55\u7684\u5185\u5bb9\u4f1a\u5199\u5165\u540d\u4e3a<code class=\"filename\">base.tar</code>\u7684\u6587\u4ef6\u4e2d\uff0c\u800c\u6bcf\u4e2a\u5176\u4ed6\u8868\u7a7a\u95f4\u90fd\u4f1a\u5199\u5165\u4e00\u4e2a\u4ee5\u8be5\u8868\u7a7a\u95f4 OID \u547d\u540d\u7684\u72ec\u7acb tar \u6587\u4ef6\u4e2d\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u76ee\u6807\u76ee\u5f55\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff08\u77ed\u6a2a\u7ebf\uff09\uff0ctar \u5185\u5bb9\u5c06\u5199\u5165\u6807\u51c6\u8f93\u51fa\uff0c\u9002\u5408\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u4f8b\u5982<span class=\"productname\">gzip</span>\u3002\u53ea\u6709\u5f53\u96c6\u7c07\u6ca1\u6709\u989d\u5916\u8868\u7a7a\u95f4\u4e14\u672a\u4f7f\u7528 WAL \u6d41\u5f0f\u4f20\u8f93\u65f6\uff0c\u624d\u5141\u8bb8\u8fd9\u6837\u505a\u3002</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r <em class=\"replaceable\"><code>rate</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--max-rate=<em class=\"replaceable\"><code>rate</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ece\u670d\u52a1\u5668\u4f20\u8f93\u6570\u636e\u7684\u6700\u5927\u901f\u7387\u3002\u5355\u4f4d\u4e3a\u6bcf\u79d2\u5343\u5b57\u8282\u3002\u4f7f\u7528\u540e\u7f00<code class=\"literal\">M</code>\u8868\u793a\u6bcf\u79d2\u5146\u5b57\u8282\u3002\u4e5f\u63a5\u53d7\u540e\u7f00<code class=\"literal\">k</code>\uff0c\u4f46\u5b83\u6ca1\u6709\u6548\u679c\u3002\u6709\u6548\u503c\u4ecb\u4e8e\u6bcf\u79d2 32 \u5343\u5b57\u8282\u548c\u6bcf\u79d2 1024 \u5146\u5b57\u8282\u4e4b\u95f4\u3002</p>\n<p lang=\"zh\">\u76ee\u7684\u662f\u9650\u5236<span class=\"application\">pg_basebackup</span>\u5bf9\u8fd0\u884c\u4e2d\u7684\u670d\u52a1\u5668\u7684\u5f71\u54cd\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u59cb\u7ec8\u5f71\u54cd\u6570\u636e\u76ee\u5f55\u7684\u4f20\u8f93\u3002\u53ea\u6709\u5f53\u6536\u96c6\u65b9\u6cd5\u4e3a<code class=\"literal\">fetch</code>\u65f6\uff0cWAL \u6587\u4ef6\u7684\u4f20\u8f93\u624d\u4f1a\u53d7\u5230\u5f71\u54cd\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code><br/></span><span class=\"term\"><code class=\"option\">--write-recovery-conf</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8f93\u51fa\u76ee\u5f55\u4e2d\uff08\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u5219\u5728\u57fa\u7840\u5f52\u6863\u6587\u4ef6\u4e2d\uff09\u5199\u5165\u4e00\u4e2a\u6700\u5c0f\u7684<code class=\"filename\">recovery.conf</code>\uff0c\u4ee5\u4fbf\u8bbe\u7f6e\u5907\u5e93\u3002<code class=\"filename\">recovery.conf</code>\u6587\u4ef6\u4f1a\u8bb0\u5f55<span class=\"application\">pg_basebackup</span>\u6240\u7528\u7684\u8fde\u63a5\u8bbe\u7f6e\uff0c\u4ee5\u53ca\u590d\u5236\u69fd\uff08\u5982\u679c\u6307\u5b9a\u4e86\uff09\uff0c\u4ee5\u4fbf\u6d41\u590d\u5236\u4ee5\u540e\u4f7f\u7528\u76f8\u540c\u7684\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>olddir</code></em>=<em class=\"replaceable\"><code>newdir</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--tablespace-mapping=<em class=\"replaceable\"><code>olddir</code></em>=<em class=\"replaceable\"><code>newdir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u671f\u95f4\uff0c\u5c06\u76ee\u5f55<em class=\"replaceable\"><code>olddir</code></em>\u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230<em class=\"replaceable\"><code>newdir</code></em>\u3002\u8981\u4f7f\u6b64\u9009\u9879\u751f\u6548\uff0c<em class=\"replaceable\"><code>olddir</code></em>\u5fc5\u987b\u4e0e\u8be5\u8868\u7a7a\u95f4\u5f53\u524d\u5b9a\u4e49\u7684\u8def\u5f84\u5b8c\u5168\u4e00\u81f4\u3002\uff08\u4f46\u5982\u679c\u5907\u4efd\u4e2d\u6ca1\u6709\u4f4d\u4e8e<em class=\"replaceable\"><code>olddir</code></em>\u4e2d\u7684\u8868\u7a7a\u95f4\uff0c\u4e5f\u4e0d\u7b97\u9519\u8bef\u3002\uff09<em class=\"replaceable\"><code>olddir</code></em>\u548c<em class=\"replaceable\"><code>newdir</code></em>\u90fd\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u5982\u679c\u8def\u5f84\u4e2d\u5305\u542b<code class=\"literal\">=</code>\u7b26\u53f7\uff0c\u8bf7\u7528\u53cd\u659c\u7ebf\u8f6c\u4e49\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u4ee5\u5904\u7406\u591a\u4e2a\u8868\u7a7a\u95f4\u3002\u53c2\u89c1\u4e0b\u6587\u793a\u4f8b\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u91cd\u5b9a\u4f4d\u8868\u7a7a\u95f4\uff0c\u4e3b\u6570\u636e\u76ee\u5f55\u4e2d\u7684\u7b26\u53f7\u94fe\u63a5\u5c06\u88ab\u66f4\u65b0\u4e3a\u6307\u5411\u65b0\u4f4d\u7f6e\u3002\u56e0\u6b64\uff0c\u65b0\u6570\u636e\u76ee\u5f55\u5df2\u53ef\u76f4\u63a5\u7528\u4e8e\u542f\u52a8\u4e00\u4e2a\u6240\u6709\u8868\u7a7a\u95f4\u90fd\u4f4d\u4e8e\u66f4\u65b0\u540e\u4f4d\u7f6e\u7684\u65b0\u670d\u52a1\u5668\u5b9e\u4f8b\u3002</p>\n<p lang=\"zh\">\u76ee\u524d\uff0c\u6b64\u9009\u9879\u4ec5\u9002\u7528\u4e8e\u666e\u901a\u6587\u4ef6\u8f93\u51fa\u683c\u5f0f\uff1b\u5982\u679c\u9009\u62e9\u4e86 tar \u683c\u5f0f\uff0c\u5219\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--waldir=<em class=\"replaceable\"><code>waldir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\u7684\u4f4d\u7f6e\u3002<em class=\"replaceable\"><code>waldir</code></em>\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u53ea\u6709\u5728\u5907\u4efd\u91c7\u7528\u666e\u901a\u6587\u4ef6\u6a21\u5f0f\u65f6\uff0c\u624d\u80fd\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-X <em class=\"replaceable\"><code>method</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--wal-method=<em class=\"replaceable\"><code>method</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u4e2d\u5305\u542b\u6240\u9700\u7684 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u3002\u8fd9\u5c06\u5305\u62ec\u5907\u4efd\u671f\u95f4\u751f\u6210\u7684\u6240\u6709\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u9664\u975e\u6307\u5b9a\u65b9\u6cd5<code class=\"literal\">none</code>\uff0c\u5426\u5219\u5c31\u53ef\u4ee5\u5728\u89e3\u5305\u540e\u7684\u76ee\u5f55\u4e2d\u542f\u52a8 postmaster\uff0c\u800c\u65e0\u9700\u67e5\u9605 WAL \u5f52\u6863\uff0c\u4ece\u800c\u4f7f\u8f93\u51fa\u6210\u4e3a\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u5907\u4efd\u3002</p>\n<p lang=\"zh\">\u652f\u6301\u4ee5\u4e0b\u6536\u96c6\u9884\u5199\u5f0f\u65e5\u5fd7\u7684\u65b9\u6cd5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">n</code><br/></span><span class=\"term\"><code class=\"literal\">none</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u5728\u5907\u4efd\u4e2d\u5305\u542b\u9884\u5199\u5f0f\u65e5\u5fd7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">f</code><br/></span><span class=\"term\"><code class=\"literal\">fetch</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u7ed3\u675f\u65f6\u6536\u96c6\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u3002\u56e0\u6b64\uff0c<a class=\"xref\" href=\"/docs/11/runtime-config-replication.html#GUC-WAL-KEEP-SEGMENTS\">wal_keep_segments</a>\u53c2\u6570\u5fc5\u987b\u8bbe\u7f6e\u5f97\u8db3\u591f\u9ad8\uff0c\u4ee5\u786e\u4fdd\u5728\u5907\u4efd\u7ed3\u675f\u524d\u4e0d\u4f1a\u79fb\u9664\u6240\u9700\u7684\u65e5\u5fd7\u6570\u636e\u3002\u5982\u679c\u5728\u4f20\u8f93\u8fd9\u4e9b\u6570\u636e\u4e4b\u524d\u5b83\u4eec\u5df2\u7ecf\u88ab\u56de\u6536\uff0c\u5219\u5907\u4efd\u4f1a\u5931\u8d25\u5e76\u4e14\u65e0\u6cd5\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u4f1a\u5305\u542b\u5728<code class=\"filename\">base.tar</code>\u6587\u4ef6\u4e2d\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">s</code><br/></span><span class=\"term\"><code class=\"literal\">stream</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u521b\u5efa\u5907\u4efd\u7684\u540c\u65f6\u6d41\u5f0f\u4f20\u8f93\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u8fd9\u4f1a\u6253\u5f00\u4e0e\u670d\u52a1\u5668\u7684\u7b2c\u4e8c\u4e2a\u8fde\u63a5\uff0c\u5e76\u5728\u6267\u884c\u5907\u4efd\u65f6\u5e76\u884c\u5f00\u59cb\u6d41\u5f0f\u4f20\u8f93\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u56e0\u6b64\uff0c\u5b83\u4f1a\u5360\u7528\u7531<a class=\"xref\" href=\"/docs/11/runtime-config-replication.html#GUC-MAX-WAL-SENDERS\">max_wal_senders</a>\u53c2\u6570\u914d\u7f6e\u7684\u4e24\u4e2a\u8fde\u63a5\u3002\u53ea\u8981\u5ba2\u6237\u7aef\u80fd\u591f\u8ddf\u4e0a\u63a5\u6536\u5230\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\uff0c\u4f7f\u7528\u6b64\u6a21\u5f0f\u5c31\u4e0d\u9700\u8981\u5728\u4e3b\u5e93\u4e0a\u989d\u5916\u4fdd\u7559\u9884\u5199\u5f0f\u65e5\u5fd7\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u4f1a\u5199\u5165\u4e00\u4e2a\u540d\u4e3a<code class=\"filename\">pg_wal.tar</code>\u7684\u72ec\u7acb\u6587\u4ef6\u4e2d\uff08\u5982\u679c\u670d\u52a1\u5668\u7248\u672c\u65e9\u4e8e 10\uff0c\u5219\u6587\u4ef6\u540d\u4e3a<code class=\"filename\">pg_xlog.tar</code>\uff09\u3002</p>\n<p lang=\"zh\">\u8fd9\u662f\u9ed8\u8ba4\u503c\u3002</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-z</code><br/></span><span class=\"term\"><code class=\"option\">--gzip</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u4f7f\u7528\u9ed8\u8ba4\u538b\u7f29\u7ea7\u522b\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0<code class=\"filename\">.gz</code>\u540e\u7f00\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-Z <em class=\"replaceable\"><code>level</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--compress=<em class=\"replaceable\"><code>level</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u5e76\u6307\u5b9a\u538b\u7f29\u7ea7\u522b\uff080 \u5230 9\uff0c\u5176\u4e2d 0 \u8868\u793a\u4e0d\u538b\u7f29\uff0c9 \u8868\u793a\u6700\u4f73\u538b\u7f29\uff09\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0<code class=\"filename\">.gz</code>\u540e\u7f00\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u5907\u4efd\u7684\u751f\u6210\u548c\u7a0b\u5e8f\u7684\u8fd0\u884c\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>fast|spread</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--checkpoint=<em class=\"replaceable\"><code>fast|spread</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u68c0\u67e5\u70b9\u6a21\u5f0f\u8bbe\u7f6e\u4e3a fast\uff08\u7acb\u5373\uff09\u6216 spread\uff08\u9ed8\u8ba4\uff09\uff08\u89c1<a class=\"xref\" href=\"/docs/11/continuous-archiving.html#BACKUP-LOWLEVEL-BASE-BACKUP\" title=\"25.3.3.\u00a0\u4f7f\u7528\u4f4e\u7ea7 API \u8fdb\u884c\u57fa\u7840\u5907\u4efd\">\u7b2c\u00a025.3.3\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--create-slot</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728\u5f00\u59cb\u5907\u4efd\u4e4b\u524d\uff0c\u5e94\u521b\u5efa\u7531<code class=\"literal\">--slot</code>\u9009\u9879\u6307\u5b9a\u540d\u79f0\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u8be5\u69fd\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u9519\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>label</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--label=<em class=\"replaceable\"><code>label</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5907\u4efd\u6807\u7b7e\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u503c<span class=\"quote\">\u201c<span class=\"quote\"><code class=\"literal\">pg_basebackup base backup</code></span>\u201d</span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-clean</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53<code class=\"command\">pg_basebackup</code>\u56e0\u9519\u8bef\u4e2d\u6b62\u65f6\uff0c\u5b83\u4f1a\u5220\u9664\u5728\u53d1\u73b0\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u76ee\u5f55\uff08\u4f8b\u5982\u6570\u636e\u76ee\u5f55\u548c\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\uff09\u3002\u6b64\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u5f88\u6709\u5e2e\u52a9\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u65e0\u8bba\u662f\u5426\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u8868\u7a7a\u95f4\u76ee\u5f55\u90fd\u4e0d\u4f1a\u88ab\u6e05\u7406\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N</code><br/></span><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">pg_basebackup</code>\u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u88ab\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f1a\u4f7f<code class=\"command\">pg_basebackup</code>\u4e0d\u7ecf\u7b49\u5f85\u5c31\u76f4\u63a5\u8fd4\u56de\uff0c\u56e0\u6b64\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u968f\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u57fa\u7840\u5907\u4efd\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u5408\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P</code><br/></span><span class=\"term\"><code class=\"option\">--progress</code></span></dt>\n<dd>\n<p lang=\"zh\">\u542f\u7528\u8fdb\u5ea6\u62a5\u544a\u3002\u6253\u5f00\u6b64\u9009\u9879\u540e\uff0c\u4f1a\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u7ed9\u51fa\u4e00\u4e2a\u8fd1\u4f3c\u7684\u8fdb\u5ea6\u62a5\u544a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u53d1\u751f\u53d8\u5316\uff0c\u56e0\u6b64\u8fd9\u53ea\u662f\u8fd1\u4f3c\u503c\uff0c\u6700\u7ec8\u672a\u5fc5\u6070\u597d\u7ed3\u675f\u5728<code class=\"literal\">100%</code>\u3002\u7279\u522b\u662f\u5f53\u5907\u4efd\u4e2d\u5305\u542b WAL \u65f6\uff0c\u603b\u6570\u636e\u91cf\u65e0\u6cd5\u9884\u5148\u4f30\u8ba1\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u65e6\u8fdb\u5ea6\u8d85\u8fc7\u4e0d\u542b WAL \u65f6\u7684\u603b\u4f30\u8ba1\u503c\uff0c\u4f30\u8ba1\u76ee\u6807\u5927\u5c0f\u5c31\u4f1a\u7ee7\u7eed\u589e\u52a0\u3002</p>\n<p lang=\"zh\">\u542f\u7528\u6b64\u9009\u9879\u540e\uff0c\u5907\u4efd\u4f1a\u5148\u904d\u5386\u6574\u4e2a\u6570\u636e\u5e93\u4ee5\u7edf\u8ba1\u5176\u5927\u5c0f\uff0c\u7136\u540e\u518d\u8fd4\u56de\u53d1\u9001\u5b9e\u9645\u5185\u5bb9\u3002\u8fd9\u53ef\u80fd\u4f7f\u5907\u4efd\u7a0d\u5fae\u8017\u65f6\u66f4\u957f\uff0c\u5c24\u5176\u4f1a\u4f7f\u9996\u6b21\u53d1\u9001\u6570\u636e\u4e4b\u524d\u7684\u7b49\u5f85\u65f6\u95f4\u66f4\u957f\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>slotname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--slot=<em class=\"replaceable\"><code>slotname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u53ea\u80fd\u4e0e<code class=\"literal\">-X stream</code>\u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u4f1a\u4f7f WAL \u6d41\u5f0f\u4f20\u8f93\u4f7f\u7528\u6307\u5b9a\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u6b64\u57fa\u7840\u5907\u4efd\u6253\u7b97\u7528\u4f5c\u4f7f\u7528\u590d\u5236\u69fd\u7684\u6d41\u590d\u5236\u5907\u5e93\uff0c\u90a3\u4e48\u8be5\u5907\u5e93\u5e94\u5728<code class=\"filename\">recovery.conf</code>\u4e2d\u4f7f\u7528\u540c\u4e00\u4e2a\u590d\u5236\u69fd\u540d\u79f0\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u670d\u52a1\u5668\u5728\u57fa\u7840\u5907\u4efd\u7ed3\u675f\u4e0e\u5f00\u59cb\u6d41\u590d\u5236\u4e4b\u95f4\u7684\u8fd9\u6bb5\u65f6\u95f4\u5185\uff0c\u4e0d\u4f1a\u79fb\u9664\u4efb\u4f55\u5fc5\u9700\u7684 WAL \u6570\u636e\u3002</p>\n<p lang=\"zh\">\u6307\u5b9a\u7684\u590d\u5236\u69fd\u5fc5\u987b\u5df2\u7ecf\u5b58\u5728\uff0c\u9664\u975e\u8fd8\u540c\u65f6\u4f7f\u7528\u4e86<code class=\"option\">-C</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5e76\u4e14\u670d\u52a1\u5668\u652f\u6301\u4e34\u65f6\u590d\u5236\u69fd\uff0810 \u53ca\u4ee5\u4e0a\u7248\u672c\uff09\uff0c\u5219\u4f1a\u81ea\u52a8\u4f7f\u7528\u4e34\u65f6\u590d\u5236\u69fd\u8fdb\u884c WAL \u6d41\u5f0f\u4f20\u8f93\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\u3002\u5b83\u4f1a\u5728\u542f\u52a8\u548c\u5173\u95ed\u8fc7\u7a0b\u4e2d\u8f93\u51fa\u4e00\u4e9b\u989d\u5916\u6b65\u9aa4\uff1b\u5982\u679c\u540c\u65f6\u542f\u7528\u4e86\u8fdb\u5ea6\u62a5\u544a\uff0c\u8fd8\u4f1a\u663e\u793a\u5f53\u524d\u6b63\u5728\u5904\u7406\u7684\u786e\u5207\u6587\u4ef6\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-slot</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5373\u4f7f\u670d\u52a1\u5668\u652f\u6301\uff0c\u6b64\u9009\u9879\u4e5f\u4f1a\u963b\u6b62\u5728\u5907\u4efd\u671f\u95f4\u521b\u5efa\u4e34\u65f6\u590d\u5236\u69fd\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u9009\u62e9\u4e86 WAL \u6d41\u5f0f\u4f20\u8f93\uff0c\u4f46\u6ca1\u6709\u4f7f\u7528<code class=\"option\">-S</code>\u9009\u9879\u7ed9\u51fa\u69fd\u540d\uff0c\u90a3\u4e48\u4f1a\u521b\u5efa\u4e00\u4e2a\u4e34\u65f6\u590d\u5236\u69fd\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7684\u4e3b\u8981\u76ee\u7684\u662f\u5728\u670d\u52a1\u5668\u6ca1\u6709\u7a7a\u95f2\u590d\u5236\u69fd\u65f6\uff0c\u4ecd\u7136\u5141\u8bb8\u6267\u884c\u57fa\u7840\u5907\u4efd\u3002\u51e0\u4e4e\u603b\u662f\u9996\u9009\u4f7f\u7528\u590d\u5236\u69fd\uff0c\u56e0\u4e3a\u5b83\u80fd\u9632\u6b62\u670d\u52a1\u5668\u5728\u5907\u4efd\u671f\u95f4\u79fb\u9664\u6240\u9700\u7684 WAL\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-verify-checksums</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u83b7\u53d6\u57fa\u7840\u5907\u4efd\u7684\u670d\u52a1\u5668\u542f\u7528\u4e86\u6821\u9a8c\u548c\uff0c\u5219\u7981\u7528\u5bf9\u8fd9\u4e9b\u6821\u9a8c\u548c\u7684\u9a8c\u8bc1\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f1a\u9a8c\u8bc1\u6821\u9a8c\u548c\uff1b\u6821\u9a8c\u548c\u9a8c\u8bc1\u5931\u8d25\u5c06\u5bfc\u81f4\u975e\u96f6\u9000\u51fa\u72b6\u6001\u3002\u4e0d\u8fc7\uff0c\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u57fa\u7840\u5907\u4efd\u4e0d\u4f1a\u88ab\u5220\u9664\uff0c\u5c31\u50cf\u4f7f\u7528\u4e86<code class=\"option\">--no-clean</code>\u4e00\u6837\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u6570\u636e\u5e93\u8fde\u63a5\u53c2\u6570\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>connstr</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>connstr</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ee5<a class=\"link\" href=\"/docs/11/libpq.html#LIBPQ-CONNSTRING\" title=\"34.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u7684\u5f62\u5f0f\u6307\u5b9a\u7528\u4e8e\u8fde\u63a5\u670d\u52a1\u5668\u7684\u53c2\u6570\uff1b\u8fd9\u4e9b\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u76f8\u4e92\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u51fa\u4e8e\u4e0e\u5176\u4ed6\u5ba2\u6237\u7aef\u5e94\u7528\u4fdd\u6301\u4e00\u81f4\u7684\u8003\u8651\uff0c\u6b64\u9009\u9879\u540d\u4e3a<code class=\"literal\">--dbname</code>\uff1b\u4f46\u7531\u4e8e<span class=\"application\">pg_basebackup</span>\u5e76\u4e0d\u8fde\u63a5\u5230\u96c6\u7c07\u4e2d\u7684\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u4e2d\u7684\u6570\u636e\u5e93\u540d\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea<code class=\"envar\">PGHOST</code>\u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff1b\u5426\u5219\u4f1a\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u6240\u4f7f\u7528\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u4f7f\u7528<code class=\"envar\">PGPORT</code>\u73af\u5883\u53d8\u91cf\u4e2d\u7684\u503c\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u786e\u5b9a\u7684\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s <em class=\"replaceable\"><code>interval</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--status-interval=<em class=\"replaceable\"><code>interval</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5411\u670d\u52a1\u5668\u56de\u9001\u72b6\u6001\u5305\u7684\u65f6\u95f4\u95f4\u9694\uff08\u79d2\uff09\u3002\u8fd9\u6837\u66f4\u4fbf\u4e8e\u4ece\u670d\u52a1\u5668\u7aef\u76d1\u89c6\u8fdb\u5ea6\u3002\u503c\u4e3a\u96f6\u5c06\u5b8c\u5168\u7981\u7528\u5468\u671f\u6027\u72b6\u6001\u66f4\u65b0\uff0c\u4e0d\u8fc7\u5728\u670d\u52a1\u5668\u8bf7\u6c42\u65f6\u4ecd\u4f1a\u53d1\u9001\u66f4\u65b0\uff0c\u4ee5\u907f\u514d\u56e0\u8d85\u65f6\u800c\u65ad\u5f00\u8fde\u63a5\u3002\u9ed8\u8ba4\u503c\u662f 10 \u79d2\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7981\u6b62\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\uff08\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff09\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u6b64\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u79cd\u573a\u666f\u4e0b\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236<span class=\"application\">pg_basebackup</span>\u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7edd\u975e\u5fc5\u9700\uff0c\u56e0\u4e3a\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u81ea\u52a8\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\u6765\u53d1\u73b0\u670d\u52a1\u5668\u9700\u8981\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u8f93\u5165<code class=\"option\">-W</code>\u4ee5\u907f\u514d\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u662f\u503c\u5f97\u7684\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5176\u4ed6\u9009\u9879\u4e5f\u53ef\u7528\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa<span class=\"application\">pg_basebackup</span>\u7684\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"application\">pg_basebackup</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.9.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6<span class=\"productname\">PostgreSQL</span>\u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528<span class=\"application\">libpq</span>\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/11/libpq-envars.html\" title=\"34.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a034.14\u00a0\u8282</a>\uff09\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.9.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u5728\u5907\u4efd\u5f00\u59cb\u65f6\uff0c\u9700\u8981\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u6267\u884c\u4e00\u6b21\u68c0\u67e5\u70b9\u3002\u8fd9\u53ef\u80fd\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\uff08\u5c24\u5176\u662f\u5728\u672a\u4f7f\u7528<code class=\"literal\">--checkpoint=fast</code>\u9009\u9879\u65f6\uff09\uff1b\u5728\u6b64\u671f\u95f4\uff0c<span class=\"application\">pg_basebackup</span>\u770b\u8d77\u6765\u4f1a\u5904\u4e8e\u7a7a\u95f2\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u5907\u4efd\u5c06\u5305\u62ec\u6570\u636e\u76ee\u5f55\u548c\u8868\u7a7a\u95f4\u4e2d\u7684\u6240\u6709\u6587\u4ef6\uff0c\u5305\u62ec\u914d\u7f6e\u6587\u4ef6\u4ee5\u53ca\u7b2c\u4e09\u65b9\u653e\u5728\u8fd9\u4e9b\u76ee\u5f55\u4e2d\u7684\u4efb\u4f55\u989d\u5916\u6587\u4ef6\uff0c\u4f46\u7531 PostgreSQL \u7ba1\u7406\u7684\u67d0\u4e9b\u4e34\u65f6\u6587\u4ef6\u9664\u5916\u3002\u4e0d\u8fc7\uff0c\u53ea\u6709\u666e\u901a\u6587\u4ef6\u548c\u76ee\u5f55\u4f1a\u88ab\u590d\u5236\uff0c\u4f46\u7528\u4e8e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u4f1a\u88ab\u4fdd\u7559\u3002\u6307\u5411 PostgreSQL \u5df2\u77e5\u7684\u67d0\u4e9b\u76ee\u5f55\u7684\u7b26\u53f7\u94fe\u63a5\u4f1a\u88ab\u590d\u5236\u4e3a\u7a7a\u76ee\u5f55\u3002\u5176\u4ed6\u7b26\u53f7\u94fe\u63a5\u548c\u7279\u6b8a\u8bbe\u5907\u6587\u4ef6\u5219\u4f1a\u88ab\u8df3\u8fc7\u3002\u5177\u4f53\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/11/protocol-replication.html\" title=\"53.4.\u00a0\u6d41\u590d\u5236\u534f\u8bae\">\u7b2c\u00a053.4\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5728\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u4e2d\uff0c\u9664\u975e\u4f7f\u7528\u4e86<code class=\"literal\">--tablespace-mapping</code>\u9009\u9879\uff0c\u5426\u5219\u8868\u7a7a\u95f4\u4f1a\u5907\u4efd\u5230\u5176\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u7684\u76f8\u540c\u8def\u5f84\u3002\u5982\u679c\u4e0d\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u90a3\u4e48\u5f53\u8868\u7a7a\u95f4\u6b63\u5728\u4f7f\u7528\u65f6\uff0c\u5c31\u65e0\u6cd5\u5728\u4e0e\u670d\u52a1\u5668\u76f8\u540c\u7684\u4e3b\u673a\u4e0a\u6267\u884c\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u7684\u57fa\u7840\u5907\u4efd\uff0c\u56e0\u4e3a\u5907\u4efd\u5c06\u4e0d\u5f97\u4e0d\u5199\u5165\u4e0e\u539f\u59cb\u8868\u7a7a\u95f4\u76f8\u540c\u7684\u76ee\u5f55\u4f4d\u7f6e\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u7528\u6237\u6709\u8d23\u4efb\u5728\u542f\u52a8 PostgreSQL \u670d\u52a1\u5668\u4e4b\u524d\u89e3\u5305\u6bcf\u4e2a tar \u6587\u4ef6\u3002\u5982\u679c\u5b58\u5728\u989d\u5916\u8868\u7a7a\u95f4\uff0c\u5219\u5176 tar \u6587\u4ef6\u5fc5\u987b\u89e3\u5305\u5230\u6b63\u786e\u7684\u4f4d\u7f6e\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u670d\u52a1\u5668\u4f1a\u6839\u636e<code class=\"filename\">tablespace_map</code>\u6587\u4ef6\u7684\u5185\u5bb9\uff0c\u4e3a\u8fd9\u4e9b\u8868\u7a7a\u95f4\u521b\u5efa\u7b26\u53f7\u94fe\u63a5\uff0c\u8be5\u6587\u4ef6\u5305\u542b\u5728<code class=\"filename\">base.tar</code>\u6587\u4ef6\u4e2d\u3002</p>\n<p lang=\"zh\">pg_basebackup \u53ef\u4e0e\u76f8\u540c\u6216\u66f4\u65e9\u4e3b\u8981\u7248\u672c\u7684\u670d\u52a1\u5668\u914d\u5408\u4f7f\u7528\uff0c\u6700\u4f4e\u652f\u6301 9.1\u3002\u4e0d\u8fc7\uff0cWAL \u6d41\u5f0f\u4f20\u8f93\u6a21\u5f0f\uff08-X stream\uff09\u53ea\u9002\u7528\u4e8e 9.3 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\uff0c\u5f53\u524d\u7248\u672c\u7684 tar \u683c\u5f0f\u6a21\u5f0f\uff08--format=tar\uff09\u53ea\u9002\u7528\u4e8e 9.5 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6e90\u96c6\u7c07\u542f\u7528\u4e86\u7ec4\u6743\u9650\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u5728<code class=\"literal\">plain</code>\u548c<code class=\"literal\">tar</code>\u4e24\u79cd\u683c\u5f0f\u4e2d\u4fdd\u7559\u7ec4\u6743\u9650\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.9.9\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u8981\u4e3a\u670d\u52a1\u5668<code class=\"literal\">mydbserver</code>\u521b\u5efa\u4e00\u4e2a\u57fa\u7840\u5907\u4efd\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5230\u672c\u5730\u76ee\u5f55<code class=\"filename\">/usr/local/pgsql/data</code>\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -h mydbserver -D /usr/local/pgsql/data</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u672c\u5730\u670d\u52a1\u5668\u521b\u5efa\u4e00\u4e2a\u5907\u4efd\uff0c\u4e3a\u6bcf\u4e2a\u8868\u7a7a\u95f4\u5404\u751f\u6210\u4e00\u4e2a\u538b\u7f29\u7684 tar \u6587\u4ef6\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5728\u76ee\u5f55<code class=\"filename\">backup</code>\u4e2d\uff0c\u540c\u65f6\u5728\u8fd0\u884c\u671f\u95f4\u663e\u793a\u8fdb\u5ea6\u62a5\u544a\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup -Ft -z -P</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u4e00\u4e2a\u4ec5\u5305\u542b\u5355\u4e2a\u8868\u7a7a\u95f4\u7684\u672c\u5730\u6570\u636e\u5e93\u521b\u5efa\u5907\u4efd\uff0c\u5e76\u4f7f\u7528<span class=\"productname\">bzip2</span>\u8fdb\u884c\u538b\u7f29\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D - -Ft -X fetch | bzip2 &gt; backup.tar.bz2</code></strong>\n</pre>\n<p lang=\"zh\">\uff08\u5982\u679c\u8be5\u6570\u636e\u5e93\u4e2d\u6709\u591a\u4e2a\u8868\u7a7a\u95f4\uff0c\u6b64\u547d\u4ee4\u5c06\u5931\u8d25\u3002\uff09</p>\n<p lang=\"zh\">\u8981\u521b\u5efa\u4e00\u4e2a\u672c\u5730\u6570\u636e\u5e93\u7684\u5907\u4efd\uff0c\u5e76\u5c06\u4f4d\u4e8e<code class=\"filename\">/opt/ts</code>\u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230<code class=\"filename\">./backup/ts</code>\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup/data -T /opt/ts=$(pwd)/backup/ts</code></strong>\n</pre>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.9.10\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/11/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a></span>\n</div>\n</div></div>", "manual_path": "app-pgbasebackup.html", "localization": {"status": "complete", "sources": [{"url": "/docs/11/app-pgbasebackup.html", "method": "same-major semantic node", "sha256": "286db323c8e3f33abda17ab1587da137d1de9c3ea6e2fd31a692ea829d558d5e", "language": "zh", "matched_nodes": ["#APP-PGBASEBACKUP/div[2]/p[1]", "#APP-PGBASEBACKUP/div[3]/h2[0]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[0]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[1]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[2]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[3]", "#APP-PGBASEBACKUP/div[4]/p[1]", "#APP-PGBASEBACKUP/div[4]/p[2]", "#APP-PGBASEBACKUP/div[4]/p[3]", "#APP-PGBASEBACKUP/div[4]/p[4]", "#APP-PGBASEBACKUP/div[4]/p[5]", "#APP-PGBASEBACKUP/div[4]/p[6]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/div[2]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/div[2]/dl[0]/dd[3]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/div[2]/dl[0]/dd[5]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/div[2]/dl[0]/dd[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/div[2]/dl[0]/dd[5]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[17]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[3]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[5]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[5]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[7]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[11]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[11]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[13]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[17]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[17]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[17]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[19]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[19]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[7]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[7]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[7]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[8]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[8]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/p[3]", "#APP-PGBASEBACKUP/div[5]/p[5]", "#APP-PGBASEBACKUP/div[5]/p[7]", "#APP-PGBASEBACKUP/div[6]/h2[0]", "#APP-PGBASEBACKUP/div[6]/p[1]", "#APP-PGBASEBACKUP/div[7]/h2[0]", "#APP-PGBASEBACKUP/div[7]/p[1]", "#APP-PGBASEBACKUP/div[7]/p[2]", "#APP-PGBASEBACKUP/div[7]/p[3]", "#APP-PGBASEBACKUP/div[7]/p[4]", "#APP-PGBASEBACKUP/div[7]/p[6]", "#APP-PGBASEBACKUP/div[8]/h2[0]", "#APP-PGBASEBACKUP/div[8]/p[1]", "#APP-PGBASEBACKUP/div[8]/p[3]", "#APP-PGBASEBACKUP/div[8]/p[5]", "#APP-PGBASEBACKUP/div[8]/p[7]", "#APP-PGBASEBACKUP/div[8]/p[8]", "#APP-PGBASEBACKUP/div[9]/h2[0]"]}], "language": "zh", "original_text": {"/versions/11/description/0": "pg_basebackup \u2014 take a base backup of a PostgreSQL cluster", "/versions/11/facts/0/label": "Documented executable", "/versions/11/facts/1/label": "Executable version", "/versions/11/facts/2/label": "Reference inventory", "/versions/11/facts/2/value": "Client applications", "/versions/11/facts/3/label": "Option definition groups", "/versions/11/tables/0/title": "Documented options", "/versions/11/related/0/label": "libpq connection parameters", "/versions/11/tables/0/rows/0/summary": "Directory to write the output to. pg_basebackup will create the directory and any parent directories if necessary. The directory may already exist, but it is an error if the directory already exists and is not empty.", "/versions/11/tables/0/rows/1/summary": "Selects the format for the output. format can be one of the following:", "/versions/11/tables/0/rows/2/summary": "The maximum transfer rate of data transferred from the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second.", "/versions/11/tables/0/rows/3/summary": "Write a minimal recovery.conf in the output directory (or into the base archive file when using tar format) to ease setting up a standby server. The recovery.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that the streaming replication will use the same settings later on.", "/versions/11/tables/0/rows/4/summary": "Relocate the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is currently defined. (But it is not an error if there is no tablespace in olddir contained in the backup.) Both olddir and newdir must be absolute paths. If a path happens to contain a = sign, escape it with a backslash. This option can be specified multiple times for multiple tablespaces. See examples below.", "/versions/11/tables/0/rows/5/summary": "Specifies the location for the write-ahead log directory. waldir must be an absolute path. The write-ahead log directory can only be specified when the backup is in plain mode.", "/versions/11/tables/0/rows/6/summary": "Includes the required write-ahead log files (WAL files) in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster directly in the extracted directory without the need to consult the log archive, thus making this a completely standalone backup.", "/versions/11/tables/0/rows/7/summary": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "/versions/11/tables/0/rows/8/summary": "Enables gzip compression of tar file output, and specifies the compression level (0 through 9, 0 being no compression and 9 being best compression). Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "/versions/11/tables/0/rows/9/summary": "Sets checkpoint mode to fast (immediate) or spread (default) (see Section 25.3.3 ).", "/versions/11/tables/0/columns/0/label": "Option and arguments", "/versions/11/tables/0/columns/1/label": "Description", "/versions/11/tables/0/rows/10/summary": "This option causes creation of a replication slot named by the --slot option before starting the backup. An error is raised if the slot already exists.", "/versions/11/tables/0/rows/11/summary": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used.", "/versions/11/tables/0/rows/12/summary": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, data directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging.", "/versions/11/tables/0/rows/13/summary": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.", "/versions/11/tables/0/rows/14/summary": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.", "/versions/11/tables/0/rows/15/summary": "This option can only be used together with -X stream . It causes the WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming replication standby using replication slots, it should then use the same replication slot name in recovery.conf . That way, it is ensured that the server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication.", "/versions/11/tables/0/rows/16/summary": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.", "/versions/11/tables/0/rows/17/summary": "This option prevents the creation of a temporary replication slot during the backup even if it's supported by the server.", "/versions/11/tables/0/rows/18/summary": "Disables verification of checksums, if they are enabled on the server the base backup is taken from.", "/versions/11/tables/0/rows/19/summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "/versions/11/tables/0/rows/20/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "/versions/11/tables/0/rows/21/summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "/versions/11/tables/0/rows/22/summary": "Specifies the number of seconds between status packets sent back to the server. This allows for easier monitoring of the progress from server. A value of zero disables the periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout disconnect. The default value is 10 seconds.", "/versions/11/tables/0/rows/23/summary": "User name to connect as.", "/versions/11/tables/0/rows/24/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/11/tables/0/rows/25/summary": "Force pg_basebackup to prompt for a password before connecting to a database.", "/versions/11/tables/0/rows/26/summary": "Print the pg_basebackup version and exit.", "/versions/11/tables/0/rows/27/summary": "Show help about pg_basebackup command line arguments, and exit."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "d1e951261cc2bce1117bf2826651d1f1a3f4e9962f13ee1a2de64f312a9bcbb7"}, "comparison_data": {"options": [{"names": ["-D directory", "--pgdata= directory"], "signature": "-D directory --pgdata= directory", "description": "Directory to write the output to. pg_basebackup will create the directory and any parent directories if necessary. The directory may already exist, but it is an error if the directory already exists and is not empty. When the backup is in tar mode, and the directory is specified as - (dash), the tar file will be written to stdout . This option is required."}, {"names": ["-F format", "--format= format"], "signature": "-F format --format= format", "description": "Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the current data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory will be written to a file named base.tar , and all other tablespaces will be named after the tablespace OID. If the value - (dash) is specified as target directory, the tar contents will be written to standard output, suitable for piping to for example gzip . This is only possible if the cluster has no additional tablespaces and WAL streaming is not used."}, {"names": ["-r rate", "--max-rate= rate"], "signature": "-r rate --max-rate= rate", "description": "The maximum transfer rate of data transferred from the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. The purpose is to limit the impact of pg_basebackup on the running server. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch ."}, {"names": ["-R", "--write-recovery-conf"], "signature": "-R --write-recovery-conf", "description": "Write a minimal recovery.conf in the output directory (or into the base archive file when using tar format) to ease setting up a standby server. The recovery.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that the streaming replication will use the same settings later on."}, {"names": ["-T olddir = newdir", "--tablespace-mapping= olddir = newdir"], "signature": "-T olddir = newdir --tablespace-mapping= olddir = newdir", "description": "Relocate the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is currently defined. (But it is not an error if there is no tablespace in olddir contained in the backup.) Both olddir and newdir must be absolute paths. If a path happens to contain a = sign, escape it with a backslash. This option can be specified multiple times for multiple tablespaces. See examples below. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected."}, {"names": ["--waldir= waldir"], "signature": "--waldir= waldir", "description": "Specifies the location for the write-ahead log directory. waldir must be an absolute path. The write-ahead log directory can only be specified when the backup is in plain mode."}, {"names": ["-X method", "--wal-method= method"], "signature": "-X method --wal-method= method", "description": "Includes the required write-ahead log files (WAL files) in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster directly in the extracted directory without the need to consult the log archive, thus making this a completely standalone backup. The following methods for collecting the write-ahead logs are supported: n none Don't include write-ahead log in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the wal_keep_segments parameter to be set high enough that the log is not removed before the end of the backup. If the log has been rotated when it's time to transfer it, the backup will fail and be unusable. When tar format mode is used, the write-ahead log files will be written to the base.tar file. s stream Stream the write-ahead log while the backup is created. This will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will use up two connections configured by the max_wal_senders parameter. As long as the client can keep up with write-ahead log received, using this mode requires no extra write-ahead logs to be saved on the master. When tar format mode is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default."}, {"names": ["-z", "--gzip"], "signature": "-z --gzip", "description": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-Z level", "--compress= level"], "signature": "-Z level --compress= level", "description": "Enables gzip compression of tar file output, and specifies the compression level (0 through 9, 0 being no compression and 9 being best compression). Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-c fast|spread", "--checkpoint= fast|spread"], "signature": "-c fast|spread --checkpoint= fast|spread", "description": "Sets checkpoint mode to fast (immediate) or spread (default) (see Section 25.3.3 )."}, {"names": ["-C", "--create-slot"], "signature": "-C --create-slot", "description": "This option causes creation of a replication slot named by the --slot option before starting the backup. An error is raised if the slot already exists."}, {"names": ["-l label", "--label= label"], "signature": "-l label --label= label", "description": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used."}, {"names": ["-n", "--no-clean"], "signature": "-n --no-clean", "description": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, data directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way."}, {"names": ["-N", "--no-sync"], "signature": "-N --no-sync", "description": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."}, {"names": ["-P", "--progress"], "signature": "-P --progress", "description": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL. When this is enabled, the backup will start by enumerating the size of the entire database, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent."}, {"names": ["-S slotname", "--slot= slotname"], "signature": "-S slotname --slot= slotname", "description": "This option can only be used together with -X stream . It causes the WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming replication standby using replication slots, it should then use the same replication slot name in recovery.conf . That way, it is ensured that the server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication. The specified replication slot has to exist unless the option -C is also used. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."}, {"names": ["--no-slot"], "signature": "--no-slot", "description": "This option prevents the creation of a temporary replication slot during the backup even if it's supported by the server. Temporary replication slots are created by default if no slot name is given with the option -S when using log streaming. The main purpose of this option is to allow taking a base backup when the server is out of free replication slots. Using replication slots is almost always preferred, because it prevents needed WAL from being removed by the server during the backup."}, {"names": ["--no-verify-checksums"], "signature": "--no-verify-checksums", "description": "Disables verification of checksums, if they are enabled on the server the base backup is taken from. By default, checksums are verified and checksum failures will result in a non-zero exit status. However, the base backup will not be removed in such a case, as if the --no-clean option had been used."}, {"names": ["-d connstr", "--dbname= connstr"], "signature": "-d connstr --dbname= connstr", "description": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. The option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, database name in the connection string will be ignored."}, {"names": ["-h host", "--host= host"], "signature": "-h host --host= host", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-s interval", "--status-interval= interval"], "signature": "-s interval --status-interval= interval", "description": "Specifies the number of seconds between status packets sent back to the server. This allows for easier monitoring of the progress from server. A value of zero disables the periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout disconnect. The default value is 10 seconds."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force pg_basebackup to prompt for a password before connecting to a database. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pg_basebackup version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_basebackup command line arguments, and exit."}], "synopsis": ["pg_basebackup [ option ...]"], "environment": []}, "comparison_hash": "1403f5873b409f8efceee8a869f9b98dde4f16f6d573555a3946a2770fac07fd", "manual_language": "zh"}, "12": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_basebackup"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "12.22"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "28"}], "tables": [{"key": "options", "rows": [{"summary": "\u8bbe\u7f6e\u5199\u5165\u8f93\u51fa\u7684\u76ee\u6807\u76ee\u5f55\u3002\u5982\u679c\u8be5\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c pg_basebackup \u4f1a\u521b\u5efa\u5b83\uff08\u4ee5\u53ca\u6240\u6709\u7f3a\u5931\u7684\u7236\u76ee\u5f55\uff09\u3002\u5982\u679c\u8be5\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "-D directory --pgdata= directory"}}, {"summary": "\u9009\u62e9\u8f93\u51fa\u683c\u5f0f\u3002 format \u53ef\u4ee5\u662f\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "-F format --format= format"}}, {"summary": "\u4ece\u670d\u52a1\u5668\u4f20\u8f93\u6570\u636e\u7684\u6700\u5927\u901f\u7387\u3002\u5355\u4f4d\u4e3a\u6bcf\u79d2\u5343\u5b57\u8282\u3002\u4f7f\u7528\u540e\u7f00 M \u8868\u793a\u6bcf\u79d2\u5146\u5b57\u8282\u3002\u4e5f\u63a5\u53d7\u540e\u7f00 k \uff0c\u4f46\u5b83\u6ca1\u6709\u6548\u679c\u3002\u6709\u6548\u503c\u4ecb\u4e8e\u6bcf\u79d2 32 \u5343\u5b57\u8282\u548c\u6bcf\u79d2 1024 \u5146\u5b57\u8282\u4e4b\u95f4\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "-r rate --max-rate= rate"}}, {"summary": "\u521b\u5efa standby.signal \u6587\u4ef6\uff0c\u5e76\u5c06\u8fde\u63a5\u8bbe\u7f6e\u8ffd\u52a0\u5230\u8f93\u51fa\u76ee\u5f55\u4e2d\u7684 postgresql.auto.conf \uff08\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u5219\u4f4d\u4e8e\u57fa\u7840\u5f52\u6863\u6587\u4ef6\u4e2d\uff09\uff0c\u4ee5\u4fbf\u8bbe\u7f6e\u5907\u5e93\u3002 postgresql.auto.conf \u6587\u4ef6\u4f1a\u8bb0\u5f55 pg_basebackup \u6240\u7528\u7684\u8fde\u63a5\u8bbe\u7f6e\u4ee5\u53ca\u590d\u5236\u69fd\uff08\u5982\u679c\u6307\u5b9a\u4e86\uff09\uff0c\u4ee5\u4fbf\u6d41\u590d\u5236\u4ee5\u540e\u4f7f\u7528\u76f8\u540c\u7684\u8bbe\u7f6e\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "-R --write-recovery-conf"}}, {"summary": "\u5728\u5907\u4efd\u671f\u95f4\uff0c\u5c06\u76ee\u5f55 olddir \u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230 newdir \u3002\u8981\u4f7f\u6b64\u9009\u9879\u751f\u6548\uff0c olddir \u5fc5\u987b\u4e0e\u8be5\u8868\u7a7a\u95f4\u5f53\u524d\u5b9a\u4e49\u7684\u8def\u5f84\u5b8c\u5168\u4e00\u81f4\u3002\uff08\u4f46\u5982\u679c\u5907\u4efd\u4e2d\u6ca1\u6709\u4f4d\u4e8e olddir \u4e2d\u7684\u8868\u7a7a\u95f4\uff0c\u4e5f\u4e0d\u7b97\u9519\u8bef\u3002\uff09 olddir \u548c newdir \u90fd\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u5982\u679c\u8def\u5f84\u4e2d\u5305\u542b = \u7b26\u53f7\uff0c\u8bf7\u7528\u53cd\u659c\u7ebf\u8f6c\u4e49\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u4ee5\u5904\u7406\u591a\u4e2a\u8868\u7a7a\u95f4\u3002\u53c2\u89c1\u4e0b\u6587\u793a\u4f8b\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "-T olddir = newdir --tablespace-mapping= olddir = newdir"}}, {"summary": "\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\u7684\u4f4d\u7f6e\u3002 waldir \u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u53ea\u6709\u5728\u5907\u4efd\u91c7\u7528\u666e\u901a\u6587\u4ef6\u6a21\u5f0f\u65f6\uff0c\u624d\u80fd\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "--waldir= waldir"}}, {"summary": "\u5728\u5907\u4efd\u4e2d\u5305\u542b\u6240\u9700\u7684 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u3002\u8fd9\u5c06\u5305\u62ec\u5907\u4efd\u671f\u95f4\u751f\u6210\u7684\u6240\u6709\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u9664\u975e\u6307\u5b9a\u65b9\u6cd5 none \uff0c\u5426\u5219\u5c31\u53ef\u4ee5\u5728\u89e3\u5305\u540e\u7684\u76ee\u5f55\u4e2d\u542f\u52a8 postmaster\uff0c\u800c\u65e0\u9700\u67e5\u9605 WAL \u5f52\u6863\uff0c\u4ece\u800c\u4f7f\u8f93\u51fa\u6210\u4e3a\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u5907\u4efd\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "-X method --wal-method= method"}}, {"summary": "\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u4f7f\u7528\u9ed8\u8ba4\u538b\u7f29\u7ea7\u522b\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0 .gz \u540e\u7f00\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "-z --gzip"}}, {"summary": "\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u5e76\u6307\u5b9a\u538b\u7f29\u7ea7\u522b\uff080 \u5230 9\uff0c\u5176\u4e2d 0 \u8868\u793a\u4e0d\u538b\u7f29\uff0c9 \u8868\u793a\u6700\u4f73\u538b\u7f29\uff09\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0 .gz \u540e\u7f00\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "-Z level --compress= level"}}, {"summary": "\u5c06\u68c0\u67e5\u70b9\u6a21\u5f0f\u8bbe\u7f6e\u4e3a fast\uff08\u7acb\u5373\uff09\u6216 spread\uff08\u9ed8\u8ba4\uff09\uff08\u89c1 \u7b2c 25.3.3 \u8282 \uff09\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "-c fast|spread --checkpoint= fast|spread"}}, {"summary": "\u6307\u5b9a\u5728\u5f00\u59cb\u5907\u4efd\u4e4b\u524d\uff0c\u5e94\u521b\u5efa\u7531 --slot \u9009\u9879\u6307\u5b9a\u540d\u79f0\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u8be5\u69fd\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u9519\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "-C --create-slot"}}, {"summary": "\u8bbe\u7f6e\u5907\u4efd\u6807\u7b7e\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u503c \u201c pg_basebackup base backup \u201d \u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "-l label --label= label"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53 pg_basebackup \u56e0\u9519\u8bef\u4e2d\u6b62\u65f6\uff0c\u5b83\u4f1a\u5220\u9664\u5728\u53d1\u73b0\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u76ee\u5f55\uff08\u4f8b\u5982\u6570\u636e\u76ee\u5f55\u548c\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\uff09\u3002\u6b64\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u5f88\u6709\u5e2e\u52a9\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "-n --no-clean"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_basebackup \u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u88ab\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f1a\u4f7f pg_basebackup \u4e0d\u7ecf\u7b49\u5f85\u5c31\u76f4\u63a5\u8fd4\u56de\uff0c\u56e0\u6b64\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u968f\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u57fa\u7840\u5907\u4efd\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u5408\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "-N --no-sync"}}, {"summary": "\u542f\u7528\u8fdb\u5ea6\u62a5\u544a\u3002\u6253\u5f00\u6b64\u9009\u9879\u540e\uff0c\u4f1a\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u7ed9\u51fa\u4e00\u4e2a\u8fd1\u4f3c\u7684\u8fdb\u5ea6\u62a5\u544a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u53d1\u751f\u53d8\u5316\uff0c\u56e0\u6b64\u8fd9\u53ea\u662f\u8fd1\u4f3c\u503c\uff0c\u6700\u7ec8\u672a\u5fc5\u6070\u597d\u7ed3\u675f\u5728 100% \u3002\u7279\u522b\u662f\u5f53\u5907\u4efd\u4e2d\u5305\u542b WAL \u65f6\uff0c\u603b\u6570\u636e\u91cf\u65e0\u6cd5\u9884\u5148\u4f30\u8ba1\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u65e6\u8fdb\u5ea6\u8d85\u8fc7\u4e0d\u542b WAL \u65f6\u7684\u603b\u4f30\u8ba1\u503c\uff0c\u4f30\u8ba1\u76ee\u6807\u5927\u5c0f\u5c31\u4f1a\u7ee7\u7eed\u589e\u52a0\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "-P --progress"}}, {"summary": "\u6b64\u9009\u9879\u53ea\u80fd\u4e0e -X stream \u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u4f1a\u4f7f WAL \u6d41\u5f0f\u4f20\u8f93\u4f7f\u7528\u6307\u5b9a\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u6b64\u57fa\u7840\u5907\u4efd\u6253\u7b97\u7528\u4f5c\u4f7f\u7528\u590d\u5236\u69fd\u7684\u6d41\u590d\u5236\u5907\u5e93\uff0c\u90a3\u4e48\u8be5\u5907\u5e93\u5e94\u5728 primary_slot_name \u4e2d\u4f7f\u7528\u540c\u4e00\u4e2a\u590d\u5236\u69fd\u540d\u79f0\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u670d\u52a1\u5668\u5728\u57fa\u7840\u5907\u4efd\u7ed3\u675f\u4e0e\u5f00\u59cb\u6d41\u590d\u5236\u4e4b\u95f4\u7684\u8fd9\u6bb5\u65f6\u95f4\u5185\uff0c\u4e0d\u4f1a\u79fb\u9664\u4efb\u4f55\u5fc5\u9700\u7684 WAL \u6570\u636e\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "-S slotname --slot= slotname"}}, {"summary": "\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\u3002\u5b83\u4f1a\u5728\u542f\u52a8\u548c\u5173\u95ed\u8fc7\u7a0b\u4e2d\u8f93\u51fa\u4e00\u4e9b\u989d\u5916\u6b65\u9aa4\uff1b\u5982\u679c\u540c\u65f6\u542f\u7528\u4e86\u8fdb\u5ea6\u62a5\u544a\uff0c\u8fd8\u4f1a\u663e\u793a\u5f53\u524d\u6b63\u5728\u5904\u7406\u7684\u786e\u5207\u6587\u4ef6\u540d\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "-v --verbose"}}, {"summary": "\u5373\u4f7f\u670d\u52a1\u5668\u652f\u6301\uff0c\u6b64\u9009\u9879\u4e5f\u4f1a\u963b\u6b62\u5728\u5907\u4efd\u671f\u95f4\u521b\u5efa\u4e34\u65f6\u590d\u5236\u69fd\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "--no-slot"}}, {"summary": "\u5982\u679c\u83b7\u53d6\u57fa\u7840\u5907\u4efd\u7684\u670d\u52a1\u5668\u542f\u7528\u4e86\u6821\u9a8c\u548c\uff0c\u5219\u7981\u7528\u5bf9\u8fd9\u4e9b\u6821\u9a8c\u548c\u7684\u9a8c\u8bc1\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "--no-verify-checksums"}}, {"summary": "\u4ee5 \u8fde\u63a5\u5b57\u7b26\u4e32 \u7684\u5f62\u5f0f\u6307\u5b9a\u7528\u4e8e\u8fde\u63a5\u670d\u52a1\u5668\u7684\u53c2\u6570\uff1b\u8fd9\u4e9b\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u76f8\u4e92\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "-d connstr --dbname= connstr"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGHOST \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff1b\u5426\u5219\u4f1a\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "-h host --host= host"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u6240\u4f7f\u7528\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u4e2d\u7684\u503c\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u786e\u5b9a\u7684\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "-p port --port= port"}}, {"summary": "\u6307\u5b9a\u5411\u670d\u52a1\u5668\u56de\u9001\u72b6\u6001\u5305\u7684\u65f6\u95f4\u95f4\u9694\uff08\u79d2\uff09\u3002\u8fd9\u6837\u66f4\u4fbf\u4e8e\u4ece\u670d\u52a1\u5668\u7aef\u76d1\u89c6\u8fdb\u5ea6\u3002\u503c\u4e3a\u96f6\u5c06\u5b8c\u5168\u7981\u7528\u5468\u671f\u6027\u72b6\u6001\u66f4\u65b0\uff0c\u4e0d\u8fc7\u5728\u670d\u52a1\u5668\u8bf7\u6c42\u65f6\u4ecd\u4f1a\u53d1\u9001\u66f4\u65b0\uff0c\u4ee5\u907f\u514d\u56e0\u8d85\u65f6\u800c\u65ad\u5f00\u8fde\u63a5\u3002\u9ed8\u8ba4\u503c\u662f 10 \u79d2\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "-s interval --status-interval= interval"}}, {"summary": "\u6307\u5b9a\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "-U username --username= username"}}, {"summary": "\u7981\u6b62\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\uff08\u4f8b\u5982 .pgpass \u6587\u4ef6\uff09\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u6b64\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u79cd\u573a\u666f\u4e0b\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 pg_basebackup \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "-W --password"}}, {"summary": "\u8f93\u51fa pg_basebackup \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "-V --version"}}, {"summary": "\u663e\u793a pg_basebackup \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/12/app-pgbasebackup.html", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}], "options": [{"names": ["-D directory", "--pgdata= directory"], "summary": "Directory to write the output to. pg_basebackup will create the directory and any parent directories if necessary. The directory may already exist, but it is an error if the directory already exists and is not empty.", "signature": "-D directory --pgdata= directory", "source_url": "/docs/12/app-pgbasebackup.html", "description": "Directory to write the output to. pg_basebackup will create the directory and any parent directories if necessary. The directory may already exist, but it is an error if the directory already exists and is not empty. When the backup is in tar mode, and the directory is specified as - (dash), the tar file will be written to stdout . This option is required."}, {"names": ["-F format", "--format= format"], "summary": "Selects the format for the output. format can be one of the following:", "signature": "-F format --format= format", "source_url": "/docs/12/app-pgbasebackup.html", "description": "Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the current data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory will be written to a file named base.tar , and all other tablespaces will be named after the tablespace OID. If the value - (dash) is specified as target directory, the tar contents will be written to standard output, suitable for piping to for example gzip . This is only possible if the cluster has no additional tablespaces and WAL streaming is not used."}, {"names": ["-r rate", "--max-rate= rate"], "summary": "The maximum transfer rate of data transferred from the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second.", "signature": "-r rate --max-rate= rate", "source_url": "/docs/12/app-pgbasebackup.html", "description": "The maximum transfer rate of data transferred from the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. The purpose is to limit the impact of pg_basebackup on the running server. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch ."}, {"names": ["-R", "--write-recovery-conf"], "summary": "Create standby.signal file and append connection settings to postgresql.auto.conf in the output directory (or into the base archive file when using tar format) to ease setting up a standby server. The postgresql.auto.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that the streaming replication will use the same settings later on.", "signature": "-R --write-recovery-conf", "source_url": "/docs/12/app-pgbasebackup.html", "description": "Create standby.signal file and append connection settings to postgresql.auto.conf in the output directory (or into the base archive file when using tar format) to ease setting up a standby server. The postgresql.auto.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that the streaming replication will use the same settings later on."}, {"names": ["-T olddir = newdir", "--tablespace-mapping= olddir = newdir"], "summary": "Relocate the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is currently defined. (But it is not an error if there is no tablespace in olddir contained in the backup.) Both olddir and newdir must be absolute paths. If a path happens to contain a = sign, escape it with a backslash. This option can be specified multiple times for multiple tablespaces. See examples below.", "signature": "-T olddir = newdir --tablespace-mapping= olddir = newdir", "source_url": "/docs/12/app-pgbasebackup.html", "description": "Relocate the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is currently defined. (But it is not an error if there is no tablespace in olddir contained in the backup.) Both olddir and newdir must be absolute paths. If a path happens to contain a = sign, escape it with a backslash. This option can be specified multiple times for multiple tablespaces. See examples below. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected."}, {"names": ["--waldir= waldir"], "summary": "Specifies the location for the write-ahead log directory. waldir must be an absolute path. The write-ahead log directory can only be specified when the backup is in plain mode.", "signature": "--waldir= waldir", "source_url": "/docs/12/app-pgbasebackup.html", "description": "Specifies the location for the write-ahead log directory. waldir must be an absolute path. The write-ahead log directory can only be specified when the backup is in plain mode."}, {"names": ["-X method", "--wal-method= method"], "summary": "Includes the required write-ahead log files (WAL files) in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster directly in the extracted directory without the need to consult the log archive, thus making this a completely standalone backup.", "signature": "-X method --wal-method= method", "source_url": "/docs/12/app-pgbasebackup.html", "description": "Includes the required write-ahead log files (WAL files) in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster directly in the extracted directory without the need to consult the log archive, thus making this a completely standalone backup. The following methods for collecting the write-ahead logs are supported: n none Don't include write-ahead log in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the wal_keep_segments parameter to be set high enough that the log is not removed before the end of the backup. If the log has been rotated when it's time to transfer it, the backup will fail and be unusable. When tar format mode is used, the write-ahead log files will be written to the base.tar file. s stream Stream the write-ahead log while the backup is created. This will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will use up two connections configured by the max_wal_senders parameter. As long as the client can keep up with write-ahead log received, using this mode requires no extra write-ahead logs to be saved on the master. When tar format mode is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default."}, {"names": ["-z", "--gzip"], "summary": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "signature": "-z --gzip", "source_url": "/docs/12/app-pgbasebackup.html", "description": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-Z level", "--compress= level"], "summary": "Enables gzip compression of tar file output, and specifies the compression level (0 through 9, 0 being no compression and 9 being best compression). Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "signature": "-Z level --compress= level", "source_url": "/docs/12/app-pgbasebackup.html", "description": "Enables gzip compression of tar file output, and specifies the compression level (0 through 9, 0 being no compression and 9 being best compression). Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-c fast|spread", "--checkpoint= fast|spread"], "summary": "Sets checkpoint mode to fast (immediate) or spread (default) (see Section 25.3.3 ).", "signature": "-c fast|spread --checkpoint= fast|spread", "source_url": "/docs/12/app-pgbasebackup.html", "description": "Sets checkpoint mode to fast (immediate) or spread (default) (see Section 25.3.3 )."}, {"names": ["-C", "--create-slot"], "summary": "This option causes creation of a replication slot named by the --slot option before starting the backup. An error is raised if the slot already exists.", "signature": "-C --create-slot", "source_url": "/docs/12/app-pgbasebackup.html", "description": "This option causes creation of a replication slot named by the --slot option before starting the backup. An error is raised if the slot already exists."}, {"names": ["-l label", "--label= label"], "summary": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used.", "signature": "-l label --label= label", "source_url": "/docs/12/app-pgbasebackup.html", "description": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used."}, {"names": ["-n", "--no-clean"], "summary": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, data directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging.", "signature": "-n --no-clean", "source_url": "/docs/12/app-pgbasebackup.html", "description": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, data directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way."}, {"names": ["-N", "--no-sync"], "summary": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.", "signature": "-N --no-sync", "source_url": "/docs/12/app-pgbasebackup.html", "description": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."}, {"names": ["-P", "--progress"], "summary": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.", "signature": "-P --progress", "source_url": "/docs/12/app-pgbasebackup.html", "description": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL. When this is enabled, the backup will start by enumerating the size of the entire database, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent."}, {"names": ["-S slotname", "--slot= slotname"], "summary": "This option can only be used together with -X stream . It causes the WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming replication standby using replication slots, it should then use the same replication slot name in primary_slot_name . That way, it is ensured that the server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication.", "signature": "-S slotname --slot= slotname", "source_url": "/docs/12/app-pgbasebackup.html", "description": "This option can only be used together with -X stream . It causes the WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming replication standby using replication slots, it should then use the same replication slot name in primary_slot_name . That way, it is ensured that the server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication. The specified replication slot has to exist unless the option -C is also used. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming."}, {"names": ["-v", "--verbose"], "summary": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.", "signature": "-v --verbose", "source_url": "/docs/12/app-pgbasebackup.html", "description": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."}, {"names": ["--no-slot"], "summary": "This option prevents the creation of a temporary replication slot during the backup even if it's supported by the server.", "signature": "--no-slot", "source_url": "/docs/12/app-pgbasebackup.html", "description": "This option prevents the creation of a temporary replication slot during the backup even if it's supported by the server. Temporary replication slots are created by default if no slot name is given with the option -S when using log streaming. The main purpose of this option is to allow taking a base backup when the server is out of free replication slots. Using replication slots is almost always preferred, because it prevents needed WAL from being removed by the server during the backup."}, {"names": ["--no-verify-checksums"], "summary": "Disables verification of checksums, if they are enabled on the server the base backup is taken from.", "signature": "--no-verify-checksums", "source_url": "/docs/12/app-pgbasebackup.html", "description": "Disables verification of checksums, if they are enabled on the server the base backup is taken from. By default, checksums are verified and checksum failures will result in a non-zero exit status. However, the base backup will not be removed in such a case, as if the --no-clean option had been used. Checksum verifications failures will also be reported in the pg_stat_database view."}, {"names": ["-d connstr", "--dbname= connstr"], "summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": "-d connstr --dbname= connstr", "source_url": "/docs/12/app-pgbasebackup.html", "description": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. The option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, database name in the connection string will be ignored."}, {"names": ["-h host", "--host= host"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "signature": "-h host --host= host", "source_url": "/docs/12/app-pgbasebackup.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "signature": "-p port --port= port", "source_url": "/docs/12/app-pgbasebackup.html", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-s interval", "--status-interval= interval"], "summary": "Specifies the number of seconds between status packets sent back to the server. This allows for easier monitoring of the progress from server. A value of zero disables the periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout disconnect. The default value is 10 seconds.", "signature": "-s interval --status-interval= interval", "source_url": "/docs/12/app-pgbasebackup.html", "description": "Specifies the number of seconds between status packets sent back to the server. This allows for easier monitoring of the progress from server. A value of zero disables the periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout disconnect. The default value is 10 seconds."}, {"names": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/12/app-pgbasebackup.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/12/app-pgbasebackup.html", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "summary": "Force pg_basebackup to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/12/app-pgbasebackup.html", "description": "Force pg_basebackup to prompt for a password before connecting to a database. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["-V", "--version"], "summary": "Print the pg_basebackup version and exit.", "signature": "-V --version", "source_url": "/docs/12/app-pgbasebackup.html", "description": "Print the pg_basebackup version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about pg_basebackup command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/12/app-pgbasebackup.html", "description": "Show help about pg_basebackup command line arguments, and exit."}], "related": [{"url": "/wiki/conn/?v=12", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v12.22/postgresql-12.22.tar.bz2", "label": "12.22", "major": "12", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/12/postgresql-12-A4.pdf", "bytes": 13424351, "pages": 2803, "sha256": "7422cf53fd1939e7a3d2925231a88b0330e468afa5393627cac0ff86158a0621", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/12/postgresql-12-US.pdf", "bytes": 13322565, "pages": 2958, "sha256": "51f3b04e72907fc38512685946223452ea65f84419c60c66241dfa3396035e77", "built_at": "2026-09-26"}}, "tree": "12", "index": "index.html", "major": "12", "pages": 1131, "release": "12.22", "source_url": "https://ftp.postgresql.org/pub/source/v12.22/postgresql-12.22.tar.bz2", "svg_assets": 2, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "8df3c0474782589d3c6f374b5133b1bd14d168086edbc13c6e72e67dd4527a3b"}, "revision": "7a827e97cbfacd7febff75f34443e2043e40723de5b6d8c9d81a9430b65a37e4", "evidence_kind": "English manual and source declarations", "source_sha256": "8df3c0474782589d3c6f374b5133b1bd14d168086edbc13c6e72e67dd4527a3b"}, "sources": [{"url": "https://pg.center/docs/12/app-pgbasebackup.html", "file": "app-pgbasebackup.html", "label": "12.22 English manual \u00b7 app-pgbasebackup.html", "anchor": "", "sha256": "d787f26a12af978ff302a05a3ff490a2f9068935e6b833649aa0f85bd7e7bee9", "language": "en", "original_url": "/docs/12/app-pgbasebackup.html"}, {"url": "https://pg.center/docs/12/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "089624dd131f52eea682b304f87a1acb03392ee7bcf78b000699c9b17c7ca22d", "language": "en", "original_url": "/docs/12/reference-client.html"}], "sections": [], "synopsis": ["pg_basebackup [ option ...]"], "signature": "pg_basebackup [ option ...]", "description": ["pg_basebackup \u2014 \u83b7\u53d6 PostgreSQL \u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd"], "environment": [], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGBASEBACKUP\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\">pg_basebackup</span></h2>\n<p lang=\"zh\">pg_basebackup \u2014 \u83b7\u53d6<span class=\"productname\">PostgreSQL</span>\u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.9.4.1\"><code class=\"command\">pg_basebackup</code> [<em class=\"replaceable\"><code>option</code></em>...]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.9.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u7528\u4e8e\u83b7\u53d6\u6b63\u5728\u8fd0\u884c\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd\u3002\u5907\u4efd\u8fc7\u7a0b\u4e0d\u4f1a\u5f71\u54cd\u6570\u636e\u5e93\u7684\u5176\u4ed6\u5ba2\u6237\u7aef\uff0c\u5e76\u4e14\u8be5\u5907\u4efd\u65e2\u53ef\u7528\u4e8e\u65f6\u95f4\u70b9\u6062\u590d\uff08\u89c1<a class=\"xref\" href=\"/docs/12/continuous-archiving.html\" title=\"25.3.\u00a0\u6301\u7eed\u5f52\u6863\u548c\u65f6\u95f4\u70b9\u6062\u590d\uff08PITR\uff09\">\u7b2c\u00a025.3\u00a0\u8282</a>\uff09\uff0c\u4e5f\u53ef\u7528\u4f5c\u65e5\u5fd7\u4f20\u9001\u6216\u6d41\u590d\u5236\u5907\u5e93\u7684\u8d77\u70b9\uff08\u89c1<a class=\"xref\" href=\"/docs/12/warm-standby.html\" title=\"26.2.\u00a0\u65e5\u5fd7\u4f20\u9001\u5907\u5e93\">\u7b2c\u00a026.2\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u6587\u4ef6\u7684\u4e8c\u8fdb\u5236\u526f\u672c\uff0c\u540c\u65f6\u786e\u4fdd\u7cfb\u7edf\u81ea\u52a8\u8fdb\u5165\u548c\u9000\u51fa\u5907\u4efd\u6a21\u5f0f\u3002\u5907\u4efd\u59cb\u7ec8\u9488\u5bf9\u6574\u4e2a\u6570\u636e\u5e93\u96c6\u7c07\uff1b\u65e0\u6cd5\u53ea\u5907\u4efd\u5355\u4e2a\u6570\u636e\u5e93\u6216\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u8981\u5907\u4efd\u5355\u4e2a\u6570\u636e\u5e93\uff0c\u5fc5\u987b\u4f7f\u7528<a class=\"xref\" href=\"/docs/12/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a>\u4e4b\u7c7b\u7684\u5de5\u5177\u3002</p>\n<p lang=\"zh\">\u5907\u4efd\u901a\u8fc7\u4f7f\u7528\u590d\u5236\u534f\u8bae\u7684\u666e\u901a<span class=\"productname\">PostgreSQL</span>\u8fde\u63a5\u8fdb\u884c\u3002\u5efa\u7acb\u8fde\u63a5\u65f6\u5fc5\u987b\u4f7f\u7528\u8d85\u7ea7\u7528\u6237\u6216\u5177\u6709<code class=\"literal\">REPLICATION</code>\u6743\u9650\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/12/role-attributes.html\" title=\"21.2.\u00a0\u89d2\u8272\u5c5e\u6027\">\u7b2c\u00a021.2\u00a0\u8282</a>\uff09\u7684\u7528\u6237\uff0c\u5e76\u4e14<code class=\"filename\">pg_hba.conf</code>\u5fc5\u987b\u660e\u786e\u5141\u8bb8\u590d\u5236\u8fde\u63a5\u3002\u670d\u52a1\u5668\u8fd8\u5fc5\u987b\u5c06<a class=\"xref\" href=\"/docs/12/runtime-config-replication.html#GUC-MAX-WAL-SENDERS\">max_wal_senders</a>\u8bbe\u7f6e\u5f97\u8db3\u591f\u9ad8\uff0c\u4ee5\u4fbf\u81f3\u5c11\u4e3a\u5907\u4efd\u4fdd\u7559\u4e00\u4e2a\u53ef\u7528\u4f1a\u8bdd\uff0c\u5e76\u5728\u4f7f\u7528 WAL \u6d41\u5f0f\u4f20\u8f93\u65f6\u518d\u4e3a\u5176\u4fdd\u7559\u4e00\u4e2a\u4f1a\u8bdd\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u540c\u65f6\u8fd0\u884c\u591a\u4e2a<code class=\"command\">pg_basebackup</code>\uff0c\u4f46\u4ece\u6027\u80fd\u89d2\u5ea6\u6765\u770b\uff0c\u6700\u597d\u53ea\u6267\u884c\u4e00\u6b21\u5907\u4efd\uff0c\u7136\u540e\u590d\u5236\u5176\u7ed3\u679c\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u4e0d\u4ec5\u53ef\u4ee5\u4ece\u4e3b\u5e93\u83b7\u53d6\u57fa\u7840\u5907\u4efd\uff0c\u4e5f\u53ef\u4ee5\u4ece\u5907\u5e93\u83b7\u53d6\u3002\u8981\u4ece\u5907\u5e93\u83b7\u53d6\u5907\u4efd\uff0c\u9700\u8981\u5c06\u5907\u5e93\u914d\u7f6e\u4e3a\u80fd\u591f\u63a5\u53d7\u590d\u5236\u8fde\u63a5\uff08\u5373\u8bbe\u7f6e<code class=\"varname\">max_wal_senders</code>\u548c<a class=\"xref\" href=\"/docs/12/runtime-config-replication.html#GUC-HOT-STANDBY\">hot_standby</a>\uff0c\u5e76\u914d\u7f6e<a class=\"link\" href=\"/docs/12/client-authentication.html#AUTH-PG-HBA-CONF\" title=\"20.1.\u00a0pg_hba.conf \u6587\u4ef6\">\u57fa\u4e8e\u4e3b\u673a\u7684\u8ba4\u8bc1</a>\uff09\u3002\u8fd8\u9700\u8981\u5728\u4e3b\u5e93\u4e0a\u542f\u7528<a class=\"xref\" href=\"/docs/12/runtime-config-wal.html#GUC-FULL-PAGE-WRITES\">full_page_writes</a>\u3002</p>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u4ece\u5907\u5e93\u83b7\u53d6\u5728\u7ebf\u5907\u4efd\u65f6\u6709\u4e00\u4e9b\u9650\u5236\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5907\u4efd\u5386\u53f2\u6587\u4ef6\u4e0d\u4f1a\u5728\u88ab\u5907\u4efd\u7684\u6570\u636e\u5e93\u96c6\u7c07\u4e2d\u521b\u5efa\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">pg_basebackup</span>\u65e0\u6cd5\u5f3a\u5236\u5907\u5e93\u5728\u5907\u4efd\u7ed3\u675f\u65f6\u5207\u6362\u5230\u65b0\u7684 WAL \u6587\u4ef6\u3002\u5f53\u4f7f\u7528<code class=\"literal\">-X none</code>\u65f6\uff0c\u5982\u679c\u4e3b\u5e93\u4e0a\u7684\u5199\u5165\u6d3b\u52a8\u8f83\u5c11\uff0c<span class=\"application\">pg_basebackup</span>\u53ef\u80fd\u9700\u8981\u957f\u65f6\u95f4\u7b49\u5f85\uff0c\u76f4\u5230\u5907\u4efd\u6240\u9700\u7684\u6700\u540e\u4e00\u4e2a WAL \u6587\u4ef6\u88ab\u5207\u6362\u5e76\u5f52\u6863\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5728\u4e3b\u5e93\u4e0a\u8fd0\u884c<code class=\"function\">pg_switch_wal</code>\uff0c\u4ee5\u7acb\u5373\u89e6\u53d1 WAL \u6587\u4ef6\u5207\u6362\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5982\u679c\u5907\u5e93\u5728\u5728\u7ebf\u5907\u4efd\u8fc7\u7a0b\u4e2d\u88ab\u63d0\u5347\u4e3a\u4e3b\u5e93\uff0c\u5219\u5907\u4efd\u4f1a\u5931\u8d25\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5907\u4efd\u6240\u9700\u7684\u6240\u6709 WAL \u8bb0\u5f55\u90fd\u5fc5\u987b\u5305\u542b\u8db3\u591f\u7684\u6574\u9875\u5199\u5165\uff0c\u56e0\u6b64\u5fc5\u987b\u5728\u4e3b\u5e93\u4e0a\u542f\u7528<code class=\"varname\">full_page_writes</code>\uff0c\u5e76\u4e14\u4e0d\u80fd\u628a<span class=\"application\">pg_compresslog</span>\u4e4b\u7c7b\u7684\u5de5\u5177\u7528\u4f5c<code class=\"varname\">archive_command</code>\uff0c\u4ece WAL \u6587\u4ef6\u4e2d\u79fb\u9664\u6574\u9875\u5199\u5165\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.9.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u8f93\u51fa\u7684\u4f4d\u7f6e\u548c\u683c\u5f0f\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>directory</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u5199\u5165\u8f93\u51fa\u7684\u76ee\u6807\u76ee\u5f55\u3002\u5982\u679c\u8be5\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u521b\u5efa\u5b83\uff08\u4ee5\u53ca\u6240\u6709\u7f3a\u5931\u7684\u7236\u76ee\u5f55\uff09\u3002\u5982\u679c\u8be5\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002</p>\n<p lang=\"zh\">\u5f53\u5907\u4efd\u91c7\u7528 tar \u683c\u5f0f\u65f6\uff0c\u76ee\u6807\u76ee\u5f55\u53ef\u4ee5\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff08\u77ed\u6a2a\u7ebf\uff09\uff0c\u4ece\u800c\u5c06 tar \u6587\u4ef6\u5199\u5230<code class=\"literal\">stdout</code>\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u662f\u5fc5\u9700\u7684\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>format</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--format=<em class=\"replaceable\"><code>format</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u9009\u62e9\u8f93\u51fa\u683c\u5f0f\u3002<em class=\"replaceable\"><code>format</code></em>\u53ef\u4ee5\u662f\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">p</code><br/></span><span class=\"term\"><code class=\"literal\">plain</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u5199\u4e3a\u666e\u901a\u6587\u4ef6\uff0c\u5176\u5e03\u5c40\u4e0e\u6e90\u670d\u52a1\u5668\u7684\u6570\u636e\u76ee\u5f55\u548c\u8868\u7a7a\u95f4\u76f8\u540c\u3002\u5f53\u96c6\u7c07\u6ca1\u6709\u989d\u5916\u8868\u7a7a\u95f4\u65f6\uff0c\u6574\u4e2a\u6570\u636e\u5e93\u90fd\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u3002\u5982\u679c\u96c6\u7c07\u5305\u542b\u989d\u5916\u8868\u7a7a\u95f4\uff0c\u5219\u4e3b\u6570\u636e\u76ee\u5f55\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\uff0c\u800c\u5176\u4ed6\u6240\u6709\u8868\u7a7a\u95f4\u90fd\u4f1a\u653e\u5728\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u76f8\u540c\u7684\u7edd\u5bf9\u8def\u5f84\u4e2d\u3002\uff08\u5982\u9700\u6539\u53d8\u8fd9\u4e00\u70b9\uff0c\u89c1<code class=\"option\">--tablespace-mapping</code>\u3002\uff09</p>\n<p lang=\"zh\">\u8fd9\u662f\u9ed8\u8ba4\u683c\u5f0f\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">t</code><br/></span><span class=\"term\"><code class=\"literal\">tar</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u5199\u4e3a\u76ee\u6807\u76ee\u5f55\u4e2d\u7684 tar \u6587\u4ef6\u3002\u4e3b\u6570\u636e\u76ee\u5f55\u7684\u5185\u5bb9\u4f1a\u5199\u5165\u540d\u4e3a<code class=\"filename\">base.tar</code>\u7684\u6587\u4ef6\u4e2d\uff0c\u800c\u6bcf\u4e2a\u5176\u4ed6\u8868\u7a7a\u95f4\u90fd\u4f1a\u5199\u5165\u4e00\u4e2a\u4ee5\u8be5\u8868\u7a7a\u95f4 OID \u547d\u540d\u7684\u72ec\u7acb tar \u6587\u4ef6\u4e2d\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u76ee\u6807\u76ee\u5f55\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff08\u77ed\u6a2a\u7ebf\uff09\uff0ctar \u5185\u5bb9\u5c06\u5199\u5165\u6807\u51c6\u8f93\u51fa\uff0c\u9002\u5408\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u4f8b\u5982<span class=\"productname\">gzip</span>\u3002\u53ea\u6709\u5f53\u96c6\u7c07\u6ca1\u6709\u989d\u5916\u8868\u7a7a\u95f4\u4e14\u672a\u4f7f\u7528 WAL \u6d41\u5f0f\u4f20\u8f93\u65f6\uff0c\u624d\u5141\u8bb8\u8fd9\u6837\u505a\u3002</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r <em class=\"replaceable\"><code>rate</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--max-rate=<em class=\"replaceable\"><code>rate</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ece\u670d\u52a1\u5668\u4f20\u8f93\u6570\u636e\u7684\u6700\u5927\u901f\u7387\u3002\u5355\u4f4d\u4e3a\u6bcf\u79d2\u5343\u5b57\u8282\u3002\u4f7f\u7528\u540e\u7f00<code class=\"literal\">M</code>\u8868\u793a\u6bcf\u79d2\u5146\u5b57\u8282\u3002\u4e5f\u63a5\u53d7\u540e\u7f00<code class=\"literal\">k</code>\uff0c\u4f46\u5b83\u6ca1\u6709\u6548\u679c\u3002\u6709\u6548\u503c\u4ecb\u4e8e\u6bcf\u79d2 32 \u5343\u5b57\u8282\u548c\u6bcf\u79d2 1024 \u5146\u5b57\u8282\u4e4b\u95f4\u3002</p>\n<p lang=\"zh\">\u76ee\u7684\u662f\u9650\u5236<span class=\"application\">pg_basebackup</span>\u5bf9\u8fd0\u884c\u4e2d\u7684\u670d\u52a1\u5668\u7684\u5f71\u54cd\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u59cb\u7ec8\u5f71\u54cd\u6570\u636e\u76ee\u5f55\u7684\u4f20\u8f93\u3002\u53ea\u6709\u5f53\u6536\u96c6\u65b9\u6cd5\u4e3a<code class=\"literal\">fetch</code>\u65f6\uff0cWAL \u6587\u4ef6\u7684\u4f20\u8f93\u624d\u4f1a\u53d7\u5230\u5f71\u54cd\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code><br/></span><span class=\"term\"><code class=\"option\">--write-recovery-conf</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u521b\u5efa<a class=\"link\" href=\"/docs/12/warm-standby.html#FILE-STANDBY-SIGNAL\"><code class=\"filename\">standby.signal</code></a><a class=\"indexterm\" id=\"id-1.9.4.9.6.2.1.4.3.1.2\" name=\"id-1.9.4.9.6.2.1.4.3.1.2\"></a>\u6587\u4ef6\uff0c\u5e76\u5c06\u8fde\u63a5\u8bbe\u7f6e\u8ffd\u52a0\u5230\u8f93\u51fa\u76ee\u5f55\u4e2d\u7684<code class=\"filename\">postgresql.auto.conf</code>\uff08\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u5219\u4f4d\u4e8e\u57fa\u7840\u5f52\u6863\u6587\u4ef6\u4e2d\uff09\uff0c\u4ee5\u4fbf\u8bbe\u7f6e\u5907\u5e93\u3002<code class=\"filename\">postgresql.auto.conf</code>\u6587\u4ef6\u4f1a\u8bb0\u5f55<span class=\"application\">pg_basebackup</span>\u6240\u7528\u7684\u8fde\u63a5\u8bbe\u7f6e\u4ee5\u53ca\u590d\u5236\u69fd\uff08\u5982\u679c\u6307\u5b9a\u4e86\uff09\uff0c\u4ee5\u4fbf\u6d41\u590d\u5236\u4ee5\u540e\u4f7f\u7528\u76f8\u540c\u7684\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>olddir</code></em>=<em class=\"replaceable\"><code>newdir</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--tablespace-mapping=<em class=\"replaceable\"><code>olddir</code></em>=<em class=\"replaceable\"><code>newdir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u671f\u95f4\uff0c\u5c06\u76ee\u5f55<em class=\"replaceable\"><code>olddir</code></em>\u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230<em class=\"replaceable\"><code>newdir</code></em>\u3002\u8981\u4f7f\u6b64\u9009\u9879\u751f\u6548\uff0c<em class=\"replaceable\"><code>olddir</code></em>\u5fc5\u987b\u4e0e\u8be5\u8868\u7a7a\u95f4\u5f53\u524d\u5b9a\u4e49\u7684\u8def\u5f84\u5b8c\u5168\u4e00\u81f4\u3002\uff08\u4f46\u5982\u679c\u5907\u4efd\u4e2d\u6ca1\u6709\u4f4d\u4e8e<em class=\"replaceable\"><code>olddir</code></em>\u4e2d\u7684\u8868\u7a7a\u95f4\uff0c\u4e5f\u4e0d\u7b97\u9519\u8bef\u3002\uff09<em class=\"replaceable\"><code>olddir</code></em>\u548c<em class=\"replaceable\"><code>newdir</code></em>\u90fd\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u5982\u679c\u8def\u5f84\u4e2d\u5305\u542b<code class=\"literal\">=</code>\u7b26\u53f7\uff0c\u8bf7\u7528\u53cd\u659c\u7ebf\u8f6c\u4e49\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u4ee5\u5904\u7406\u591a\u4e2a\u8868\u7a7a\u95f4\u3002\u53c2\u89c1\u4e0b\u6587\u793a\u4f8b\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u91cd\u5b9a\u4f4d\u8868\u7a7a\u95f4\uff0c\u4e3b\u6570\u636e\u76ee\u5f55\u4e2d\u7684\u7b26\u53f7\u94fe\u63a5\u5c06\u88ab\u66f4\u65b0\u4e3a\u6307\u5411\u65b0\u4f4d\u7f6e\u3002\u56e0\u6b64\uff0c\u65b0\u6570\u636e\u76ee\u5f55\u5df2\u53ef\u76f4\u63a5\u7528\u4e8e\u542f\u52a8\u4e00\u4e2a\u6240\u6709\u8868\u7a7a\u95f4\u90fd\u4f4d\u4e8e\u66f4\u65b0\u540e\u4f4d\u7f6e\u7684\u65b0\u670d\u52a1\u5668\u5b9e\u4f8b\u3002</p>\n<p lang=\"zh\">\u76ee\u524d\uff0c\u6b64\u9009\u9879\u4ec5\u9002\u7528\u4e8e\u666e\u901a\u6587\u4ef6\u8f93\u51fa\u683c\u5f0f\uff1b\u5982\u679c\u9009\u62e9\u4e86 tar \u683c\u5f0f\uff0c\u5219\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--waldir=<em class=\"replaceable\"><code>waldir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\u7684\u4f4d\u7f6e\u3002<em class=\"replaceable\"><code>waldir</code></em>\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u53ea\u6709\u5728\u5907\u4efd\u91c7\u7528\u666e\u901a\u6587\u4ef6\u6a21\u5f0f\u65f6\uff0c\u624d\u80fd\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-X <em class=\"replaceable\"><code>method</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--wal-method=<em class=\"replaceable\"><code>method</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u4e2d\u5305\u542b\u6240\u9700\u7684 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u3002\u8fd9\u5c06\u5305\u62ec\u5907\u4efd\u671f\u95f4\u751f\u6210\u7684\u6240\u6709\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u9664\u975e\u6307\u5b9a\u65b9\u6cd5<code class=\"literal\">none</code>\uff0c\u5426\u5219\u5c31\u53ef\u4ee5\u5728\u89e3\u5305\u540e\u7684\u76ee\u5f55\u4e2d\u542f\u52a8 postmaster\uff0c\u800c\u65e0\u9700\u67e5\u9605 WAL \u5f52\u6863\uff0c\u4ece\u800c\u4f7f\u8f93\u51fa\u6210\u4e3a\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u5907\u4efd\u3002</p>\n<p lang=\"zh\">\u652f\u6301\u4ee5\u4e0b\u6536\u96c6\u9884\u5199\u5f0f\u65e5\u5fd7\u7684\u65b9\u6cd5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">n</code><br/></span><span class=\"term\"><code class=\"literal\">none</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u5728\u5907\u4efd\u4e2d\u5305\u542b\u9884\u5199\u5f0f\u65e5\u5fd7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">f</code><br/></span><span class=\"term\"><code class=\"literal\">fetch</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u7ed3\u675f\u65f6\u6536\u96c6\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u3002\u56e0\u6b64\uff0c<a class=\"xref\" href=\"/docs/12/runtime-config-replication.html#GUC-WAL-KEEP-SEGMENTS\">wal_keep_segments</a>\u53c2\u6570\u5fc5\u987b\u8bbe\u7f6e\u5f97\u8db3\u591f\u9ad8\uff0c\u4ee5\u786e\u4fdd\u5728\u5907\u4efd\u7ed3\u675f\u524d\u4e0d\u4f1a\u79fb\u9664\u6240\u9700\u7684\u65e5\u5fd7\u6570\u636e\u3002\u5982\u679c\u5728\u4f20\u8f93\u8fd9\u4e9b\u6570\u636e\u4e4b\u524d\u5b83\u4eec\u5df2\u7ecf\u88ab\u56de\u6536\uff0c\u5219\u5907\u4efd\u4f1a\u5931\u8d25\u5e76\u4e14\u65e0\u6cd5\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u4f1a\u5305\u542b\u5728<code class=\"filename\">base.tar</code>\u6587\u4ef6\u4e2d\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">s</code><br/></span><span class=\"term\"><code class=\"literal\">stream</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u521b\u5efa\u5907\u4efd\u7684\u540c\u65f6\u6d41\u5f0f\u4f20\u8f93\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u8fd9\u4f1a\u6253\u5f00\u4e0e\u670d\u52a1\u5668\u7684\u7b2c\u4e8c\u4e2a\u8fde\u63a5\uff0c\u5e76\u5728\u6267\u884c\u5907\u4efd\u65f6\u5e76\u884c\u5f00\u59cb\u6d41\u5f0f\u4f20\u8f93\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u56e0\u6b64\uff0c\u5b83\u4f1a\u5360\u7528\u7531<a class=\"xref\" href=\"/docs/12/runtime-config-replication.html#GUC-MAX-WAL-SENDERS\">max_wal_senders</a>\u53c2\u6570\u914d\u7f6e\u7684\u4e24\u4e2a\u8fde\u63a5\u3002\u53ea\u8981\u5ba2\u6237\u7aef\u80fd\u591f\u8ddf\u4e0a\u63a5\u6536\u5230\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\uff0c\u4f7f\u7528\u6b64\u6a21\u5f0f\u5c31\u4e0d\u9700\u8981\u5728\u4e3b\u5e93\u4e0a\u989d\u5916\u4fdd\u7559\u9884\u5199\u5f0f\u65e5\u5fd7\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u4f1a\u5199\u5165\u4e00\u4e2a\u540d\u4e3a<code class=\"filename\">pg_wal.tar</code>\u7684\u72ec\u7acb\u6587\u4ef6\u4e2d\uff08\u5982\u679c\u670d\u52a1\u5668\u7248\u672c\u65e9\u4e8e 10\uff0c\u5219\u6587\u4ef6\u540d\u4e3a<code class=\"filename\">pg_xlog.tar</code>\uff09\u3002</p>\n<p lang=\"zh\">\u8fd9\u662f\u9ed8\u8ba4\u503c\u3002</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-z</code><br/></span><span class=\"term\"><code class=\"option\">--gzip</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u4f7f\u7528\u9ed8\u8ba4\u538b\u7f29\u7ea7\u522b\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0<code class=\"filename\">.gz</code>\u540e\u7f00\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-Z <em class=\"replaceable\"><code>level</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--compress=<em class=\"replaceable\"><code>level</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u5e76\u6307\u5b9a\u538b\u7f29\u7ea7\u522b\uff080 \u5230 9\uff0c\u5176\u4e2d 0 \u8868\u793a\u4e0d\u538b\u7f29\uff0c9 \u8868\u793a\u6700\u4f73\u538b\u7f29\uff09\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0<code class=\"filename\">.gz</code>\u540e\u7f00\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u5907\u4efd\u7684\u751f\u6210\u548c\u7a0b\u5e8f\u7684\u8fd0\u884c\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>fast|spread</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--checkpoint=<em class=\"replaceable\"><code>fast|spread</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u68c0\u67e5\u70b9\u6a21\u5f0f\u8bbe\u7f6e\u4e3a fast\uff08\u7acb\u5373\uff09\u6216 spread\uff08\u9ed8\u8ba4\uff09\uff08\u89c1<a class=\"xref\" href=\"/docs/12/continuous-archiving.html#BACKUP-LOWLEVEL-BASE-BACKUP\" title=\"25.3.3.\u00a0\u4f7f\u7528\u4f4e\u7ea7 API \u8fdb\u884c\u57fa\u7840\u5907\u4efd\">\u7b2c\u00a025.3.3\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--create-slot</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728\u5f00\u59cb\u5907\u4efd\u4e4b\u524d\uff0c\u5e94\u521b\u5efa\u7531<code class=\"literal\">--slot</code>\u9009\u9879\u6307\u5b9a\u540d\u79f0\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u8be5\u69fd\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u9519\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>label</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--label=<em class=\"replaceable\"><code>label</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5907\u4efd\u6807\u7b7e\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u503c<span class=\"quote\">\u201c<span class=\"quote\"><code class=\"literal\">pg_basebackup base backup</code></span>\u201d</span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-clean</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53<code class=\"command\">pg_basebackup</code>\u56e0\u9519\u8bef\u4e2d\u6b62\u65f6\uff0c\u5b83\u4f1a\u5220\u9664\u5728\u53d1\u73b0\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u76ee\u5f55\uff08\u4f8b\u5982\u6570\u636e\u76ee\u5f55\u548c\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\uff09\u3002\u6b64\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u5f88\u6709\u5e2e\u52a9\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u65e0\u8bba\u662f\u5426\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u8868\u7a7a\u95f4\u76ee\u5f55\u90fd\u4e0d\u4f1a\u88ab\u6e05\u7406\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N</code><br/></span><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">pg_basebackup</code>\u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u88ab\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f1a\u4f7f<code class=\"command\">pg_basebackup</code>\u4e0d\u7ecf\u7b49\u5f85\u5c31\u76f4\u63a5\u8fd4\u56de\uff0c\u56e0\u6b64\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u968f\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u57fa\u7840\u5907\u4efd\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u5408\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P</code><br/></span><span class=\"term\"><code class=\"option\">--progress</code></span></dt>\n<dd>\n<p lang=\"zh\">\u542f\u7528\u8fdb\u5ea6\u62a5\u544a\u3002\u6253\u5f00\u6b64\u9009\u9879\u540e\uff0c\u4f1a\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u7ed9\u51fa\u4e00\u4e2a\u8fd1\u4f3c\u7684\u8fdb\u5ea6\u62a5\u544a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u53d1\u751f\u53d8\u5316\uff0c\u56e0\u6b64\u8fd9\u53ea\u662f\u8fd1\u4f3c\u503c\uff0c\u6700\u7ec8\u672a\u5fc5\u6070\u597d\u7ed3\u675f\u5728<code class=\"literal\">100%</code>\u3002\u7279\u522b\u662f\u5f53\u5907\u4efd\u4e2d\u5305\u542b WAL \u65f6\uff0c\u603b\u6570\u636e\u91cf\u65e0\u6cd5\u9884\u5148\u4f30\u8ba1\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u65e6\u8fdb\u5ea6\u8d85\u8fc7\u4e0d\u542b WAL \u65f6\u7684\u603b\u4f30\u8ba1\u503c\uff0c\u4f30\u8ba1\u76ee\u6807\u5927\u5c0f\u5c31\u4f1a\u7ee7\u7eed\u589e\u52a0\u3002</p>\n<p lang=\"zh\">\u542f\u7528\u6b64\u9009\u9879\u540e\uff0c\u5907\u4efd\u4f1a\u5148\u904d\u5386\u6574\u4e2a\u6570\u636e\u5e93\u4ee5\u7edf\u8ba1\u5176\u5927\u5c0f\uff0c\u7136\u540e\u518d\u8fd4\u56de\u53d1\u9001\u5b9e\u9645\u5185\u5bb9\u3002\u8fd9\u53ef\u80fd\u4f7f\u5907\u4efd\u7a0d\u5fae\u8017\u65f6\u66f4\u957f\uff0c\u5c24\u5176\u4f1a\u4f7f\u9996\u6b21\u53d1\u9001\u6570\u636e\u4e4b\u524d\u7684\u7b49\u5f85\u65f6\u95f4\u66f4\u957f\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>slotname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--slot=<em class=\"replaceable\"><code>slotname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u53ea\u80fd\u4e0e<code class=\"literal\">-X stream</code>\u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u4f1a\u4f7f WAL \u6d41\u5f0f\u4f20\u8f93\u4f7f\u7528\u6307\u5b9a\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u6b64\u57fa\u7840\u5907\u4efd\u6253\u7b97\u7528\u4f5c\u4f7f\u7528\u590d\u5236\u69fd\u7684\u6d41\u590d\u5236\u5907\u5e93\uff0c\u90a3\u4e48\u8be5\u5907\u5e93\u5e94\u5728<a class=\"xref\" href=\"/docs/12/runtime-config-replication.html#GUC-PRIMARY-SLOT-NAME\">primary_slot_name</a>\u4e2d\u4f7f\u7528\u540c\u4e00\u4e2a\u590d\u5236\u69fd\u540d\u79f0\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u670d\u52a1\u5668\u5728\u57fa\u7840\u5907\u4efd\u7ed3\u675f\u4e0e\u5f00\u59cb\u6d41\u590d\u5236\u4e4b\u95f4\u7684\u8fd9\u6bb5\u65f6\u95f4\u5185\uff0c\u4e0d\u4f1a\u79fb\u9664\u4efb\u4f55\u5fc5\u9700\u7684 WAL \u6570\u636e\u3002</p>\n<p lang=\"zh\">\u6307\u5b9a\u7684\u590d\u5236\u69fd\u5fc5\u987b\u5df2\u7ecf\u5b58\u5728\uff0c\u9664\u975e\u8fd8\u540c\u65f6\u4f7f\u7528\u4e86<code class=\"option\">-C</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5e76\u4e14\u670d\u52a1\u5668\u652f\u6301\u4e34\u65f6\u590d\u5236\u69fd\uff0810 \u53ca\u4ee5\u4e0a\u7248\u672c\uff09\uff0c\u5219\u4f1a\u81ea\u52a8\u4f7f\u7528\u4e34\u65f6\u590d\u5236\u69fd\u8fdb\u884c WAL \u6d41\u5f0f\u4f20\u8f93\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\u3002\u5b83\u4f1a\u5728\u542f\u52a8\u548c\u5173\u95ed\u8fc7\u7a0b\u4e2d\u8f93\u51fa\u4e00\u4e9b\u989d\u5916\u6b65\u9aa4\uff1b\u5982\u679c\u540c\u65f6\u542f\u7528\u4e86\u8fdb\u5ea6\u62a5\u544a\uff0c\u8fd8\u4f1a\u663e\u793a\u5f53\u524d\u6b63\u5728\u5904\u7406\u7684\u786e\u5207\u6587\u4ef6\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-slot</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5373\u4f7f\u670d\u52a1\u5668\u652f\u6301\uff0c\u6b64\u9009\u9879\u4e5f\u4f1a\u963b\u6b62\u5728\u5907\u4efd\u671f\u95f4\u521b\u5efa\u4e34\u65f6\u590d\u5236\u69fd\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u9009\u62e9\u4e86 WAL \u6d41\u5f0f\u4f20\u8f93\uff0c\u4f46\u6ca1\u6709\u4f7f\u7528<code class=\"option\">-S</code>\u9009\u9879\u7ed9\u51fa\u69fd\u540d\uff0c\u90a3\u4e48\u4f1a\u521b\u5efa\u4e00\u4e2a\u4e34\u65f6\u590d\u5236\u69fd\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7684\u4e3b\u8981\u76ee\u7684\u662f\u5728\u670d\u52a1\u5668\u6ca1\u6709\u7a7a\u95f2\u590d\u5236\u69fd\u65f6\uff0c\u4ecd\u7136\u5141\u8bb8\u6267\u884c\u57fa\u7840\u5907\u4efd\u3002\u51e0\u4e4e\u603b\u662f\u9996\u9009\u4f7f\u7528\u590d\u5236\u69fd\uff0c\u56e0\u4e3a\u5b83\u80fd\u9632\u6b62\u670d\u52a1\u5668\u5728\u5907\u4efd\u671f\u95f4\u79fb\u9664\u6240\u9700\u7684 WAL\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-verify-checksums</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u83b7\u53d6\u57fa\u7840\u5907\u4efd\u7684\u670d\u52a1\u5668\u542f\u7528\u4e86\u6821\u9a8c\u548c\uff0c\u5219\u7981\u7528\u5bf9\u8fd9\u4e9b\u6821\u9a8c\u548c\u7684\u9a8c\u8bc1\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f1a\u9a8c\u8bc1\u6821\u9a8c\u548c\uff1b\u6821\u9a8c\u548c\u9a8c\u8bc1\u5931\u8d25\u5c06\u5bfc\u81f4\u975e\u96f6\u9000\u51fa\u72b6\u6001\u3002\u4e0d\u8fc7\uff0c\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u57fa\u7840\u5907\u4efd\u4e0d\u4f1a\u88ab\u5220\u9664\uff0c\u5c31\u50cf\u4f7f\u7528\u4e86<code class=\"option\">--no-clean</code>\u4e00\u6837\u3002\u6821\u9a8c\u548c\u9a8c\u8bc1\u5931\u8d25\u4e5f\u4f1a\u5728<a class=\"xref\" href=\"/docs/12/monitoring-stats.html#PG-STAT-DATABASE-VIEW\" title=\"\u8868\u00a027.12.\u00a0pg_stat_database \u89c6\u56fe\">pg_stat_database</a>\u89c6\u56fe\u4e2d\u62a5\u544a\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u6570\u636e\u5e93\u8fde\u63a5\u53c2\u6570\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>connstr</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>connstr</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ee5<a class=\"link\" href=\"/docs/12/libpq.html#LIBPQ-CONNSTRING\" title=\"33.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u7684\u5f62\u5f0f\u6307\u5b9a\u7528\u4e8e\u8fde\u63a5\u670d\u52a1\u5668\u7684\u53c2\u6570\uff1b\u8fd9\u4e9b\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u76f8\u4e92\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u51fa\u4e8e\u4e0e\u5176\u4ed6\u5ba2\u6237\u7aef\u5e94\u7528\u4fdd\u6301\u4e00\u81f4\u7684\u8003\u8651\uff0c\u6b64\u9009\u9879\u540d\u4e3a<code class=\"literal\">--dbname</code>\uff1b\u4f46\u7531\u4e8e<span class=\"application\">pg_basebackup</span>\u5e76\u4e0d\u8fde\u63a5\u5230\u96c6\u7c07\u4e2d\u7684\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u4e2d\u7684\u6570\u636e\u5e93\u540d\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea<code class=\"envar\">PGHOST</code>\u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff1b\u5426\u5219\u4f1a\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u6240\u4f7f\u7528\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u4f7f\u7528<code class=\"envar\">PGPORT</code>\u73af\u5883\u53d8\u91cf\u4e2d\u7684\u503c\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u786e\u5b9a\u7684\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s <em class=\"replaceable\"><code>interval</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--status-interval=<em class=\"replaceable\"><code>interval</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5411\u670d\u52a1\u5668\u56de\u9001\u72b6\u6001\u5305\u7684\u65f6\u95f4\u95f4\u9694\uff08\u79d2\uff09\u3002\u8fd9\u6837\u66f4\u4fbf\u4e8e\u4ece\u670d\u52a1\u5668\u7aef\u76d1\u89c6\u8fdb\u5ea6\u3002\u503c\u4e3a\u96f6\u5c06\u5b8c\u5168\u7981\u7528\u5468\u671f\u6027\u72b6\u6001\u66f4\u65b0\uff0c\u4e0d\u8fc7\u5728\u670d\u52a1\u5668\u8bf7\u6c42\u65f6\u4ecd\u4f1a\u53d1\u9001\u66f4\u65b0\uff0c\u4ee5\u907f\u514d\u56e0\u8d85\u65f6\u800c\u65ad\u5f00\u8fde\u63a5\u3002\u9ed8\u8ba4\u503c\u662f 10 \u79d2\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7981\u6b62\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\uff08\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff09\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u6b64\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u79cd\u573a\u666f\u4e0b\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236<span class=\"application\">pg_basebackup</span>\u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7edd\u975e\u5fc5\u9700\uff0c\u56e0\u4e3a\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u81ea\u52a8\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\u6765\u53d1\u73b0\u670d\u52a1\u5668\u9700\u8981\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u8f93\u5165<code class=\"option\">-W</code>\u4ee5\u907f\u514d\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u662f\u503c\u5f97\u7684\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5176\u4ed6\u9009\u9879\u4e5f\u53ef\u7528\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa<span class=\"application\">pg_basebackup</span>\u7684\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"application\">pg_basebackup</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.9.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6<span class=\"productname\">PostgreSQL</span>\u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528<span class=\"application\">libpq</span>\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/12/libpq-envars.html\" title=\"33.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a033.14\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\">\u73af\u5883\u53d8\u91cf<code class=\"envar\">PG_COLOR</code>\u6307\u5b9a\u662f\u5426\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a<code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c<code class=\"literal\">never</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.9.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u5728\u5907\u4efd\u5f00\u59cb\u65f6\uff0c\u9700\u8981\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u6267\u884c\u4e00\u6b21\u68c0\u67e5\u70b9\u3002\u8fd9\u53ef\u80fd\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\uff08\u5c24\u5176\u662f\u5728\u672a\u4f7f\u7528<code class=\"literal\">--checkpoint=fast</code>\u9009\u9879\u65f6\uff09\uff1b\u5728\u6b64\u671f\u95f4\uff0c<span class=\"application\">pg_basebackup</span>\u770b\u8d77\u6765\u4f1a\u5904\u4e8e\u7a7a\u95f2\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u5907\u4efd\u5c06\u5305\u62ec\u6570\u636e\u76ee\u5f55\u548c\u8868\u7a7a\u95f4\u4e2d\u7684\u6240\u6709\u6587\u4ef6\uff0c\u5305\u62ec\u914d\u7f6e\u6587\u4ef6\u4ee5\u53ca\u7b2c\u4e09\u65b9\u653e\u5728\u8fd9\u4e9b\u76ee\u5f55\u4e2d\u7684\u4efb\u4f55\u989d\u5916\u6587\u4ef6\uff0c\u4f46\u7531 PostgreSQL \u7ba1\u7406\u7684\u67d0\u4e9b\u4e34\u65f6\u6587\u4ef6\u9664\u5916\u3002\u4e0d\u8fc7\uff0c\u53ea\u6709\u666e\u901a\u6587\u4ef6\u548c\u76ee\u5f55\u4f1a\u88ab\u590d\u5236\uff0c\u4f46\u7528\u4e8e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u4f1a\u88ab\u4fdd\u7559\u3002\u6307\u5411 PostgreSQL \u5df2\u77e5\u7684\u67d0\u4e9b\u76ee\u5f55\u7684\u7b26\u53f7\u94fe\u63a5\u4f1a\u88ab\u590d\u5236\u4e3a\u7a7a\u76ee\u5f55\u3002\u5176\u4ed6\u7b26\u53f7\u94fe\u63a5\u548c\u7279\u6b8a\u8bbe\u5907\u6587\u4ef6\u5219\u4f1a\u88ab\u8df3\u8fc7\u3002\u5177\u4f53\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/12/protocol-replication.html\" title=\"52.4.\u00a0\u6d41\u590d\u5236\u534f\u8bae\">\u7b2c\u00a052.4\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5728\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u4e2d\uff0c\u9664\u975e\u4f7f\u7528\u4e86<code class=\"literal\">--tablespace-mapping</code>\u9009\u9879\uff0c\u5426\u5219\u8868\u7a7a\u95f4\u4f1a\u5907\u4efd\u5230\u5176\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u7684\u76f8\u540c\u8def\u5f84\u3002\u5982\u679c\u4e0d\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u90a3\u4e48\u5f53\u8868\u7a7a\u95f4\u6b63\u5728\u4f7f\u7528\u65f6\uff0c\u5c31\u65e0\u6cd5\u5728\u4e0e\u670d\u52a1\u5668\u76f8\u540c\u7684\u4e3b\u673a\u4e0a\u6267\u884c\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u7684\u57fa\u7840\u5907\u4efd\uff0c\u56e0\u4e3a\u5907\u4efd\u5c06\u4e0d\u5f97\u4e0d\u5199\u5165\u4e0e\u539f\u59cb\u8868\u7a7a\u95f4\u76f8\u540c\u7684\u76ee\u5f55\u4f4d\u7f6e\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u7528\u6237\u6709\u8d23\u4efb\u5728\u542f\u52a8 PostgreSQL \u670d\u52a1\u5668\u4e4b\u524d\u89e3\u5305\u6bcf\u4e2a tar \u6587\u4ef6\u3002\u5982\u679c\u5b58\u5728\u989d\u5916\u8868\u7a7a\u95f4\uff0c\u5219\u5176 tar \u6587\u4ef6\u5fc5\u987b\u89e3\u5305\u5230\u6b63\u786e\u7684\u4f4d\u7f6e\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u670d\u52a1\u5668\u4f1a\u6839\u636e<code class=\"filename\">tablespace_map</code>\u6587\u4ef6\u7684\u5185\u5bb9\uff0c\u4e3a\u8fd9\u4e9b\u8868\u7a7a\u95f4\u521b\u5efa\u7b26\u53f7\u94fe\u63a5\uff0c\u8be5\u6587\u4ef6\u5305\u542b\u5728<code class=\"filename\">base.tar</code>\u6587\u4ef6\u4e2d\u3002</p>\n<p lang=\"zh\">pg_basebackup \u53ef\u4e0e\u76f8\u540c\u6216\u66f4\u65e9\u4e3b\u8981\u7248\u672c\u7684\u670d\u52a1\u5668\u914d\u5408\u4f7f\u7528\uff0c\u6700\u4f4e\u652f\u6301 9.1\u3002\u4e0d\u8fc7\uff0cWAL \u6d41\u5f0f\u4f20\u8f93\u6a21\u5f0f\uff08-X stream\uff09\u53ea\u9002\u7528\u4e8e 9.3 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\uff0c\u5f53\u524d\u7248\u672c\u7684 tar \u683c\u5f0f\u6a21\u5f0f\uff08--format=tar\uff09\u53ea\u9002\u7528\u4e8e 9.5 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6e90\u96c6\u7c07\u542f\u7528\u4e86\u7ec4\u6743\u9650\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u5728<code class=\"literal\">plain</code>\u548c<code class=\"literal\">tar</code>\u4e24\u79cd\u683c\u5f0f\u4e2d\u4fdd\u7559\u7ec4\u6743\u9650\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.9.9\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u8981\u4e3a\u670d\u52a1\u5668<code class=\"literal\">mydbserver</code>\u521b\u5efa\u4e00\u4e2a\u57fa\u7840\u5907\u4efd\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5230\u672c\u5730\u76ee\u5f55<code class=\"filename\">/usr/local/pgsql/data</code>\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -h mydbserver -D /usr/local/pgsql/data</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u672c\u5730\u670d\u52a1\u5668\u521b\u5efa\u4e00\u4e2a\u5907\u4efd\uff0c\u4e3a\u6bcf\u4e2a\u8868\u7a7a\u95f4\u5404\u751f\u6210\u4e00\u4e2a\u538b\u7f29\u7684 tar \u6587\u4ef6\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5728\u76ee\u5f55<code class=\"filename\">backup</code>\u4e2d\uff0c\u540c\u65f6\u5728\u8fd0\u884c\u671f\u95f4\u663e\u793a\u8fdb\u5ea6\u62a5\u544a\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup -Ft -z -P</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u4e00\u4e2a\u4ec5\u5305\u542b\u5355\u4e2a\u8868\u7a7a\u95f4\u7684\u672c\u5730\u6570\u636e\u5e93\u521b\u5efa\u5907\u4efd\uff0c\u5e76\u4f7f\u7528<span class=\"productname\">bzip2</span>\u8fdb\u884c\u538b\u7f29\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D - -Ft -X fetch | bzip2 &gt; backup.tar.bz2</code></strong>\n</pre>\n<p lang=\"zh\">\uff08\u5982\u679c\u8be5\u6570\u636e\u5e93\u4e2d\u6709\u591a\u4e2a\u8868\u7a7a\u95f4\uff0c\u6b64\u547d\u4ee4\u5c06\u5931\u8d25\u3002\uff09</p>\n<p lang=\"zh\">\u8981\u521b\u5efa\u4e00\u4e2a\u672c\u5730\u6570\u636e\u5e93\u7684\u5907\u4efd\uff0c\u5e76\u5c06\u4f4d\u4e8e<code class=\"filename\">/opt/ts</code>\u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230<code class=\"filename\">./backup/ts</code>\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup/data -T /opt/ts=$(pwd)/backup/ts</code></strong>\n</pre>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.9.10\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/12/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a></span>\n</div>\n</div></div>", "manual_path": "app-pgbasebackup.html", "localization": {"status": "complete", "sources": [{"url": "/docs/12/app-pgbasebackup.html", "method": "same-major semantic node", "sha256": "677c5585d94bb004b50c00d7c457718de7889d5ad191a61cc96e98907304413b", "language": "zh", "matched_nodes": ["#APP-PGBASEBACKUP/div[2]/p[1]", "#APP-PGBASEBACKUP/div[3]/h2[0]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[0]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[1]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[2]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[3]", "#APP-PGBASEBACKUP/div[4]/p[1]", "#APP-PGBASEBACKUP/div[4]/p[2]", "#APP-PGBASEBACKUP/div[4]/p[3]", "#APP-PGBASEBACKUP/div[4]/p[4]", "#APP-PGBASEBACKUP/div[4]/p[5]", "#APP-PGBASEBACKUP/div[4]/p[6]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/div[2]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/div[2]/dl[0]/dd[3]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/div[2]/dl[0]/dd[5]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/div[2]/dl[0]/dd[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/div[2]/dl[0]/dd[5]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[17]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[3]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[5]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[5]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[7]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[11]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[11]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[13]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[17]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[17]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[17]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[19]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[19]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[7]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[7]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[7]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[8]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[8]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/p[3]", "#APP-PGBASEBACKUP/div[5]/p[5]", "#APP-PGBASEBACKUP/div[5]/p[7]", "#APP-PGBASEBACKUP/div[6]/h2[0]", "#APP-PGBASEBACKUP/div[6]/p[1]", "#APP-PGBASEBACKUP/div[6]/p[2]", "#APP-PGBASEBACKUP/div[7]/h2[0]", "#APP-PGBASEBACKUP/div[7]/p[1]", "#APP-PGBASEBACKUP/div[7]/p[2]", "#APP-PGBASEBACKUP/div[7]/p[3]", "#APP-PGBASEBACKUP/div[7]/p[4]", "#APP-PGBASEBACKUP/div[7]/p[6]", "#APP-PGBASEBACKUP/div[8]/h2[0]", "#APP-PGBASEBACKUP/div[8]/p[1]", "#APP-PGBASEBACKUP/div[8]/p[3]", "#APP-PGBASEBACKUP/div[8]/p[5]", "#APP-PGBASEBACKUP/div[8]/p[7]", "#APP-PGBASEBACKUP/div[8]/p[8]", "#APP-PGBASEBACKUP/div[9]/h2[0]"]}], "language": "zh", "original_text": {"/versions/12/description/0": "pg_basebackup \u2014 take a base backup of a PostgreSQL cluster", "/versions/12/facts/0/label": "Documented executable", "/versions/12/facts/1/label": "Executable version", "/versions/12/facts/2/label": "Reference inventory", "/versions/12/facts/2/value": "Client applications", "/versions/12/facts/3/label": "Option definition groups", "/versions/12/tables/0/title": "Documented options", "/versions/12/related/0/label": "libpq connection parameters", "/versions/12/tables/0/rows/0/summary": "Directory to write the output to. pg_basebackup will create the directory and any parent directories if necessary. The directory may already exist, but it is an error if the directory already exists and is not empty.", "/versions/12/tables/0/rows/1/summary": "Selects the format for the output. format can be one of the following:", "/versions/12/tables/0/rows/2/summary": "The maximum transfer rate of data transferred from the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second.", "/versions/12/tables/0/rows/3/summary": "Create standby.signal file and append connection settings to postgresql.auto.conf in the output directory (or into the base archive file when using tar format) to ease setting up a standby server. The postgresql.auto.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that the streaming replication will use the same settings later on.", "/versions/12/tables/0/rows/4/summary": "Relocate the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is currently defined. (But it is not an error if there is no tablespace in olddir contained in the backup.) Both olddir and newdir must be absolute paths. If a path happens to contain a = sign, escape it with a backslash. This option can be specified multiple times for multiple tablespaces. See examples below.", "/versions/12/tables/0/rows/5/summary": "Specifies the location for the write-ahead log directory. waldir must be an absolute path. The write-ahead log directory can only be specified when the backup is in plain mode.", "/versions/12/tables/0/rows/6/summary": "Includes the required write-ahead log files (WAL files) in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster directly in the extracted directory without the need to consult the log archive, thus making this a completely standalone backup.", "/versions/12/tables/0/rows/7/summary": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "/versions/12/tables/0/rows/8/summary": "Enables gzip compression of tar file output, and specifies the compression level (0 through 9, 0 being no compression and 9 being best compression). Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "/versions/12/tables/0/rows/9/summary": "Sets checkpoint mode to fast (immediate) or spread (default) (see Section 25.3.3 ).", "/versions/12/tables/0/columns/0/label": "Option and arguments", "/versions/12/tables/0/columns/1/label": "Description", "/versions/12/tables/0/rows/10/summary": "This option causes creation of a replication slot named by the --slot option before starting the backup. An error is raised if the slot already exists.", "/versions/12/tables/0/rows/11/summary": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used.", "/versions/12/tables/0/rows/12/summary": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, data directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging.", "/versions/12/tables/0/rows/13/summary": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.", "/versions/12/tables/0/rows/14/summary": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.", "/versions/12/tables/0/rows/15/summary": "This option can only be used together with -X stream . It causes the WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming replication standby using replication slots, it should then use the same replication slot name in primary_slot_name . That way, it is ensured that the server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication.", "/versions/12/tables/0/rows/16/summary": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.", "/versions/12/tables/0/rows/17/summary": "This option prevents the creation of a temporary replication slot during the backup even if it's supported by the server.", "/versions/12/tables/0/rows/18/summary": "Disables verification of checksums, if they are enabled on the server the base backup is taken from.", "/versions/12/tables/0/rows/19/summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "/versions/12/tables/0/rows/20/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "/versions/12/tables/0/rows/21/summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "/versions/12/tables/0/rows/22/summary": "Specifies the number of seconds between status packets sent back to the server. This allows for easier monitoring of the progress from server. A value of zero disables the periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout disconnect. The default value is 10 seconds.", "/versions/12/tables/0/rows/23/summary": "User name to connect as.", "/versions/12/tables/0/rows/24/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/12/tables/0/rows/25/summary": "Force pg_basebackup to prompt for a password before connecting to a database.", "/versions/12/tables/0/rows/26/summary": "Print the pg_basebackup version and exit.", "/versions/12/tables/0/rows/27/summary": "Show help about pg_basebackup command line arguments, and exit."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "8290833e143803ff5bf12854aafee755357e7638c16d3beababc2eacb38ea287"}, "comparison_data": {"options": [{"names": ["-D directory", "--pgdata= directory"], "signature": "-D directory --pgdata= directory", "description": "Directory to write the output to. pg_basebackup will create the directory and any parent directories if necessary. The directory may already exist, but it is an error if the directory already exists and is not empty. When the backup is in tar mode, and the directory is specified as - (dash), the tar file will be written to stdout . This option is required."}, {"names": ["-F format", "--format= format"], "signature": "-F format --format= format", "description": "Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the current data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory will be written to a file named base.tar , and all other tablespaces will be named after the tablespace OID. If the value - (dash) is specified as target directory, the tar contents will be written to standard output, suitable for piping to for example gzip . This is only possible if the cluster has no additional tablespaces and WAL streaming is not used."}, {"names": ["-r rate", "--max-rate= rate"], "signature": "-r rate --max-rate= rate", "description": "The maximum transfer rate of data transferred from the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. The purpose is to limit the impact of pg_basebackup on the running server. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch ."}, {"names": ["-R", "--write-recovery-conf"], "signature": "-R --write-recovery-conf", "description": "Create standby.signal file and append connection settings to postgresql.auto.conf in the output directory (or into the base archive file when using tar format) to ease setting up a standby server. The postgresql.auto.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that the streaming replication will use the same settings later on."}, {"names": ["-T olddir = newdir", "--tablespace-mapping= olddir = newdir"], "signature": "-T olddir = newdir --tablespace-mapping= olddir = newdir", "description": "Relocate the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is currently defined. (But it is not an error if there is no tablespace in olddir contained in the backup.) Both olddir and newdir must be absolute paths. If a path happens to contain a = sign, escape it with a backslash. This option can be specified multiple times for multiple tablespaces. See examples below. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected."}, {"names": ["--waldir= waldir"], "signature": "--waldir= waldir", "description": "Specifies the location for the write-ahead log directory. waldir must be an absolute path. The write-ahead log directory can only be specified when the backup is in plain mode."}, {"names": ["-X method", "--wal-method= method"], "signature": "-X method --wal-method= method", "description": "Includes the required write-ahead log files (WAL files) in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster directly in the extracted directory without the need to consult the log archive, thus making this a completely standalone backup. The following methods for collecting the write-ahead logs are supported: n none Don't include write-ahead log in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the wal_keep_segments parameter to be set high enough that the log is not removed before the end of the backup. If the log has been rotated when it's time to transfer it, the backup will fail and be unusable. When tar format mode is used, the write-ahead log files will be written to the base.tar file. s stream Stream the write-ahead log while the backup is created. This will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will use up two connections configured by the max_wal_senders parameter. As long as the client can keep up with write-ahead log received, using this mode requires no extra write-ahead logs to be saved on the master. When tar format mode is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default."}, {"names": ["-z", "--gzip"], "signature": "-z --gzip", "description": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-Z level", "--compress= level"], "signature": "-Z level --compress= level", "description": "Enables gzip compression of tar file output, and specifies the compression level (0 through 9, 0 being no compression and 9 being best compression). Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-c fast|spread", "--checkpoint= fast|spread"], "signature": "-c fast|spread --checkpoint= fast|spread", "description": "Sets checkpoint mode to fast (immediate) or spread (default) (see Section 25.3.3 )."}, {"names": ["-C", "--create-slot"], "signature": "-C --create-slot", "description": "This option causes creation of a replication slot named by the --slot option before starting the backup. An error is raised if the slot already exists."}, {"names": ["-l label", "--label= label"], "signature": "-l label --label= label", "description": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used."}, {"names": ["-n", "--no-clean"], "signature": "-n --no-clean", "description": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, data directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way."}, {"names": ["-N", "--no-sync"], "signature": "-N --no-sync", "description": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."}, {"names": ["-P", "--progress"], "signature": "-P --progress", "description": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL. When this is enabled, the backup will start by enumerating the size of the entire database, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent."}, {"names": ["-S slotname", "--slot= slotname"], "signature": "-S slotname --slot= slotname", "description": "This option can only be used together with -X stream . It causes the WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming replication standby using replication slots, it should then use the same replication slot name in primary_slot_name . That way, it is ensured that the server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication. The specified replication slot has to exist unless the option -C is also used. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."}, {"names": ["--no-slot"], "signature": "--no-slot", "description": "This option prevents the creation of a temporary replication slot during the backup even if it's supported by the server. Temporary replication slots are created by default if no slot name is given with the option -S when using log streaming. The main purpose of this option is to allow taking a base backup when the server is out of free replication slots. Using replication slots is almost always preferred, because it prevents needed WAL from being removed by the server during the backup."}, {"names": ["--no-verify-checksums"], "signature": "--no-verify-checksums", "description": "Disables verification of checksums, if they are enabled on the server the base backup is taken from. By default, checksums are verified and checksum failures will result in a non-zero exit status. However, the base backup will not be removed in such a case, as if the --no-clean option had been used. Checksum verifications failures will also be reported in the pg_stat_database view."}, {"names": ["-d connstr", "--dbname= connstr"], "signature": "-d connstr --dbname= connstr", "description": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. The option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, database name in the connection string will be ignored."}, {"names": ["-h host", "--host= host"], "signature": "-h host --host= host", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-s interval", "--status-interval= interval"], "signature": "-s interval --status-interval= interval", "description": "Specifies the number of seconds between status packets sent back to the server. This allows for easier monitoring of the progress from server. A value of zero disables the periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout disconnect. The default value is 10 seconds."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force pg_basebackup to prompt for a password before connecting to a database. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pg_basebackup version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_basebackup command line arguments, and exit."}], "synopsis": ["pg_basebackup [ option ...]"], "environment": []}, "comparison_hash": "868d1ae75f45701e289105395b94ef352a567a94afa3f59c1bf78ef2a152287d", "manual_language": "zh"}, "13": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_basebackup"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "13.23"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "32"}], "tables": [{"key": "options", "rows": [{"summary": "\u8bbe\u7f6e\u5199\u5165\u8f93\u51fa\u7684\u76ee\u6807\u76ee\u5f55\u3002\u5982\u679c\u8be5\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c pg_basebackup \u4f1a\u521b\u5efa\u5b83\uff08\u4ee5\u53ca\u6240\u6709\u7f3a\u5931\u7684\u7236\u76ee\u5f55\uff09\u3002\u5982\u679c\u8be5\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "-D directory --pgdata= directory"}}, {"summary": "\u9009\u62e9\u8f93\u51fa\u683c\u5f0f\u3002 format \u53ef\u4ee5\u662f\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "-F format --format= format"}}, {"summary": "\u521b\u5efa standby.signal \u6587\u4ef6\uff0c\u5e76\u5c06\u8fde\u63a5\u8bbe\u7f6e\u8ffd\u52a0\u5230\u76ee\u6807\u76ee\u5f55\u4e2d\u7684 postgresql.auto.conf \u6587\u4ef6\u4e2d\uff08\u5982\u679c\u4f7f\u7528 tar \u683c\u5f0f\uff0c\u5219\u8ffd\u52a0\u5230\u57fa\u7840\u5f52\u6863\u6587\u4ef6\u5185\uff09\u3002\u8fd9\u6837\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u5229\u7528\u5907\u4efd\u7ed3\u679c\u642d\u5efa\u5907\u5e93\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "-R --write-recovery-conf"}}, {"summary": "\u5728\u5907\u4efd\u671f\u95f4\uff0c\u5c06\u76ee\u5f55 olddir \u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230 newdir \u3002\u8981\u4f7f\u6b64\u9009\u9879\u751f\u6548\uff0c olddir \u5fc5\u987b\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u5b9a\u4e49\u7684\u8be5\u8868\u7a7a\u95f4\u8def\u5f84\u5b8c\u5168\u4e00\u81f4\u3002\uff08\u4f46\u5982\u679c\u6e90\u670d\u52a1\u5668\u4e0a\u5728 olddir \u4e2d\u6ca1\u6709\u8868\u7a7a\u95f4\uff0c\u4e5f\u4e0d\u7b97\u9519\u8bef\u3002\uff09\u4e0e\u6b64\u540c\u65f6\uff0c newdir \u662f\u63a5\u6536\u4e3b\u673a\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u4e00\u4e2a\u76ee\u5f55\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c newdir \u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002 olddir \u548c newdir \u90fd\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u5982\u679c\u4efb\u4e00\u8def\u5f84\u4e2d\u9700\u8981\u5305\u542b\u7b49\u53f7\uff08 = \uff09\uff0c\u8bf7\u5728\u5176\u524d\u9762\u52a0\u4e0a\u53cd\u659c\u6760\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u4ee5\u5904\u7406\u591a\u4e2a\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "-T olddir = newdir --tablespace-mapping= olddir = newdir"}}, {"summary": "\u8bbe\u7f6e\u5199\u5165 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cWAL \u6587\u4ef6\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u7684 pg_wal \u5b50\u76ee\u5f55\u4e2d\uff0c\u4f46\u6b64\u9009\u9879\u53ef\u7528\u4e8e\u5c06\u5176\u653e\u5728\u5176\u4ed6\u4f4d\u7f6e\u3002 waldir \u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c waldir \u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002\u53ea\u6709\u5f53\u5907\u4efd\u91c7\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u624d\u80fd\u6307\u5b9a\u6b64\u9009\u9879\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "--waldir= waldir"}}, {"summary": "\u5728\u5907\u4efd\u4e2d\u5305\u542b\u6240\u9700\u7684 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u3002\u8fd9\u5c06\u5305\u62ec\u5907\u4efd\u671f\u95f4\u751f\u6210\u7684\u6240\u6709\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u9664\u975e\u6307\u5b9a\u65b9\u6cd5 none \uff0c\u5426\u5219\u5c31\u53ef\u4ee5\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u542f\u52a8 postmaster\uff0c\u800c\u65e0\u9700\u67e5\u9605 WAL \u5f52\u6863\uff0c\u4ece\u800c\u4f7f\u8f93\u51fa\u6210\u4e3a\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u5907\u4efd\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "-X method --wal-method= method"}}, {"summary": "\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u4f7f\u7528\u9ed8\u8ba4\u538b\u7f29\u7ea7\u522b\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0 .gz \u540e\u7f00\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "-z --gzip"}}, {"summary": "\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u5e76\u6307\u5b9a\u538b\u7f29\u7ea7\u522b\uff080 \u5230 9\uff0c\u5176\u4e2d 0 \u8868\u793a\u4e0d\u538b\u7f29\uff0c9 \u8868\u793a\u6700\u4f73\u538b\u7f29\uff09\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0 .gz \u540e\u7f00\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "-Z level --compress= level"}}, {"summary": "\u5c06\u68c0\u67e5\u70b9\u6a21\u5f0f\u8bbe\u7f6e\u4e3a fast\uff08\u7acb\u5373\uff09\u6216 spread\uff08\u9ed8\u8ba4\uff09\uff08\u89c1 \u7b2c 25.3.3 \u8282 \uff09\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "-c fast|spread --checkpoint= fast|spread"}}, {"summary": "\u6307\u5b9a\u5728\u5f00\u59cb\u5907\u4efd\u4e4b\u524d\uff0c\u5e94\u521b\u5efa\u7531 --slot \u9009\u9879\u6307\u5b9a\u540d\u79f0\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u8be5\u69fd\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u9519\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "-C --create-slot"}}, {"summary": "\u8bbe\u7f6e\u5907\u4efd\u6807\u7b7e\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u503c \u201c pg_basebackup base backup \u201d \u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "-l label --label= label"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53 pg_basebackup \u56e0\u9519\u8bef\u4e2d\u6b62\u65f6\uff0c\u5b83\u4f1a\u5220\u9664\u5728\u53d1\u73b0\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u76ee\u5f55\uff08\u4f8b\u5982\u76ee\u6807\u76ee\u5f55\u548c\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\uff09\u3002\u6b64\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u5f88\u6709\u5e2e\u52a9\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "-n --no-clean"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_basebackup \u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u88ab\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f1a\u4f7f pg_basebackup \u4e0d\u7ecf\u7b49\u5f85\u5c31\u76f4\u63a5\u8fd4\u56de\uff0c\u56e0\u6b64\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u968f\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u57fa\u7840\u5907\u4efd\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u5408\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "-N --no-sync"}}, {"summary": "\u542f\u7528\u8fdb\u5ea6\u62a5\u544a\u3002\u6253\u5f00\u6b64\u9009\u9879\u540e\uff0c\u4f1a\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u7ed9\u51fa\u4e00\u4e2a\u8fd1\u4f3c\u7684\u8fdb\u5ea6\u62a5\u544a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u53d1\u751f\u53d8\u5316\uff0c\u56e0\u6b64\u8fd9\u53ea\u662f\u8fd1\u4f3c\u503c\uff0c\u6700\u7ec8\u672a\u5fc5\u6070\u597d\u7ed3\u675f\u5728 100% \u3002\u7279\u522b\u662f\u5f53\u5907\u4efd\u4e2d\u5305\u542b WAL \u65f6\uff0c\u603b\u6570\u636e\u91cf\u65e0\u6cd5\u9884\u5148\u4f30\u8ba1\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u65e6\u8fdb\u5ea6\u8d85\u8fc7\u4e0d\u542b WAL \u65f6\u7684\u603b\u4f30\u8ba1\u503c\uff0c\u4f30\u8ba1\u76ee\u6807\u5927\u5c0f\u5c31\u4f1a\u7ee7\u7eed\u589e\u52a0\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "-P --progress"}}, {"summary": "\u8bbe\u7f6e\u4ece\u6e90\u670d\u52a1\u5668\u6536\u96c6\u6570\u636e\u65f6\u5141\u8bb8\u7684\u6700\u5927\u4f20\u8f93\u901f\u7387\u3002\u8fd9\u6709\u52a9\u4e8e\u9650\u5236 pg_basebackup \u5bf9\u670d\u52a1\u5668\u7684\u5f71\u54cd\u3002\u53d6\u503c\u5355\u4f4d\u4e3a\u6bcf\u79d2\u5343\u5b57\u8282\u3002\u4f7f\u7528\u540e\u7f00 M \u8868\u793a\u6bcf\u79d2\u5146\u5b57\u8282\u3002\u4e5f\u63a5\u53d7\u540e\u7f00 k \uff0c\u4f46\u6ca1\u6709\u5b9e\u9645\u5f71\u54cd\u3002\u6709\u6548\u53d6\u503c\u8303\u56f4\u4e3a\u6bcf\u79d2 32 \u5343\u5b57\u8282\u5230\u6bcf\u79d2 1024 \u5146\u5b57\u8282\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "-r rate --max-rate= rate"}}, {"summary": "\u6b64\u9009\u9879\u53ea\u80fd\u4e0e -X stream \u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u4f1a\u4f7f WAL \u6d41\u5f0f\u4f20\u8f93\u4f7f\u7528\u6307\u5b9a\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u6b64\u57fa\u7840\u5907\u4efd\u6253\u7b97\u7528\u4f5c\u4f7f\u7528\u590d\u5236\u69fd\u7684\u6d41\u590d\u5236\u5907\u5e93\uff0c\u90a3\u4e48\u8be5\u5907\u5e93\u5e94\u5c06\u540c\u4e00\u4e2a\u590d\u5236\u69fd\u540d\u79f0\u7528\u4f5c primary_slot_name \u7684\u503c\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u4e3b\u5e93\u5728\u57fa\u7840\u5907\u4efd\u7ed3\u675f\u4e0e\u65b0\u5907\u5e93\u5f00\u59cb\u6d41\u590d\u5236\u4e4b\u95f4\u7684\u8fd9\u6bb5\u65f6\u95f4\u5185\uff0c\u4e0d\u4f1a\u79fb\u9664\u4efb\u4f55\u5fc5\u9700\u7684 WAL \u6570\u636e\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "-S slotname --slot= slotname"}}, {"summary": "\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\u3002\u5b83\u4f1a\u5728\u542f\u52a8\u548c\u5173\u95ed\u8fc7\u7a0b\u4e2d\u8f93\u51fa\u4e00\u4e9b\u989d\u5916\u6b65\u9aa4\uff1b\u5982\u679c\u540c\u65f6\u542f\u7528\u4e86\u8fdb\u5ea6\u62a5\u544a\uff0c\u8fd8\u4f1a\u663e\u793a\u5f53\u524d\u6b63\u5728\u5904\u7406\u7684\u786e\u5207\u6587\u4ef6\u540d\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "-v --verbose"}}, {"summary": "\u6307\u5b9a\u5e94\u7528\u5230\u5907\u4efd\u6e05\u5355\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u7684\u6821\u9a8c\u548c\u7b97\u6cd5\u3002\u76ee\u524d\u53ef\u7528\u7684\u7b97\u6cd5\u6709 NONE \u3001 CRC32C \u3001 SHA224 \u3001 SHA256 \u3001 SHA384 \u548c SHA512 \u3002\u9ed8\u8ba4\u503c\u4e3a CRC32C \u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "--manifest-checksums= algorithm"}}, {"summary": "\u5f3a\u5236\u5c06\u5907\u4efd\u6e05\u5355\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u540d\u7f16\u7801\u4e3a\u5341\u516d\u8fdb\u5236\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u5bf9\u975e UTF8 \u6587\u4ef6\u540d\u8fdb\u884c\u5341\u516d\u8fdb\u5236\u7f16\u7801\u3002\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u8bfb\u53d6\u5907\u4efd\u6e05\u5355\u6587\u4ef6\u7684\u5de5\u5177\u662f\u5426\u80fd\u6b63\u786e\u5904\u7406\u8fd9\u79cd\u60c5\u51b5\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "--manifest-force-encode"}}, {"summary": "\u7981\u6b62\u670d\u52a1\u5668\u4f30\u7b97\u5c06\u8981\u6d41\u5f0f\u4f20\u8f93\u7684\u5907\u4efd\u6570\u636e\u603b\u91cf\uff0c\u56e0\u6b64 pg_stat_progress_basebackup \u89c6\u56fe\u4e2d\u7684 backup_total \u5217\u59cb\u7ec8\u4e3a NULL\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "--no-estimate-size"}}, {"summary": "\u7981\u6b62\u751f\u6210\u5907\u4efd\u6e05\u5355\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u670d\u52a1\u5668\u5c06\u751f\u6210\u5e76\u53d1\u9001\u4e00\u4e2a\u5907\u4efd\u6e05\u5355\uff0c\u53ef\u4f7f\u7528 pg_verifybackup \u8fdb\u884c\u9a8c\u8bc1\u3002\u8be5\u6e05\u5355\u5217\u51fa\u4e86\u5907\u4efd\u4e2d\u7684\u6bcf\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u4e0d\u5305\u62ec\u53ef\u80fd\u5305\u542b\u5728\u5176\u4e2d\u7684\u4efb\u4f55 WAL \u6587\u4ef6\u3002\u5b83\u8fd8\u4f1a\u4fdd\u5b58\u6bcf\u4e2a\u6587\u4ef6\u7684\u5927\u5c0f\u3001\u6700\u540e\u4fee\u6539\u65f6\u95f4\u4ee5\u53ca\u53ef\u9009\u7684\u6821\u9a8c\u548c\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "--no-manifest"}}, {"summary": "\u9632\u6b62\u4e3a\u5907\u4efd\u521b\u5efa\u4e34\u65f6\u590d\u5236\u69fd\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "--no-slot"}}, {"summary": "\u5982\u679c\u83b7\u53d6\u57fa\u7840\u5907\u4efd\u7684\u670d\u52a1\u5668\u542f\u7528\u4e86\u6821\u9a8c\u548c\uff0c\u5219\u7981\u7528\u5bf9\u8fd9\u4e9b\u6821\u9a8c\u548c\u7684\u9a8c\u8bc1\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "--no-verify-checksums"}}, {"summary": "\u4ee5 \u8fde\u63a5\u5b57\u7b26\u4e32 \u7684\u5f62\u5f0f\u6307\u5b9a\u7528\u4e8e\u8fde\u63a5\u670d\u52a1\u5668\u7684\u53c2\u6570\uff1b\u8fd9\u4e9b\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u76f8\u4e92\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "-d connstr --dbname= connstr"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGHOST \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff1b\u5426\u5219\u4f1a\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "-h host --host= host"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u6240\u4f7f\u7528\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u4e2d\u7684\u503c\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u786e\u5b9a\u7684\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "-p port --port= port"}}, {"summary": "\u6307\u5b9a\u53d1\u9001\u56de\u6e90\u670d\u52a1\u5668\u7684\u72b6\u6001\u5305\u4e4b\u95f4\u76f8\u9694\u7684\u79d2\u6570\u3002\u8f83\u5c0f\u7684\u503c\u53ef\u4ee5\u8ba9\u670d\u52a1\u5668\u7aef\u5bf9\u5907\u4efd\u8fdb\u5ea6\u7684\u76d1\u63a7\u66f4\u7cbe\u786e\u3002\u503c\u4e3a\u96f6\u65f6\u4f1a\u5b8c\u5168\u7981\u7528\u5468\u671f\u6027\u72b6\u6001\u66f4\u65b0\uff0c\u4e0d\u8fc7\u5f53\u670d\u52a1\u5668\u8bf7\u6c42\u65f6\u4ecd\u4f1a\u53d1\u9001\u66f4\u65b0\uff0c\u4ee5\u907f\u514d\u56e0\u8d85\u65f6\u800c\u65ad\u5f00\u8fde\u63a5\u3002\u9ed8\u8ba4\u503c\u662f 10 \u79d2\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "-s interval --status-interval= interval"}}, {"summary": "\u6307\u5b9a\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "-U username --username= username"}}, {"summary": "\u7981\u6b62\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\uff08\u4f8b\u5982 .pgpass \u6587\u4ef6\uff09\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u6b64\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u79cd\u573a\u666f\u4e0b\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 pg_basebackup \u5728\u8fde\u63a5\u6e90\u670d\u52a1\u5668\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "-W --password"}}, {"summary": "\u8f93\u51fa pg_basebackup \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "-V --version"}}, {"summary": "\u663e\u793a pg_basebackup \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/13/app-pgbasebackup.html", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}], "options": [{"names": ["-D directory", "--pgdata= directory"], "summary": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty.", "signature": "-D directory --pgdata= directory", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty. When the backup is in tar format, the target directory may be specified as - (dash), causing the tar file to be written to stdout . This option is required."}, {"names": ["-F format", "--format= format"], "summary": "Selects the format for the output. format can be one of the following:", "signature": "-F format --format= format", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the source server's data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory's contents will be written to a file named base.tar , and each other tablespace will be written to a separate tar file named after that tablespace's OID. If the target directory is specified as - (dash), the tar contents will be written to standard output, suitable for piping to (for example) gzip . This is only allowed if the cluster has no additional tablespaces and WAL streaming is not used."}, {"names": ["-R", "--write-recovery-conf"], "summary": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup.", "signature": "-R --write-recovery-conf", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup. The postgresql.auto.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that streaming replication will use the same settings later on."}, {"names": ["-T olddir = newdir", "--tablespace-mapping= olddir = newdir"], "summary": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces.", "signature": "-T olddir = newdir --tablespace-mapping= olddir = newdir", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected."}, {"names": ["--waldir= waldir"], "summary": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format.", "signature": "--waldir= waldir", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format."}, {"names": ["-X method", "--wal-method= method"], "summary": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the log archive, thus making the output a completely standalone backup.", "signature": "-X method --wal-method= method", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the log archive, thus making the output a completely standalone backup. The following method s for collecting the write-ahead logs are supported: n none Don't include write-ahead logs in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the source server's wal_keep_size parameter to be set high enough that the required log data is not removed before the end of the backup. If the required log data has been recycled before it's time to transfer it, the backup will fail and be unusable. When tar format is used, the write-ahead log files will be included in the base.tar file. s stream Stream write-ahead log data while the backup is being taken. This method will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will require two replication connections not just one. As long as the client can keep up with the write-ahead log data, using this method requires no extra write-ahead logs to be saved on the source server. When tar format is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default."}, {"names": ["-z", "--gzip"], "summary": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "signature": "-z --gzip", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-Z level", "--compress= level"], "summary": "Enables gzip compression of tar file output, and specifies the compression level (0 through 9, 0 being no compression and 9 being best compression). Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "signature": "-Z level --compress= level", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Enables gzip compression of tar file output, and specifies the compression level (0 through 9, 0 being no compression and 9 being best compression). Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-c fast|spread", "--checkpoint= fast|spread"], "summary": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 25.3.3 ).", "signature": "-c fast|spread --checkpoint= fast|spread", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 25.3.3 )."}, {"names": ["-C", "--create-slot"], "summary": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists.", "signature": "-C --create-slot", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists."}, {"names": ["-l label", "--label= label"], "summary": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used.", "signature": "-l label --label= label", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used."}, {"names": ["-n", "--no-clean"], "summary": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging.", "signature": "-n --no-clean", "source_url": "/docs/13/app-pgbasebackup.html", "description": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way."}, {"names": ["-N", "--no-sync"], "summary": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.", "signature": "-N --no-sync", "source_url": "/docs/13/app-pgbasebackup.html", "description": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."}, {"names": ["-P", "--progress"], "summary": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.", "signature": "-P --progress", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL."}, {"names": ["-r rate", "--max-rate= rate"], "summary": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second.", "signature": "-r rate --max-rate= rate", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch ."}, {"names": ["-S slotname", "--slot= slotname"], "summary": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby.", "signature": "-S slotname --slot= slotname", "source_url": "/docs/13/app-pgbasebackup.html", "description": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby. The specified replication slot has to exist unless the option -C is also used. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming."}, {"names": ["-v", "--verbose"], "summary": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.", "signature": "-v --verbose", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."}, {"names": ["--manifest-checksums= algorithm"], "summary": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C .", "signature": "--manifest-checksums= algorithm", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C . If NONE is selected, the backup manifest will not contain any checksums. Otherwise, it will contain a checksum of each file in the backup using the specified algorithm. In addition, the manifest will always contain a SHA256 checksum of its own contents. The SHA algorithms are significantly more CPU-intensive than CRC32C , so selecting one of them may increase the time required to complete the backup. Using a SHA hash function provides a cryptographically secure digest of each file for users who wish to verify that the backup has not been tampered with, while the CRC32C algorithm provides a checksum that is much faster to calculate; it is good at catching errors due to accidental changes but is not resistant to malicious modifications. Note that, to be useful against an adversary who has access to the backup, the backup manifest would need to be stored securely elsewhere or otherwise verified not to have been modified since the backup was taken. pg_verifybackup can be used to check the integrity of a backup against the backup manifest."}, {"names": ["--manifest-force-encode"], "summary": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case.", "signature": "--manifest-force-encode", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case."}, {"names": ["--no-estimate-size"], "summary": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL .", "signature": "--no-estimate-size", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL . Without this option, the backup will start by enumerating the size of the entire database, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent. This option is useful to avoid such estimation time if it's too long. This option is not allowed when using --progress ."}, {"names": ["--no-manifest"], "summary": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file.", "signature": "--no-manifest", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file."}, {"names": ["--no-slot"], "summary": "Prevents the creation of a temporary replication slot for the backup.", "signature": "--no-slot", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Prevents the creation of a temporary replication slot for the backup. By default, if log streaming is selected but no slot name is given with the -S option, then a temporary replication slot is created (if supported by the source server). The main purpose of this option is to allow taking a base backup when the server has no free replication slots. Using a replication slot is almost always preferred, because it prevents needed WAL from being removed by the server during the backup."}, {"names": ["--no-verify-checksums"], "summary": "Disables verification of checksums, if they are enabled on the server the base backup is taken from.", "signature": "--no-verify-checksums", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Disables verification of checksums, if they are enabled on the server the base backup is taken from. By default, checksums are verified and checksum failures will result in a non-zero exit status. However, the base backup will not be removed in such a case, as if the --no-clean option had been used. Checksum verification failures will also be reported in the pg_stat_database view."}, {"names": ["-d connstr", "--dbname= connstr"], "summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": "-d connstr --dbname= connstr", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. The option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, any database name in the connection string will be ignored."}, {"names": ["-h host", "--host= host"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "signature": "-h host --host= host", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "signature": "-p port --port= port", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-s interval", "--status-interval= interval"], "summary": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds.", "signature": "-s interval --status-interval= interval", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds."}, {"names": ["-U username", "--username= username"], "summary": "Specifies the user name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Specifies the user name to connect as."}, {"names": ["-w", "--no-password"], "summary": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "summary": "Forces pg_basebackup to prompt for a password before connecting to the source server.", "signature": "-W --password", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Forces pg_basebackup to prompt for a password before connecting to the source server. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["-V", "--version"], "summary": "Prints the pg_basebackup version and exits.", "signature": "-V --version", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Prints the pg_basebackup version and exits."}, {"names": ["-?", "--help"], "summary": "Shows help about pg_basebackup command line arguments, and exits.", "signature": "-? --help", "source_url": "/docs/13/app-pgbasebackup.html", "description": "Shows help about pg_basebackup command line arguments, and exits."}], "related": [{"url": "/wiki/conn/?v=13", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v13.23/postgresql-13.23.tar.bz2", "label": "13.23", "major": "13", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/13/postgresql-13-A4.pdf", "bytes": 13843239, "pages": 2826, "sha256": "171cc09f90936dbc1cbd503a98ff07ae72ea58ab9771ff051313f1217737799c", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/13/postgresql-13-US.pdf", "bytes": 13739572, "pages": 2984, "sha256": "48d09c6e197d9db4220f41afe83efe848a8661b1b168d3b89419751ecaf6c24d", "built_at": "2026-09-26"}}, "tree": "13", "index": "index.html", "major": "13", "pages": 1139, "release": "13.23", "source_url": "https://ftp.postgresql.org/pub/source/v13.23/postgresql-13.23.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "6ec3c82726af92b7dec873fa1cdf881eca92a4219787dfad05acb6b10e041fd6"}, "revision": "614ee3133270254e476c118cdf6f72af78d4e4b8bbd9b28ed9ab1e14e4e9c0f6", "evidence_kind": "English manual and source declarations", "source_sha256": "6ec3c82726af92b7dec873fa1cdf881eca92a4219787dfad05acb6b10e041fd6"}, "sources": [{"url": "https://pg.center/docs/13/app-pgbasebackup.html", "file": "app-pgbasebackup.html", "label": "13.23 English manual \u00b7 app-pgbasebackup.html", "anchor": "", "sha256": "d40492f13076160c53bad4d173932e8c79587e4baeb700d385ac4c70d6d439c7", "language": "en", "original_url": "/docs/13/app-pgbasebackup.html"}, {"url": "https://pg.center/docs/13/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "2a16c2982d9803edd4bd6920f76b66083e7f2959182d6a3bcec7ccfbac0a9ad8", "language": "en", "original_url": "/docs/13/reference-client.html"}], "sections": [], "synopsis": ["pg_basebackup [ option ...]"], "signature": "pg_basebackup [ option ...]", "description": ["pg_basebackup \u2014 \u83b7\u53d6 PostgreSQL \u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd"], "environment": [], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGBASEBACKUP\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_basebackup</span></span></h2>\n<p lang=\"zh\">pg_basebackup \u2014 \u83b7\u53d6<span class=\"productname\">PostgreSQL</span>\u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.9.4.1\"><code class=\"command\">pg_basebackup</code> [<em class=\"replaceable\"><code>option</code></em>...]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.9.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u7528\u4e8e\u83b7\u53d6\u6b63\u5728\u8fd0\u884c\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd\u3002\u5907\u4efd\u8fc7\u7a0b\u4e0d\u4f1a\u5f71\u54cd\u6570\u636e\u5e93\u7684\u5176\u4ed6\u5ba2\u6237\u7aef\uff0c\u5e76\u4e14\u8be5\u5907\u4efd\u65e2\u53ef\u7528\u4e8e\u65f6\u95f4\u70b9\u6062\u590d\uff08\u89c1<a class=\"xref\" href=\"/docs/13/continuous-archiving.html\" title=\"25.3.\u00a0\u6301\u7eed\u5f52\u6863\u548c\u65f6\u95f4\u70b9\u6062\u590d\uff08PITR\uff09\">\u7b2c\u00a025.3\u00a0\u8282</a>\uff09\uff0c\u4e5f\u53ef\u7528\u4f5c\u65e5\u5fd7\u4f20\u9001\u6216\u6d41\u590d\u5236\u5907\u5e93\u7684\u8d77\u70b9\uff08\u89c1<a class=\"xref\" href=\"/docs/13/warm-standby.html\" title=\"26.2.\u00a0\u65e5\u5fd7\u4f20\u9001\u5907\u5e93\">\u7b2c\u00a026.2\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u4f1a\u7cbe\u786e\u590d\u5236\u6570\u636e\u5e93\u96c6\u7c07\u7684\u6587\u4ef6\uff0c\u540c\u65f6\u786e\u4fdd\u670d\u52a1\u5668\u81ea\u52a8\u8fdb\u5165\u548c\u9000\u51fa\u5907\u4efd\u6a21\u5f0f\u3002\u5907\u4efd\u59cb\u7ec8\u9488\u5bf9\u6574\u4e2a\u6570\u636e\u5e93\u96c6\u7c07\uff1b\u4e0d\u53ef\u80fd\u53ea\u5907\u4efd\u5355\u4e2a\u6570\u636e\u5e93\u6216\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u5bf9\u4e8e\u9009\u62e9\u6027\u5907\u4efd\uff0c\u5fc5\u987b\u4f7f\u7528\u8bf8\u5982<a class=\"xref\" href=\"/docs/13/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a>\u4e4b\u7c7b\u7684\u5176\u4ed6\u5de5\u5177\u3002</p>\n<p lang=\"zh\">\u5907\u4efd\u662f\u901a\u8fc7\u4e00\u4e2a\u4f7f\u7528\u590d\u5236\u534f\u8bae\u7684\u5e38\u89c4<span class=\"productname\">PostgreSQL</span>\u8fde\u63a5\u8fdb\u884c\u7684\u3002\u5efa\u7acb\u8be5\u8fde\u63a5\u6240\u4f7f\u7528\u7684\u7528\u6237 ID \u5fc5\u987b\u5177\u6709<code class=\"literal\">REPLICATION</code>\u6743\u9650\uff08\u89c1<a class=\"xref\" href=\"/docs/13/role-attributes.html\" title=\"21.2.\u00a0\u89d2\u8272\u5c5e\u6027\">\u7b2c\u00a021.2\u00a0\u8282</a>\uff09\uff0c\u6216\u8005\u662f\u8d85\u7ea7\u7528\u6237\uff0c\u5e76\u4e14<a class=\"link\" href=\"/docs/13/client-authentication.html#AUTH-PG-HBA-CONF\" title=\"20.1.\u00a0pg_hba.conf \u6587\u4ef6\"><code class=\"filename\">pg_hba.conf</code></a>\u5fc5\u987b\u5141\u8bb8\u8be5\u590d\u5236\u8fde\u63a5\u3002\u670d\u52a1\u5668\u8fd8\u5fc5\u987b\u5c06<a class=\"xref\" href=\"/docs/13/runtime-config-replication.html#GUC-MAX-WAL-SENDERS\">max_wal_senders</a>\u8bbe\u7f6e\u5f97\u8db3\u591f\u9ad8\uff0c\u4ee5\u4fbf\u81f3\u5c11\u63d0\u4f9b\u4e00\u4e2a\u7528\u4e8e\u5907\u4efd\u7684 WAL \u53d1\u9001\u8fdb\u7a0b\uff0c\u5e76\u5728\u4f7f\u7528 WAL \u6d41\u5f0f\u4f20\u8f93\u65f6\u518d\u63d0\u4f9b\u4e00\u4e2a WAL \u53d1\u9001\u8fdb\u7a0b\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u540c\u65f6\u8fd0\u884c\u591a\u4e2a<code class=\"command\">pg_basebackup</code>\uff0c\u4f46\u4ece\u6027\u80fd\u89d2\u5ea6\u6765\u770b\uff0c\u901a\u5e38\u6700\u597d\u53ea\u6267\u884c\u4e00\u6b21\u5907\u4efd\uff0c\u7136\u540e\u590d\u5236\u5176\u7ed3\u679c\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u4e0d\u4ec5\u53ef\u4ee5\u4ece\u4e3b\u5e93\u83b7\u53d6\u57fa\u7840\u5907\u4efd\uff0c\u4e5f\u53ef\u4ee5\u4ece\u5907\u5e93\u83b7\u53d6\u3002\u8981\u4ece\u5907\u5e93\u83b7\u53d6\u5907\u4efd\uff0c\u9700\u8981\u5c06\u5907\u5e93\u914d\u7f6e\u4e3a\u80fd\u591f\u63a5\u53d7\u590d\u5236\u8fde\u63a5\uff08\u5373\u8bbe\u7f6e<code class=\"varname\">max_wal_senders</code>\u548c<a class=\"xref\" href=\"/docs/13/runtime-config-replication.html#GUC-HOT-STANDBY\">hot_standby</a>\uff0c\u5e76\u9002\u5f53\u5730\u914d\u7f6e\u5176<code class=\"filename\">pg_hba.conf</code>\uff09\u3002\u8fd8\u9700\u8981\u5728\u4e3b\u5e93\u4e0a\u542f\u7528<a class=\"xref\" href=\"/docs/13/runtime-config-wal.html#GUC-FULL-PAGE-WRITES\">full_page_writes</a>\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u4ece\u5907\u5e93\u83b7\u53d6\u5907\u4efd\u5b58\u5728\u4e00\u4e9b\u9650\u5236\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5907\u4efd\u5386\u53f2\u6587\u4ef6\u4e0d\u4f1a\u5728\u88ab\u5907\u4efd\u7684\u6570\u636e\u5e93\u96c6\u7c07\u4e2d\u521b\u5efa\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">pg_basebackup</span>\u65e0\u6cd5\u5f3a\u5236\u5907\u5e93\u5728\u5907\u4efd\u7ed3\u675f\u65f6\u5207\u6362\u5230\u65b0\u7684 WAL \u6587\u4ef6\u3002\u5f53\u4f7f\u7528<code class=\"literal\">-X none</code>\u65f6\uff0c\u5982\u679c\u4e3b\u5e93\u4e0a\u7684\u5199\u5165\u6d3b\u52a8\u8f83\u5c11\uff0c<span class=\"application\">pg_basebackup</span>\u53ef\u80fd\u9700\u8981\u957f\u65f6\u95f4\u7b49\u5f85\uff0c\u76f4\u5230\u5907\u4efd\u6240\u9700\u7684\u6700\u540e\u4e00\u4e2a WAL \u6587\u4ef6\u88ab\u5207\u6362\u5e76\u5f52\u6863\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5728\u4e3b\u5e93\u4e0a\u8fd0\u884c<code class=\"function\">pg_switch_wal</code>\uff0c\u4ee5\u7acb\u5373\u89e6\u53d1 WAL \u6587\u4ef6\u5207\u6362\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5982\u679c\u5907\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u88ab\u63d0\u5347\u4e3a\u4e3b\u5e93\uff0c\u5219\u5907\u4efd\u4f1a\u5931\u8d25\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5907\u4efd\u6240\u9700\u7684\u6240\u6709 WAL \u8bb0\u5f55\u90fd\u5fc5\u987b\u5305\u542b\u8db3\u591f\u7684\u6574\u9875\u5199\u5165\uff0c\u56e0\u6b64\u5fc5\u987b\u5728\u4e3b\u5e93\u4e0a\u542f\u7528<code class=\"varname\">full_page_writes</code>\uff0c\u5e76\u4e14\u4e0d\u80fd\u628a<span class=\"application\">pg_compresslog</span>\u4e4b\u7c7b\u7684\u5de5\u5177\u7528\u4f5c<code class=\"varname\">archive_command</code>\uff0c\u4ece WAL \u6587\u4ef6\u4e2d\u79fb\u9664\u6574\u9875\u5199\u5165\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u6bcf\u5f53<span class=\"application\">pg_basebackup</span>\u6267\u884c\u57fa\u7840\u5907\u4efd\u65f6\uff0c\u670d\u52a1\u5668\u7684<code class=\"structname\">pg_stat_progress_basebackup</code>\u89c6\u56fe\u90fd\u4f1a\u62a5\u544a\u5907\u4efd\u8fdb\u5ea6\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/13/progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING\" title=\"27.4.5.\u00a0\u57fa\u7840\u5907\u4efd\u8fdb\u5ea6\u62a5\u544a\">\u7b2c\u00a027.4.5\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.9.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u8f93\u51fa\u7684\u4f4d\u7f6e\u548c\u683c\u5f0f\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>directory</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u5199\u5165\u8f93\u51fa\u7684\u76ee\u6807\u76ee\u5f55\u3002\u5982\u679c\u8be5\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u521b\u5efa\u5b83\uff08\u4ee5\u53ca\u6240\u6709\u7f3a\u5931\u7684\u7236\u76ee\u5f55\uff09\u3002\u5982\u679c\u8be5\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002</p>\n<p lang=\"zh\">\u5f53\u5907\u4efd\u91c7\u7528 tar \u683c\u5f0f\u65f6\uff0c\u76ee\u6807\u76ee\u5f55\u53ef\u4ee5\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff08\u77ed\u6a2a\u7ebf\uff09\uff0c\u4ece\u800c\u5c06 tar \u6587\u4ef6\u5199\u5230<code class=\"literal\">stdout</code>\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u662f\u5fc5\u9700\u7684\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>format</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--format=<em class=\"replaceable\"><code>format</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u9009\u62e9\u8f93\u51fa\u683c\u5f0f\u3002<em class=\"replaceable\"><code>format</code></em>\u53ef\u4ee5\u662f\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">p</code><br/></span><span class=\"term\"><code class=\"literal\">plain</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u5199\u4e3a\u666e\u901a\u6587\u4ef6\uff0c\u5176\u5e03\u5c40\u4e0e\u6e90\u670d\u52a1\u5668\u7684\u6570\u636e\u76ee\u5f55\u548c\u8868\u7a7a\u95f4\u76f8\u540c\u3002\u5f53\u96c6\u7c07\u6ca1\u6709\u989d\u5916\u8868\u7a7a\u95f4\u65f6\uff0c\u6574\u4e2a\u6570\u636e\u5e93\u90fd\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u3002\u5982\u679c\u96c6\u7c07\u5305\u542b\u989d\u5916\u8868\u7a7a\u95f4\uff0c\u5219\u4e3b\u6570\u636e\u76ee\u5f55\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\uff0c\u800c\u5176\u4ed6\u6240\u6709\u8868\u7a7a\u95f4\u90fd\u4f1a\u653e\u5728\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u76f8\u540c\u7684\u7edd\u5bf9\u8def\u5f84\u4e2d\u3002\uff08\u5982\u9700\u6539\u53d8\u8fd9\u4e00\u70b9\uff0c\u89c1<code class=\"option\">--tablespace-mapping</code>\u3002\uff09</p>\n<p lang=\"zh\">\u8fd9\u662f\u9ed8\u8ba4\u683c\u5f0f\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">t</code><br/></span><span class=\"term\"><code class=\"literal\">tar</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u5199\u4e3a\u76ee\u6807\u76ee\u5f55\u4e2d\u7684 tar \u6587\u4ef6\u3002\u4e3b\u6570\u636e\u76ee\u5f55\u7684\u5185\u5bb9\u4f1a\u5199\u5165\u540d\u4e3a<code class=\"filename\">base.tar</code>\u7684\u6587\u4ef6\u4e2d\uff0c\u800c\u6bcf\u4e2a\u5176\u4ed6\u8868\u7a7a\u95f4\u90fd\u4f1a\u5199\u5165\u4e00\u4e2a\u4ee5\u8be5\u8868\u7a7a\u95f4 OID \u547d\u540d\u7684\u72ec\u7acb tar \u6587\u4ef6\u4e2d\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u76ee\u6807\u76ee\u5f55\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff08\u77ed\u6a2a\u7ebf\uff09\uff0ctar \u5185\u5bb9\u5c06\u5199\u5165\u6807\u51c6\u8f93\u51fa\uff0c\u9002\u5408\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u4f8b\u5982<span class=\"productname\">gzip</span>\u3002\u53ea\u6709\u5f53\u96c6\u7c07\u6ca1\u6709\u989d\u5916\u8868\u7a7a\u95f4\u4e14\u672a\u4f7f\u7528 WAL \u6d41\u5f0f\u4f20\u8f93\u65f6\uff0c\u624d\u5141\u8bb8\u8fd9\u6837\u505a\u3002</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code><br/></span><span class=\"term\"><code class=\"option\">--write-recovery-conf</code></span></dt>\n<dd>\n<p lang=\"zh\">\u521b\u5efa<a class=\"link\" href=\"/docs/13/warm-standby.html#FILE-STANDBY-SIGNAL\"><code class=\"filename\">standby.signal</code></a> <a class=\"indexterm\" id=\"id-1.9.4.9.6.2.1.3.3.1.2\" name=\"id-1.9.4.9.6.2.1.3.3.1.2\"></a>\u6587\u4ef6\uff0c\u5e76\u5c06\u8fde\u63a5\u8bbe\u7f6e\u8ffd\u52a0\u5230\u76ee\u6807\u76ee\u5f55\u4e2d\u7684<code class=\"filename\">postgresql.auto.conf</code>\u6587\u4ef6\u4e2d\uff08\u5982\u679c\u4f7f\u7528 tar \u683c\u5f0f\uff0c\u5219\u8ffd\u52a0\u5230\u57fa\u7840\u5f52\u6863\u6587\u4ef6\u5185\uff09\u3002\u8fd9\u6837\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u5229\u7528\u5907\u4efd\u7ed3\u679c\u642d\u5efa\u5907\u5e93\u3002</p>\n<p lang=\"zh\"><code class=\"filename\">postgresql.auto.conf</code>\u6587\u4ef6\u4f1a\u8bb0\u5f55<span class=\"application\">pg_basebackup</span>\u6240\u7528\u7684\u8fde\u63a5\u8bbe\u7f6e\uff0c\u4ee5\u53ca\u590d\u5236\u69fd\uff08\u5982\u679c\u6307\u5b9a\u4e86\uff09\uff0c\u4ee5\u4fbf\u6d41\u590d\u5236\u4ee5\u540e\u4f7f\u7528\u76f8\u540c\u7684\u8bbe\u7f6e\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>olddir</code></em>=<em class=\"replaceable\"><code>newdir</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--tablespace-mapping=<em class=\"replaceable\"><code>olddir</code></em>=<em class=\"replaceable\"><code>newdir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u671f\u95f4\uff0c\u5c06\u76ee\u5f55<em class=\"replaceable\"><code>olddir</code></em>\u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230<em class=\"replaceable\"><code>newdir</code></em>\u3002\u8981\u4f7f\u6b64\u9009\u9879\u751f\u6548\uff0c<em class=\"replaceable\"><code>olddir</code></em>\u5fc5\u987b\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u5b9a\u4e49\u7684\u8be5\u8868\u7a7a\u95f4\u8def\u5f84\u5b8c\u5168\u4e00\u81f4\u3002\uff08\u4f46\u5982\u679c\u6e90\u670d\u52a1\u5668\u4e0a\u5728<em class=\"replaceable\"><code>olddir</code></em>\u4e2d\u6ca1\u6709\u8868\u7a7a\u95f4\uff0c\u4e5f\u4e0d\u7b97\u9519\u8bef\u3002\uff09\u4e0e\u6b64\u540c\u65f6\uff0c<em class=\"replaceable\"><code>newdir</code></em>\u662f\u63a5\u6536\u4e3b\u673a\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u4e00\u4e2a\u76ee\u5f55\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c<em class=\"replaceable\"><code>newdir</code></em>\u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002<em class=\"replaceable\"><code>olddir</code></em>\u548c<em class=\"replaceable\"><code>newdir</code></em>\u90fd\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u5982\u679c\u4efb\u4e00\u8def\u5f84\u4e2d\u9700\u8981\u5305\u542b\u7b49\u53f7\uff08<code class=\"literal\">=</code>\uff09\uff0c\u8bf7\u5728\u5176\u524d\u9762\u52a0\u4e0a\u53cd\u659c\u6760\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u4ee5\u5904\u7406\u591a\u4e2a\u8868\u7a7a\u95f4\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u91cd\u5b9a\u4f4d\u8868\u7a7a\u95f4\uff0c\u4e3b\u6570\u636e\u76ee\u5f55\u4e2d\u7684\u7b26\u53f7\u94fe\u63a5\u5c06\u88ab\u66f4\u65b0\u4e3a\u6307\u5411\u65b0\u4f4d\u7f6e\u3002\u56e0\u6b64\uff0c\u65b0\u6570\u636e\u76ee\u5f55\u5df2\u53ef\u76f4\u63a5\u7528\u4e8e\u542f\u52a8\u4e00\u4e2a\u6240\u6709\u8868\u7a7a\u95f4\u90fd\u4f4d\u4e8e\u66f4\u65b0\u540e\u4f4d\u7f6e\u7684\u65b0\u670d\u52a1\u5668\u5b9e\u4f8b\u3002</p>\n<p lang=\"zh\">\u76ee\u524d\uff0c\u6b64\u9009\u9879\u4ec5\u9002\u7528\u4e8e\u666e\u901a\u6587\u4ef6\u8f93\u51fa\u683c\u5f0f\uff1b\u5982\u679c\u9009\u62e9\u4e86 tar \u683c\u5f0f\uff0c\u5219\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--waldir=<em class=\"replaceable\"><code>waldir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5199\u5165 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cWAL \u6587\u4ef6\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u7684<code class=\"filename\">pg_wal</code>\u5b50\u76ee\u5f55\u4e2d\uff0c\u4f46\u6b64\u9009\u9879\u53ef\u7528\u4e8e\u5c06\u5176\u653e\u5728\u5176\u4ed6\u4f4d\u7f6e\u3002<em class=\"replaceable\"><code>waldir</code></em>\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c<em class=\"replaceable\"><code>waldir</code></em>\u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002\u53ea\u6709\u5f53\u5907\u4efd\u91c7\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u624d\u80fd\u6307\u5b9a\u6b64\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-X <em class=\"replaceable\"><code>method</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--wal-method=<em class=\"replaceable\"><code>method</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u4e2d\u5305\u542b\u6240\u9700\u7684 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u3002\u8fd9\u5c06\u5305\u62ec\u5907\u4efd\u671f\u95f4\u751f\u6210\u7684\u6240\u6709\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u9664\u975e\u6307\u5b9a\u65b9\u6cd5<code class=\"literal\">none</code>\uff0c\u5426\u5219\u5c31\u53ef\u4ee5\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u542f\u52a8 postmaster\uff0c\u800c\u65e0\u9700\u67e5\u9605 WAL \u5f52\u6863\uff0c\u4ece\u800c\u4f7f\u8f93\u51fa\u6210\u4e3a\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u5907\u4efd\u3002</p>\n<p lang=\"zh\">\u652f\u6301\u4ee5\u4e0b\u7528\u4e8e\u6536\u96c6\u9884\u5199\u5f0f\u65e5\u5fd7\u7684<em class=\"replaceable\"><code>method</code></em>\u503c\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">n</code><br/></span><span class=\"term\"><code class=\"literal\">none</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u5728\u5907\u4efd\u4e2d\u5305\u542b\u9884\u5199\u5f0f\u65e5\u5fd7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">f</code><br/></span><span class=\"term\"><code class=\"literal\">fetch</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u7ed3\u675f\u65f6\u6536\u96c6\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u3002\u56e0\u6b64\uff0c\u6e90\u670d\u52a1\u5668\u7684<a class=\"xref\" href=\"/docs/13/runtime-config-replication.html#GUC-WAL-KEEP-SIZE\">wal_keep_size</a>\u53c2\u6570\u5fc5\u987b\u8bbe\u7f6e\u5f97\u8db3\u591f\u9ad8\uff0c\u4ee5\u786e\u4fdd\u5728\u5907\u4efd\u7ed3\u675f\u524d\u4e0d\u4f1a\u79fb\u9664\u6240\u9700\u7684\u65e5\u5fd7\u6570\u636e\u3002\u5982\u679c\u5728\u4f20\u8f93\u8fd9\u4e9b\u6570\u636e\u4e4b\u524d\u5b83\u4eec\u5df2\u7ecf\u88ab\u56de\u6536\uff0c\u5219\u5907\u4efd\u4f1a\u5931\u8d25\u5e76\u4e14\u65e0\u6cd5\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u4f1a\u5305\u542b\u5728<code class=\"filename\">base.tar</code>\u6587\u4ef6\u4e2d\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">s</code><br/></span><span class=\"term\"><code class=\"literal\">stream</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u6267\u884c\u5907\u4efd\u7684\u540c\u65f6\u6d41\u5f0f\u4f20\u8f93\u9884\u5199\u5f0f\u65e5\u5fd7\u6570\u636e\u3002\u6b64\u65b9\u6cd5\u4f1a\u5411\u670d\u52a1\u5668\u6253\u5f00\u7b2c\u4e8c\u4e2a\u8fde\u63a5\uff0c\u5e76\u5728\u6267\u884c\u5907\u4efd\u65f6\u5e76\u884c\u5f00\u59cb\u6d41\u5f0f\u4f20\u8f93\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u56e0\u6b64\uff0c\u5b83\u9700\u8981\u4e24\u4e2a\u590d\u5236\u8fde\u63a5\uff0c\u800c\u4e0d\u53ea\u662f\u4e00\u4e2a\u3002\u53ea\u8981\u5ba2\u6237\u7aef\u80fd\u591f\u8ddf\u4e0a\u9884\u5199\u5f0f\u65e5\u5fd7\u6570\u636e\uff0c\u4f7f\u7528\u6b64\u65b9\u6cd5\u5c31\u4e0d\u9700\u8981\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u989d\u5916\u4fdd\u7559\u9884\u5199\u5f0f\u65e5\u5fd7\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u4f1a\u5199\u5165\u4e00\u4e2a\u540d\u4e3a<code class=\"filename\">pg_wal.tar</code>\u7684\u72ec\u7acb\u6587\u4ef6\u4e2d\uff08\u5982\u679c\u670d\u52a1\u5668\u7248\u672c\u65e9\u4e8e 10\uff0c\u5219\u6587\u4ef6\u540d\u4e3a<code class=\"filename\">pg_xlog.tar</code>\uff09\u3002</p>\n<p lang=\"zh\">\u8fd9\u662f\u9ed8\u8ba4\u503c\u3002</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-z</code><br/></span><span class=\"term\"><code class=\"option\">--gzip</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u4f7f\u7528\u9ed8\u8ba4\u538b\u7f29\u7ea7\u522b\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0<code class=\"filename\">.gz</code>\u540e\u7f00\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-Z <em class=\"replaceable\"><code>level</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--compress=<em class=\"replaceable\"><code>level</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u5e76\u6307\u5b9a\u538b\u7f29\u7ea7\u522b\uff080 \u5230 9\uff0c\u5176\u4e2d 0 \u8868\u793a\u4e0d\u538b\u7f29\uff0c9 \u8868\u793a\u6700\u4f73\u538b\u7f29\uff09\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0<code class=\"filename\">.gz</code>\u540e\u7f00\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u5907\u4efd\u7684\u751f\u6210\u548c\u7a0b\u5e8f\u7684\u8c03\u7528\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>fast|spread</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--checkpoint=<em class=\"replaceable\"><code>fast|spread</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u68c0\u67e5\u70b9\u6a21\u5f0f\u8bbe\u7f6e\u4e3a fast\uff08\u7acb\u5373\uff09\u6216 spread\uff08\u9ed8\u8ba4\uff09\uff08\u89c1<a class=\"xref\" href=\"/docs/13/continuous-archiving.html#BACKUP-LOWLEVEL-BASE-BACKUP\" title=\"25.3.3.\u00a0\u4f7f\u7528\u4f4e\u7ea7 API \u8fdb\u884c\u57fa\u7840\u5907\u4efd\">\u7b2c\u00a025.3.3\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--create-slot</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728\u5f00\u59cb\u5907\u4efd\u4e4b\u524d\uff0c\u5e94\u521b\u5efa\u7531<code class=\"literal\">--slot</code>\u9009\u9879\u6307\u5b9a\u540d\u79f0\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u8be5\u69fd\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u9519\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>label</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--label=<em class=\"replaceable\"><code>label</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5907\u4efd\u6807\u7b7e\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u503c<span class=\"quote\">\u201c<span class=\"quote\"><code class=\"literal\">pg_basebackup base backup</code></span>\u201d</span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-clean</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53<code class=\"command\">pg_basebackup</code>\u56e0\u9519\u8bef\u4e2d\u6b62\u65f6\uff0c\u5b83\u4f1a\u5220\u9664\u5728\u53d1\u73b0\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u76ee\u5f55\uff08\u4f8b\u5982\u76ee\u6807\u76ee\u5f55\u548c\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\uff09\u3002\u6b64\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u5f88\u6709\u5e2e\u52a9\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u65e0\u8bba\u662f\u5426\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u8868\u7a7a\u95f4\u76ee\u5f55\u90fd\u4e0d\u4f1a\u88ab\u6e05\u7406\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N</code><br/></span><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">pg_basebackup</code>\u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u88ab\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f1a\u4f7f<code class=\"command\">pg_basebackup</code>\u4e0d\u7ecf\u7b49\u5f85\u5c31\u76f4\u63a5\u8fd4\u56de\uff0c\u56e0\u6b64\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u968f\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u57fa\u7840\u5907\u4efd\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u5408\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P</code><br/></span><span class=\"term\"><code class=\"option\">--progress</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528\u8fdb\u5ea6\u62a5\u544a\u3002\u6253\u5f00\u6b64\u9009\u9879\u540e\uff0c\u4f1a\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u7ed9\u51fa\u4e00\u4e2a\u8fd1\u4f3c\u7684\u8fdb\u5ea6\u62a5\u544a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u53d1\u751f\u53d8\u5316\uff0c\u56e0\u6b64\u8fd9\u53ea\u662f\u8fd1\u4f3c\u503c\uff0c\u6700\u7ec8\u672a\u5fc5\u6070\u597d\u7ed3\u675f\u5728<code class=\"literal\">100%</code>\u3002\u7279\u522b\u662f\u5f53\u5907\u4efd\u4e2d\u5305\u542b WAL \u65f6\uff0c\u603b\u6570\u636e\u91cf\u65e0\u6cd5\u9884\u5148\u4f30\u8ba1\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u65e6\u8fdb\u5ea6\u8d85\u8fc7\u4e0d\u542b WAL \u65f6\u7684\u603b\u4f30\u8ba1\u503c\uff0c\u4f30\u8ba1\u76ee\u6807\u5927\u5c0f\u5c31\u4f1a\u7ee7\u7eed\u589e\u52a0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r <em class=\"replaceable\"><code>rate</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--max-rate=<em class=\"replaceable\"><code>rate</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u4ece\u6e90\u670d\u52a1\u5668\u6536\u96c6\u6570\u636e\u65f6\u5141\u8bb8\u7684\u6700\u5927\u4f20\u8f93\u901f\u7387\u3002\u8fd9\u6709\u52a9\u4e8e\u9650\u5236<span class=\"application\">pg_basebackup</span>\u5bf9\u670d\u52a1\u5668\u7684\u5f71\u54cd\u3002\u53d6\u503c\u5355\u4f4d\u4e3a\u6bcf\u79d2\u5343\u5b57\u8282\u3002\u4f7f\u7528\u540e\u7f00<code class=\"literal\">M</code>\u8868\u793a\u6bcf\u79d2\u5146\u5b57\u8282\u3002\u4e5f\u63a5\u53d7\u540e\u7f00<code class=\"literal\">k</code>\uff0c\u4f46\u6ca1\u6709\u5b9e\u9645\u5f71\u54cd\u3002\u6709\u6548\u53d6\u503c\u8303\u56f4\u4e3a\u6bcf\u79d2 32 \u5343\u5b57\u8282\u5230\u6bcf\u79d2 1024 \u5146\u5b57\u8282\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u59cb\u7ec8\u5f71\u54cd\u6570\u636e\u76ee\u5f55\u7684\u4f20\u8f93\u3002\u53ea\u6709\u5f53\u6536\u96c6\u65b9\u6cd5\u4e3a<code class=\"literal\">fetch</code>\u65f6\uff0cWAL \u6587\u4ef6\u7684\u4f20\u8f93\u624d\u4f1a\u53d7\u5230\u5f71\u54cd\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>slotname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--slot=<em class=\"replaceable\"><code>slotname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u53ea\u80fd\u4e0e<code class=\"literal\">-X stream</code>\u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u4f1a\u4f7f WAL \u6d41\u5f0f\u4f20\u8f93\u4f7f\u7528\u6307\u5b9a\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u6b64\u57fa\u7840\u5907\u4efd\u6253\u7b97\u7528\u4f5c\u4f7f\u7528\u590d\u5236\u69fd\u7684\u6d41\u590d\u5236\u5907\u5e93\uff0c\u90a3\u4e48\u8be5\u5907\u5e93\u5e94\u5c06\u540c\u4e00\u4e2a\u590d\u5236\u69fd\u540d\u79f0\u7528\u4f5c<a class=\"xref\" href=\"/docs/13/runtime-config-replication.html#GUC-PRIMARY-SLOT-NAME\">primary_slot_name</a>\u7684\u503c\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u4e3b\u5e93\u5728\u57fa\u7840\u5907\u4efd\u7ed3\u675f\u4e0e\u65b0\u5907\u5e93\u5f00\u59cb\u6d41\u590d\u5236\u4e4b\u95f4\u7684\u8fd9\u6bb5\u65f6\u95f4\u5185\uff0c\u4e0d\u4f1a\u79fb\u9664\u4efb\u4f55\u5fc5\u9700\u7684 WAL \u6570\u636e\u3002</p>\n<p lang=\"zh\">\u6307\u5b9a\u7684\u590d\u5236\u69fd\u5fc5\u987b\u5df2\u7ecf\u5b58\u5728\uff0c\u9664\u975e\u8fd8\u540c\u65f6\u4f7f\u7528\u4e86<code class=\"option\">-C</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5e76\u4e14\u670d\u52a1\u5668\u652f\u6301\u4e34\u65f6\u590d\u5236\u69fd\uff0810 \u53ca\u4ee5\u4e0a\u7248\u672c\uff09\uff0c\u5219\u4f1a\u81ea\u52a8\u4f7f\u7528\u4e34\u65f6\u590d\u5236\u69fd\u8fdb\u884c WAL \u6d41\u5f0f\u4f20\u8f93\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\u3002\u5b83\u4f1a\u5728\u542f\u52a8\u548c\u5173\u95ed\u8fc7\u7a0b\u4e2d\u8f93\u51fa\u4e00\u4e9b\u989d\u5916\u6b65\u9aa4\uff1b\u5982\u679c\u540c\u65f6\u542f\u7528\u4e86\u8fdb\u5ea6\u62a5\u544a\uff0c\u8fd8\u4f1a\u663e\u793a\u5f53\u524d\u6b63\u5728\u5904\u7406\u7684\u786e\u5207\u6587\u4ef6\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--manifest-checksums=<em class=\"replaceable\"><code>algorithm</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u5e94\u7528\u5230\u5907\u4efd\u6e05\u5355\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u7684\u6821\u9a8c\u548c\u7b97\u6cd5\u3002\u76ee\u524d\u53ef\u7528\u7684\u7b97\u6cd5\u6709<code class=\"literal\">NONE</code>\u3001<code class=\"literal\">CRC32C</code>\u3001<code class=\"literal\">SHA224</code>\u3001<code class=\"literal\">SHA256</code>\u3001<code class=\"literal\">SHA384</code>\u548c<code class=\"literal\">SHA512</code>\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">CRC32C</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">NONE</code>\uff0c\u5907\u4efd\u6e05\u5355\u5c06\u4e0d\u5305\u542b\u4efb\u4f55\u6821\u9a8c\u548c\u3002\u5426\u5219\uff0c\u5b83\u5c06\u5305\u542b\u4f7f\u7528\u6307\u5b9a\u7b97\u6cd5\u4e3a\u5907\u4efd\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u8ba1\u7b97\u7684\u6821\u9a8c\u548c\u3002\u6b64\u5916\uff0c\u6e05\u5355\u59cb\u7ec8\u4f1a\u5305\u542b\u5176\u81ea\u8eab\u5185\u5bb9\u7684<code class=\"literal\">SHA256</code>\u6821\u9a8c\u548c\u3002<code class=\"literal\">SHA</code>\u7b97\u6cd5\u660e\u663e\u6bd4<code class=\"literal\">CRC32C</code>\u66f4\u8017\u8d39 CPU\uff0c\u56e0\u6b64\u9009\u62e9\u5176\u4e2d\u4e00\u79cd\u53ef\u80fd\u4f1a\u589e\u52a0\u5b8c\u6210\u5907\u4efd\u6240\u9700\u7684\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u5e0c\u671b\u9a8c\u8bc1\u5907\u4efd\u672a\u88ab\u7be1\u6539\u7684\u7528\u6237\uff0c\u4f7f\u7528 SHA hash \u51fd\u6570\u53ef\u4ee5\u4e3a\u6bcf\u4e2a\u6587\u4ef6\u63d0\u4f9b\u5177\u6709\u5bc6\u7801\u5b66\u5b89\u5168\u6027\u7684\u6458\u8981\uff1b\u800c CRC32C \u7b97\u6cd5\u63d0\u4f9b\u7684\u6821\u9a8c\u548c\u8ba1\u7b97\u901f\u5ea6\u8981\u5feb\u5f97\u591a\uff0c\u867d\u7136\u5b83\u5f88\u9002\u5408\u53d1\u73b0\u7531\u4e8e\u610f\u5916\u6539\u52a8\u9020\u6210\u7684\u9519\u8bef\uff0c\u4f46\u5e76\u4e0d\u80fd\u62b5\u5fa1\u6076\u610f\u4fee\u6539\u3002\u8bf7\u6ce8\u610f\uff0c\u8981\u60f3\u5bf9\u80fd\u591f\u8bbf\u95ee\u5907\u4efd\u7684\u653b\u51fb\u8005\u5f62\u6210\u9632\u62a4\uff0c\u5907\u4efd\u6e05\u5355\u5c31\u9700\u8981\u5b89\u5168\u5730\u4fdd\u5b58\u5728\u5176\u4ed6\u5730\u65b9\uff0c\u6216\u8005\u4ee5\u5176\u4ed6\u65b9\u5f0f\u786e\u8ba4\u81ea\u5907\u4efd\u5b8c\u6210\u540e\u672a\u88ab\u4fee\u6539\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528<a class=\"xref\" href=\"/docs/13/app-pgverifybackup.html\" title=\"pg_verifybackup\"><span class=\"refentrytitle\">pg_verifybackup</span></a>\u6839\u636e\u5907\u4efd\u6e05\u5355\u68c0\u67e5\u5907\u4efd\u7684\u5b8c\u6574\u6027\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--manifest-force-encode</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f3a\u5236\u5c06\u5907\u4efd\u6e05\u5355\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u540d\u7f16\u7801\u4e3a\u5341\u516d\u8fdb\u5236\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u5bf9\u975e UTF8 \u6587\u4ef6\u540d\u8fdb\u884c\u5341\u516d\u8fdb\u5236\u7f16\u7801\u3002\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u8bfb\u53d6\u5907\u4efd\u6e05\u5355\u6587\u4ef6\u7684\u5de5\u5177\u662f\u5426\u80fd\u6b63\u786e\u5904\u7406\u8fd9\u79cd\u60c5\u51b5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-estimate-size</code></span></dt>\n<dd>\n<p lang=\"zh\">\u7981\u6b62\u670d\u52a1\u5668\u4f30\u7b97\u5c06\u8981\u6d41\u5f0f\u4f20\u8f93\u7684\u5907\u4efd\u6570\u636e\u603b\u91cf\uff0c\u56e0\u6b64 pg_stat_progress_basebackup \u89c6\u56fe\u4e2d\u7684 backup_total \u5217\u59cb\u7ec8\u4e3a NULL\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5907\u4efd\u4f1a\u5148\u679a\u4e3e\u6574\u4e2a\u6570\u636e\u5e93\u7684\u5927\u5c0f\uff0c\u7136\u540e\u518d\u56de\u8fc7\u5934\u6765\u53d1\u9001\u5b9e\u9645\u5185\u5bb9\u3002\u8fd9\u53ef\u80fd\u4f1a\u8ba9\u5907\u4efd\u8017\u65f6\u7565\u957f\uff0c\u7279\u522b\u662f\u5728\u53d1\u9001\u7b2c\u4e00\u6279\u6570\u636e\u4e4b\u524d\u6240\u9700\u65f6\u95f4\u4f1a\u66f4\u4e45\u3002\u5982\u679c\u8fd9\u79cd\u4f30\u7b97\u8017\u65f6\u8fc7\u957f\uff0c\u6b64\u9009\u9879\u5c31\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u5b83\u53ef\u4ee5\u907f\u514d\u8fd9\u6bb5\u4f30\u7b97\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--progress</code>\u65f6\uff0c\u4e0d\u5141\u8bb8\u4f7f\u7528\u6b64\u9009\u9879\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-manifest</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7981\u6b62\u751f\u6210\u5907\u4efd\u6e05\u5355\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u670d\u52a1\u5668\u5c06\u751f\u6210\u5e76\u53d1\u9001\u4e00\u4e2a\u5907\u4efd\u6e05\u5355\uff0c\u53ef\u4f7f\u7528<a class=\"xref\" href=\"/docs/13/app-pgverifybackup.html\" title=\"pg_verifybackup\"><span class=\"refentrytitle\">pg_verifybackup</span></a>\u8fdb\u884c\u9a8c\u8bc1\u3002\u8be5\u6e05\u5355\u5217\u51fa\u4e86\u5907\u4efd\u4e2d\u7684\u6bcf\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u4e0d\u5305\u62ec\u53ef\u80fd\u5305\u542b\u5728\u5176\u4e2d\u7684\u4efb\u4f55 WAL \u6587\u4ef6\u3002\u5b83\u8fd8\u4f1a\u4fdd\u5b58\u6bcf\u4e2a\u6587\u4ef6\u7684\u5927\u5c0f\u3001\u6700\u540e\u4fee\u6539\u65f6\u95f4\u4ee5\u53ca\u53ef\u9009\u7684\u6821\u9a8c\u548c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-slot</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9632\u6b62\u4e3a\u5907\u4efd\u521b\u5efa\u4e34\u65f6\u590d\u5236\u69fd\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u9009\u62e9\u4e86 WAL \u6d41\u5f0f\u4f20\u8f93\uff0c\u4f46\u6ca1\u6709\u4f7f\u7528<code class=\"option\">-S</code>\u9009\u9879\u7ed9\u51fa\u69fd\u540d\uff0c\u90a3\u4e48\u4f1a\u521b\u5efa\u4e00\u4e2a\u4e34\u65f6\u590d\u5236\u69fd\uff08\u5982\u679c\u6e90\u670d\u52a1\u5668\u652f\u6301\uff09\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7684\u4e3b\u8981\u76ee\u7684\u662f\u5728\u670d\u52a1\u5668\u6ca1\u6709\u7a7a\u95f2\u590d\u5236\u69fd\u65f6\uff0c\u4ecd\u7136\u5141\u8bb8\u6267\u884c\u57fa\u7840\u5907\u4efd\u3002\u51e0\u4e4e\u603b\u662f\u9996\u9009\u4f7f\u7528\u590d\u5236\u69fd\uff0c\u56e0\u4e3a\u5b83\u80fd\u9632\u6b62\u670d\u52a1\u5668\u5728\u5907\u4efd\u671f\u95f4\u79fb\u9664\u6240\u9700\u7684 WAL\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-verify-checksums</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u83b7\u53d6\u57fa\u7840\u5907\u4efd\u7684\u670d\u52a1\u5668\u542f\u7528\u4e86\u6821\u9a8c\u548c\uff0c\u5219\u7981\u7528\u5bf9\u8fd9\u4e9b\u6821\u9a8c\u548c\u7684\u9a8c\u8bc1\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f1a\u9a8c\u8bc1\u6821\u9a8c\u548c\uff1b\u6821\u9a8c\u548c\u9a8c\u8bc1\u5931\u8d25\u5c06\u5bfc\u81f4\u975e\u96f6\u9000\u51fa\u72b6\u6001\u3002\u4e0d\u8fc7\uff0c\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u57fa\u7840\u5907\u4efd\u4e0d\u4f1a\u88ab\u5220\u9664\uff0c\u5c31\u50cf\u4f7f\u7528\u4e86<code class=\"option\">--no-clean</code>\u4e00\u6837\u3002\u6821\u9a8c\u548c\u9a8c\u8bc1\u5931\u8d25\u4e5f\u4f1a\u5728<a class=\"link\" href=\"/docs/13/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW\" title=\"27.2.11.\u00a0pg_stat_database\"><code class=\"structname\">pg_stat_database</code></a>\u89c6\u56fe\u4e2d\u62a5\u544a\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u5230\u6e90\u670d\u52a1\u5668\u7684\u8fde\u63a5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>connstr</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>connstr</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ee5<a class=\"link\" href=\"/docs/13/libpq.html#LIBPQ-CONNSTRING\" title=\"33.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u7684\u5f62\u5f0f\u6307\u5b9a\u7528\u4e8e\u8fde\u63a5\u670d\u52a1\u5668\u7684\u53c2\u6570\uff1b\u8fd9\u4e9b\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u76f8\u4e92\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u51fa\u4e8e\u4e0e\u5176\u4ed6\u5ba2\u6237\u7aef\u5e94\u7528\u4fdd\u6301\u4e00\u81f4\u7684\u8003\u8651\uff0c\u6b64\u9009\u9879\u540d\u4e3a<code class=\"literal\">--dbname</code>\uff1b\u4f46\u7531\u4e8e<span class=\"application\">pg_basebackup</span>\u5e76\u4e0d\u8fde\u63a5\u5230\u96c6\u7c07\u4e2d\u7684\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u4e2d\u7684\u4efb\u4f55\u6570\u636e\u5e93\u540d\u90fd\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea<code class=\"envar\">PGHOST</code>\u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff1b\u5426\u5219\u4f1a\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u6240\u4f7f\u7528\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u4f7f\u7528<code class=\"envar\">PGPORT</code>\u73af\u5883\u53d8\u91cf\u4e2d\u7684\u503c\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u786e\u5b9a\u7684\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s <em class=\"replaceable\"><code>interval</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--status-interval=<em class=\"replaceable\"><code>interval</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u53d1\u9001\u56de\u6e90\u670d\u52a1\u5668\u7684\u72b6\u6001\u5305\u4e4b\u95f4\u76f8\u9694\u7684\u79d2\u6570\u3002\u8f83\u5c0f\u7684\u503c\u53ef\u4ee5\u8ba9\u670d\u52a1\u5668\u7aef\u5bf9\u5907\u4efd\u8fdb\u5ea6\u7684\u76d1\u63a7\u66f4\u7cbe\u786e\u3002\u503c\u4e3a\u96f6\u65f6\u4f1a\u5b8c\u5168\u7981\u7528\u5468\u671f\u6027\u72b6\u6001\u66f4\u65b0\uff0c\u4e0d\u8fc7\u5f53\u670d\u52a1\u5668\u8bf7\u6c42\u65f6\u4ecd\u4f1a\u53d1\u9001\u66f4\u65b0\uff0c\u4ee5\u907f\u514d\u56e0\u8d85\u65f6\u800c\u65ad\u5f00\u8fde\u63a5\u3002\u9ed8\u8ba4\u503c\u662f 10 \u79d2\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7981\u6b62\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\uff08\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff09\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u6b64\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u79cd\u573a\u666f\u4e0b\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236<span class=\"application\">pg_basebackup</span>\u5728\u8fde\u63a5\u6e90\u670d\u52a1\u5668\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7edd\u975e\u5fc5\u9700\uff0c\u56e0\u4e3a\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u81ea\u52a8\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\u6765\u53d1\u73b0\u670d\u52a1\u5668\u9700\u8981\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u8f93\u5165<code class=\"option\">-W</code>\u4ee5\u907f\u514d\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u662f\u503c\u5f97\u7684\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5176\u4ed6\u9009\u9879\u4e5f\u53ef\u7528\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa<span class=\"application\">pg_basebackup</span>\u7684\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"application\">pg_basebackup</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.9.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6<span class=\"productname\">PostgreSQL</span>\u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528<span class=\"application\">libpq</span>\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/13/libpq-envars.html\" title=\"33.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a033.14\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\">\u73af\u5883\u53d8\u91cf<code class=\"envar\">PG_COLOR</code>\u6307\u5b9a\u662f\u5426\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a<code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c<code class=\"literal\">never</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.9.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u5728\u5907\u4efd\u5f00\u59cb\u65f6\uff0c\u9700\u8981\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u6267\u884c\u4e00\u6b21\u68c0\u67e5\u70b9\u3002\u8fd9\u53ef\u80fd\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\uff08\u5c24\u5176\u662f\u5728\u672a\u4f7f\u7528<code class=\"literal\">--checkpoint=fast</code>\u9009\u9879\u65f6\uff09\uff1b\u5728\u6b64\u671f\u95f4\uff0c<span class=\"application\">pg_basebackup</span>\u770b\u8d77\u6765\u4f1a\u5904\u4e8e\u7a7a\u95f2\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u5907\u4efd\u5c06\u5305\u62ec\u6570\u636e\u76ee\u5f55\u548c\u8868\u7a7a\u95f4\u4e2d\u7684\u6240\u6709\u6587\u4ef6\uff0c\u5305\u62ec\u914d\u7f6e\u6587\u4ef6\u4ee5\u53ca\u7b2c\u4e09\u65b9\u653e\u5728\u8fd9\u4e9b\u76ee\u5f55\u4e2d\u7684\u4efb\u4f55\u989d\u5916\u6587\u4ef6\uff0c\u4f46\u7531 PostgreSQL \u7ba1\u7406\u7684\u67d0\u4e9b\u4e34\u65f6\u6587\u4ef6\u9664\u5916\u3002\u4e0d\u8fc7\uff0c\u53ea\u6709\u666e\u901a\u6587\u4ef6\u548c\u76ee\u5f55\u4f1a\u88ab\u590d\u5236\uff0c\u4f46\u7528\u4e8e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u4f1a\u88ab\u4fdd\u7559\u3002\u6307\u5411 PostgreSQL \u5df2\u77e5\u7684\u67d0\u4e9b\u76ee\u5f55\u7684\u7b26\u53f7\u94fe\u63a5\u4f1a\u88ab\u590d\u5236\u4e3a\u7a7a\u76ee\u5f55\u3002\u5176\u4ed6\u7b26\u53f7\u94fe\u63a5\u548c\u7279\u6b8a\u8bbe\u5907\u6587\u4ef6\u5219\u4f1a\u88ab\u8df3\u8fc7\u3002\u5177\u4f53\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/13/protocol-replication.html\" title=\"52.4.\u00a0\u6d41\u590d\u5236\u534f\u8bae\">\u7b2c\u00a052.4\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5728\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u4e2d\uff0c\u9664\u975e\u4f7f\u7528\u4e86<code class=\"literal\">--tablespace-mapping</code>\u9009\u9879\uff0c\u5426\u5219\u8868\u7a7a\u95f4\u4f1a\u5907\u4efd\u5230\u5176\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u7684\u76f8\u540c\u8def\u5f84\u3002\u5982\u679c\u4e0d\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u90a3\u4e48\u5f53\u8868\u7a7a\u95f4\u6b63\u5728\u4f7f\u7528\u65f6\uff0c\u5c31\u65e0\u6cd5\u5728\u4e0e\u670d\u52a1\u5668\u76f8\u540c\u7684\u4e3b\u673a\u4e0a\u6267\u884c\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u7684\u57fa\u7840\u5907\u4efd\uff0c\u56e0\u4e3a\u5907\u4efd\u5c06\u4e0d\u5f97\u4e0d\u5199\u5165\u4e0e\u539f\u59cb\u8868\u7a7a\u95f4\u76f8\u540c\u7684\u76ee\u5f55\u4f4d\u7f6e\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u7528\u6237\u9700\u8981\u5728\u542f\u52a8\u4f7f\u7528\u8fd9\u4e9b\u6570\u636e\u7684 PostgreSQL \u670d\u52a1\u5668\u4e4b\u524d\uff0c\u81ea\u884c\u89e3\u5f00\u6bcf\u4e2a tar \u6587\u4ef6\u3002\u5982\u679c\u5b58\u5728\u989d\u5916\u7684\u8868\u7a7a\u95f4\uff0c\u5fc5\u987b\u5c06\u5bf9\u5e94\u7684 tar \u6587\u4ef6\u89e3\u538b\u5230\u6b63\u786e\u4f4d\u7f6e\u3002\u6b64\u65f6\uff0c\u670d\u52a1\u5668\u4f1a\u6839\u636e base.tar \u4e2d tablespace_map \u6587\u4ef6\u7684\u5185\u5bb9\uff0c\u4e3a\u8fd9\u4e9b\u8868\u7a7a\u95f4\u521b\u5efa\u7b26\u53f7\u94fe\u63a5\u3002</p>\n<p lang=\"zh\">pg_basebackup \u53ef\u4e0e\u76f8\u540c\u6216\u66f4\u65e9\u4e3b\u8981\u7248\u672c\u7684\u670d\u52a1\u5668\u914d\u5408\u4f7f\u7528\uff0c\u6700\u4f4e\u652f\u6301 9.1\u3002\u4e0d\u8fc7\uff0cWAL \u6d41\u5f0f\u4f20\u8f93\u6a21\u5f0f\uff08-X stream\uff09\u53ea\u9002\u7528\u4e8e 9.3 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\uff0ctar \u683c\u5f0f\uff08--format=tar\uff09\u53ea\u9002\u7528\u4e8e 9.5 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6e90\u96c6\u7c07\u542f\u7528\u4e86\u6570\u636e\u6587\u4ef6\u7684\u7ec4\u6743\u9650\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u4fdd\u7559\u8fd9\u4e9b\u7ec4\u6743\u9650\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.9.9\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u8981\u4e3a\u670d\u52a1\u5668<code class=\"literal\">mydbserver</code>\u521b\u5efa\u4e00\u4e2a\u57fa\u7840\u5907\u4efd\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5230\u672c\u5730\u76ee\u5f55<code class=\"filename\">/usr/local/pgsql/data</code>\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -h mydbserver -D /usr/local/pgsql/data</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u672c\u5730\u670d\u52a1\u5668\u521b\u5efa\u4e00\u4e2a\u5907\u4efd\uff0c\u4e3a\u6bcf\u4e2a\u8868\u7a7a\u95f4\u5404\u751f\u6210\u4e00\u4e2a\u538b\u7f29\u7684 tar \u6587\u4ef6\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5728\u76ee\u5f55<code class=\"filename\">backup</code>\u4e2d\uff0c\u540c\u65f6\u5728\u8fd0\u884c\u671f\u95f4\u663e\u793a\u8fdb\u5ea6\u62a5\u544a\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup -Ft -z -P</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u4e00\u4e2a\u4ec5\u5305\u542b\u5355\u4e2a\u8868\u7a7a\u95f4\u7684\u672c\u5730\u6570\u636e\u5e93\u521b\u5efa\u5907\u4efd\uff0c\u5e76\u4f7f\u7528<span class=\"productname\">bzip2</span>\u8fdb\u884c\u538b\u7f29\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D - -Ft -X fetch | bzip2 &gt; backup.tar.bz2</code></strong>\n</pre>\n<p lang=\"zh\">\uff08\u5982\u679c\u8be5\u6570\u636e\u5e93\u4e2d\u6709\u591a\u4e2a\u8868\u7a7a\u95f4\uff0c\u6b64\u547d\u4ee4\u5c06\u5931\u8d25\u3002\uff09</p>\n<p lang=\"zh\">\u8981\u521b\u5efa\u4e00\u4e2a\u672c\u5730\u6570\u636e\u5e93\u7684\u5907\u4efd\uff0c\u5e76\u5c06\u4f4d\u4e8e<code class=\"filename\">/opt/ts</code>\u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230<code class=\"filename\">./backup/ts</code>\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup/data -T /opt/ts=$(pwd)/backup/ts</code></strong>\n</pre>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.9.10\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/13/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a></span>\n</div>\n</div></div>", "manual_path": "app-pgbasebackup.html", "localization": {"status": "complete", "sources": [{"url": "/docs/13/app-pgbasebackup.html", "method": "same-major semantic node", "sha256": "f0131150f7b77e0c6b01fed10a15c2096d9de6e4ed1be4fbfb3b921170a498fd", "language": "zh", "matched_nodes": ["#APP-PGBASEBACKUP/div[2]/p[1]", "#APP-PGBASEBACKUP/div[3]/h2[0]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[0]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[1]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[2]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[3]", "#APP-PGBASEBACKUP/div[4]/p[1]", "#APP-PGBASEBACKUP/div[4]/p[2]", "#APP-PGBASEBACKUP/div[4]/p[3]", "#APP-PGBASEBACKUP/div[4]/p[4]", "#APP-PGBASEBACKUP/div[4]/p[5]", "#APP-PGBASEBACKUP/div[4]/p[6]", "#APP-PGBASEBACKUP/div[4]/p[8]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/div[2]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/div[2]/dl[0]/dd[3]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/div[2]/dl[0]/dd[5]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/div[2]/dl[0]/dd[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/div[2]/dl[0]/dd[5]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[3]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[5]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[7]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[7]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[7]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[17]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[19]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[19]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[19]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[19]/p[3]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[21]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[23]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[23]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[25]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[27]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[27]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[27]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[29]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[29]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[7]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[7]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[7]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[8]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[8]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/p[3]", "#APP-PGBASEBACKUP/div[5]/p[5]", "#APP-PGBASEBACKUP/div[5]/p[7]", "#APP-PGBASEBACKUP/div[6]/h2[0]", "#APP-PGBASEBACKUP/div[6]/p[1]", "#APP-PGBASEBACKUP/div[6]/p[2]", "#APP-PGBASEBACKUP/div[7]/h2[0]", "#APP-PGBASEBACKUP/div[7]/p[1]", "#APP-PGBASEBACKUP/div[7]/p[2]", "#APP-PGBASEBACKUP/div[7]/p[3]", "#APP-PGBASEBACKUP/div[7]/p[6]", "#APP-PGBASEBACKUP/div[8]/h2[0]", "#APP-PGBASEBACKUP/div[8]/p[1]", "#APP-PGBASEBACKUP/div[8]/p[3]", "#APP-PGBASEBACKUP/div[8]/p[5]", "#APP-PGBASEBACKUP/div[8]/p[7]", "#APP-PGBASEBACKUP/div[8]/p[8]", "#APP-PGBASEBACKUP/div[9]/h2[0]"]}], "language": "zh", "original_text": {"/versions/13/description/0": "pg_basebackup \u2014 take a base backup of a PostgreSQL cluster", "/versions/13/facts/0/label": "Documented executable", "/versions/13/facts/1/label": "Executable version", "/versions/13/facts/2/label": "Reference inventory", "/versions/13/facts/2/value": "Client applications", "/versions/13/facts/3/label": "Option definition groups", "/versions/13/tables/0/title": "Documented options", "/versions/13/related/0/label": "libpq connection parameters", "/versions/13/tables/0/rows/0/summary": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty.", "/versions/13/tables/0/rows/1/summary": "Selects the format for the output. format can be one of the following:", "/versions/13/tables/0/rows/2/summary": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup.", "/versions/13/tables/0/rows/3/summary": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces.", "/versions/13/tables/0/rows/4/summary": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format.", "/versions/13/tables/0/rows/5/summary": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the log archive, thus making the output a completely standalone backup.", "/versions/13/tables/0/rows/6/summary": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "/versions/13/tables/0/rows/7/summary": "Enables gzip compression of tar file output, and specifies the compression level (0 through 9, 0 being no compression and 9 being best compression). Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "/versions/13/tables/0/rows/8/summary": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 25.3.3 ).", "/versions/13/tables/0/rows/9/summary": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists.", "/versions/13/tables/0/columns/0/label": "Option and arguments", "/versions/13/tables/0/columns/1/label": "Description", "/versions/13/tables/0/rows/10/summary": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used.", "/versions/13/tables/0/rows/11/summary": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging.", "/versions/13/tables/0/rows/12/summary": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.", "/versions/13/tables/0/rows/13/summary": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.", "/versions/13/tables/0/rows/14/summary": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second.", "/versions/13/tables/0/rows/15/summary": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby.", "/versions/13/tables/0/rows/16/summary": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.", "/versions/13/tables/0/rows/17/summary": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C .", "/versions/13/tables/0/rows/18/summary": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case.", "/versions/13/tables/0/rows/19/summary": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL .", "/versions/13/tables/0/rows/20/summary": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file.", "/versions/13/tables/0/rows/21/summary": "Prevents the creation of a temporary replication slot for the backup.", "/versions/13/tables/0/rows/22/summary": "Disables verification of checksums, if they are enabled on the server the base backup is taken from.", "/versions/13/tables/0/rows/23/summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "/versions/13/tables/0/rows/24/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "/versions/13/tables/0/rows/25/summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "/versions/13/tables/0/rows/26/summary": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds.", "/versions/13/tables/0/rows/27/summary": "Specifies the user name to connect as.", "/versions/13/tables/0/rows/28/summary": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/13/tables/0/rows/29/summary": "Forces pg_basebackup to prompt for a password before connecting to the source server.", "/versions/13/tables/0/rows/30/summary": "Prints the pg_basebackup version and exits.", "/versions/13/tables/0/rows/31/summary": "Shows help about pg_basebackup command line arguments, and exits."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "0feb30a0088072b4b28a1c1a77717bd830066b5de16ae97ab7505e2d2f8e49e8"}, "comparison_data": {"options": [{"names": ["-D directory", "--pgdata= directory"], "signature": "-D directory --pgdata= directory", "description": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty. When the backup is in tar format, the target directory may be specified as - (dash), causing the tar file to be written to stdout . This option is required."}, {"names": ["-F format", "--format= format"], "signature": "-F format --format= format", "description": "Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the source server's data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory's contents will be written to a file named base.tar , and each other tablespace will be written to a separate tar file named after that tablespace's OID. If the target directory is specified as - (dash), the tar contents will be written to standard output, suitable for piping to (for example) gzip . This is only allowed if the cluster has no additional tablespaces and WAL streaming is not used."}, {"names": ["-R", "--write-recovery-conf"], "signature": "-R --write-recovery-conf", "description": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup. The postgresql.auto.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that streaming replication will use the same settings later on."}, {"names": ["-T olddir = newdir", "--tablespace-mapping= olddir = newdir"], "signature": "-T olddir = newdir --tablespace-mapping= olddir = newdir", "description": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected."}, {"names": ["--waldir= waldir"], "signature": "--waldir= waldir", "description": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format."}, {"names": ["-X method", "--wal-method= method"], "signature": "-X method --wal-method= method", "description": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the log archive, thus making the output a completely standalone backup. The following method s for collecting the write-ahead logs are supported: n none Don't include write-ahead logs in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the source server's wal_keep_size parameter to be set high enough that the required log data is not removed before the end of the backup. If the required log data has been recycled before it's time to transfer it, the backup will fail and be unusable. When tar format is used, the write-ahead log files will be included in the base.tar file. s stream Stream write-ahead log data while the backup is being taken. This method will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will require two replication connections not just one. As long as the client can keep up with the write-ahead log data, using this method requires no extra write-ahead logs to be saved on the source server. When tar format is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default."}, {"names": ["-z", "--gzip"], "signature": "-z --gzip", "description": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-Z level", "--compress= level"], "signature": "-Z level --compress= level", "description": "Enables gzip compression of tar file output, and specifies the compression level (0 through 9, 0 being no compression and 9 being best compression). Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-c fast|spread", "--checkpoint= fast|spread"], "signature": "-c fast|spread --checkpoint= fast|spread", "description": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 25.3.3 )."}, {"names": ["-C", "--create-slot"], "signature": "-C --create-slot", "description": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists."}, {"names": ["-l label", "--label= label"], "signature": "-l label --label= label", "description": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used."}, {"names": ["-n", "--no-clean"], "signature": "-n --no-clean", "description": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way."}, {"names": ["-N", "--no-sync"], "signature": "-N --no-sync", "description": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."}, {"names": ["-P", "--progress"], "signature": "-P --progress", "description": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL."}, {"names": ["-r rate", "--max-rate= rate"], "signature": "-r rate --max-rate= rate", "description": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch ."}, {"names": ["-S slotname", "--slot= slotname"], "signature": "-S slotname --slot= slotname", "description": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby. The specified replication slot has to exist unless the option -C is also used. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."}, {"names": ["--manifest-checksums= algorithm"], "signature": "--manifest-checksums= algorithm", "description": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C . If NONE is selected, the backup manifest will not contain any checksums. Otherwise, it will contain a checksum of each file in the backup using the specified algorithm. In addition, the manifest will always contain a SHA256 checksum of its own contents. The SHA algorithms are significantly more CPU-intensive than CRC32C , so selecting one of them may increase the time required to complete the backup. Using a SHA hash function provides a cryptographically secure digest of each file for users who wish to verify that the backup has not been tampered with, while the CRC32C algorithm provides a checksum that is much faster to calculate; it is good at catching errors due to accidental changes but is not resistant to malicious modifications. Note that, to be useful against an adversary who has access to the backup, the backup manifest would need to be stored securely elsewhere or otherwise verified not to have been modified since the backup was taken. pg_verifybackup can be used to check the integrity of a backup against the backup manifest."}, {"names": ["--manifest-force-encode"], "signature": "--manifest-force-encode", "description": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case."}, {"names": ["--no-estimate-size"], "signature": "--no-estimate-size", "description": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL . Without this option, the backup will start by enumerating the size of the entire database, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent. This option is useful to avoid such estimation time if it's too long. This option is not allowed when using --progress ."}, {"names": ["--no-manifest"], "signature": "--no-manifest", "description": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file."}, {"names": ["--no-slot"], "signature": "--no-slot", "description": "Prevents the creation of a temporary replication slot for the backup. By default, if log streaming is selected but no slot name is given with the -S option, then a temporary replication slot is created (if supported by the source server). The main purpose of this option is to allow taking a base backup when the server has no free replication slots. Using a replication slot is almost always preferred, because it prevents needed WAL from being removed by the server during the backup."}, {"names": ["--no-verify-checksums"], "signature": "--no-verify-checksums", "description": "Disables verification of checksums, if they are enabled on the server the base backup is taken from. By default, checksums are verified and checksum failures will result in a non-zero exit status. However, the base backup will not be removed in such a case, as if the --no-clean option had been used. Checksum verification failures will also be reported in the pg_stat_database view."}, {"names": ["-d connstr", "--dbname= connstr"], "signature": "-d connstr --dbname= connstr", "description": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. The option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, any database name in the connection string will be ignored."}, {"names": ["-h host", "--host= host"], "signature": "-h host --host= host", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-s interval", "--status-interval= interval"], "signature": "-s interval --status-interval= interval", "description": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Specifies the user name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Forces pg_basebackup to prompt for a password before connecting to the source server. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Prints the pg_basebackup version and exits."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Shows help about pg_basebackup command line arguments, and exits."}], "synopsis": ["pg_basebackup [ option ...]"], "environment": []}, "comparison_hash": "c154724f0b16d9ef0a0d4d9c9ee8c4f296e591c1cc19a77b9a5e0a93ad3a3adb", "manual_language": "zh"}, "14": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_basebackup"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "14.24"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "32"}], "tables": [{"key": "options", "rows": [{"summary": "\u8bbe\u7f6e\u5199\u5165\u8f93\u51fa\u7684\u76ee\u6807\u76ee\u5f55\u3002\u5982\u679c\u8be5\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c pg_basebackup \u4f1a\u521b\u5efa\u5b83\uff08\u4ee5\u53ca\u6240\u6709\u7f3a\u5931\u7684\u7236\u76ee\u5f55\uff09\u3002\u5982\u679c\u8be5\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "-D directory --pgdata= directory"}}, {"summary": "\u9009\u62e9\u8f93\u51fa\u683c\u5f0f\u3002 format \u53ef\u4ee5\u662f\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "-F format --format= format"}}, {"summary": "\u521b\u5efa standby.signal \u6587\u4ef6\uff0c\u5e76\u5c06\u8fde\u63a5\u8bbe\u7f6e\u8ffd\u52a0\u5230\u76ee\u6807\u76ee\u5f55\u4e2d\u7684 postgresql.auto.conf \u6587\u4ef6\u4e2d\uff08\u5982\u679c\u4f7f\u7528 tar \u683c\u5f0f\uff0c\u5219\u8ffd\u52a0\u5230\u57fa\u7840\u5f52\u6863\u6587\u4ef6\u5185\uff09\u3002\u8fd9\u6837\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u5229\u7528\u5907\u4efd\u7ed3\u679c\u642d\u5efa\u5907\u5e93\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "-R --write-recovery-conf"}}, {"summary": "\u5728\u5907\u4efd\u671f\u95f4\uff0c\u5c06\u76ee\u5f55 olddir \u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230 newdir \u3002\u8981\u4f7f\u6b64\u9009\u9879\u751f\u6548\uff0c olddir \u5fc5\u987b\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u5b9a\u4e49\u7684\u8be5\u8868\u7a7a\u95f4\u8def\u5f84\u5b8c\u5168\u4e00\u81f4\u3002\uff08\u4f46\u5982\u679c\u6e90\u670d\u52a1\u5668\u4e0a\u5728 olddir \u4e2d\u6ca1\u6709\u8868\u7a7a\u95f4\uff0c\u4e5f\u4e0d\u7b97\u9519\u8bef\u3002\uff09\u4e0e\u6b64\u540c\u65f6\uff0c newdir \u662f\u63a5\u6536\u4e3b\u673a\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u4e00\u4e2a\u76ee\u5f55\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c newdir \u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002 olddir \u548c newdir \u90fd\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u5982\u679c\u4efb\u4e00\u8def\u5f84\u4e2d\u9700\u8981\u5305\u542b\u7b49\u53f7\uff08 = \uff09\uff0c\u8bf7\u5728\u5176\u524d\u9762\u52a0\u4e0a\u53cd\u659c\u6760\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u4ee5\u5904\u7406\u591a\u4e2a\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "-T olddir = newdir --tablespace-mapping= olddir = newdir"}}, {"summary": "\u8bbe\u7f6e\u5199\u5165 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cWAL \u6587\u4ef6\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u7684 pg_wal \u5b50\u76ee\u5f55\u4e2d\uff0c\u4f46\u6b64\u9009\u9879\u53ef\u7528\u4e8e\u5c06\u5176\u653e\u5728\u5176\u4ed6\u4f4d\u7f6e\u3002 waldir \u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c waldir \u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002\u53ea\u6709\u5f53\u5907\u4efd\u91c7\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u624d\u80fd\u6307\u5b9a\u6b64\u9009\u9879\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "--waldir= waldir"}}, {"summary": "\u5728\u5907\u4efd\u4e2d\u5305\u542b\u6240\u9700\u7684 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u3002\u8fd9\u5c06\u5305\u62ec\u5907\u4efd\u671f\u95f4\u751f\u6210\u7684\u6240\u6709\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u9664\u975e\u6307\u5b9a\u65b9\u6cd5 none \uff0c\u5426\u5219\u5c31\u53ef\u4ee5\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u542f\u52a8 postmaster\uff0c\u800c\u65e0\u9700\u67e5\u9605 WAL \u5f52\u6863\uff0c\u4ece\u800c\u4f7f\u8f93\u51fa\u6210\u4e3a\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u5907\u4efd\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "-X method --wal-method= method"}}, {"summary": "\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u4f7f\u7528\u9ed8\u8ba4\u538b\u7f29\u7ea7\u522b\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0 .gz \u540e\u7f00\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "-z --gzip"}}, {"summary": "\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u5e76\u6307\u5b9a\u538b\u7f29\u7ea7\u522b\uff080 \u5230 9\uff0c\u5176\u4e2d 0 \u8868\u793a\u4e0d\u538b\u7f29\uff0c9 \u8868\u793a\u6700\u4f73\u538b\u7f29\uff09\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0 .gz \u540e\u7f00\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "-Z level --compress= level"}}, {"summary": "\u5c06\u68c0\u67e5\u70b9\u6a21\u5f0f\u8bbe\u7f6e\u4e3a fast\uff08\u7acb\u5373\uff09\u6216 spread\uff08\u9ed8\u8ba4\uff09\uff08\u89c1 \u7b2c 26.3.3 \u8282 \uff09\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "-c fast|spread --checkpoint= fast|spread"}}, {"summary": "\u6307\u5b9a\u5728\u5f00\u59cb\u5907\u4efd\u4e4b\u524d\uff0c\u5e94\u521b\u5efa\u7531 --slot \u9009\u9879\u6307\u5b9a\u540d\u79f0\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u8be5\u69fd\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u9519\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "-C --create-slot"}}, {"summary": "\u8bbe\u7f6e\u5907\u4efd\u6807\u7b7e\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u503c \u201c pg_basebackup base backup \u201d \u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "-l label --label= label"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53 pg_basebackup \u56e0\u9519\u8bef\u4e2d\u6b62\u65f6\uff0c\u5b83\u4f1a\u5220\u9664\u5728\u53d1\u73b0\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u76ee\u5f55\uff08\u4f8b\u5982\u76ee\u6807\u76ee\u5f55\u548c\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\uff09\u3002\u6b64\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u5f88\u6709\u5e2e\u52a9\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "-n --no-clean"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_basebackup \u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u88ab\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f1a\u4f7f pg_basebackup \u4e0d\u7ecf\u7b49\u5f85\u5c31\u76f4\u63a5\u8fd4\u56de\uff0c\u56e0\u6b64\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u968f\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u57fa\u7840\u5907\u4efd\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u5408\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "-N --no-sync"}}, {"summary": "\u542f\u7528\u8fdb\u5ea6\u62a5\u544a\u3002\u6253\u5f00\u6b64\u9009\u9879\u540e\uff0c\u4f1a\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u7ed9\u51fa\u4e00\u4e2a\u8fd1\u4f3c\u7684\u8fdb\u5ea6\u62a5\u544a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u53d1\u751f\u53d8\u5316\uff0c\u56e0\u6b64\u8fd9\u53ea\u662f\u8fd1\u4f3c\u503c\uff0c\u6700\u7ec8\u672a\u5fc5\u6070\u597d\u7ed3\u675f\u5728 100% \u3002\u7279\u522b\u662f\u5f53\u5907\u4efd\u4e2d\u5305\u542b WAL \u65f6\uff0c\u603b\u6570\u636e\u91cf\u65e0\u6cd5\u9884\u5148\u4f30\u8ba1\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u65e6\u8fdb\u5ea6\u8d85\u8fc7\u4e0d\u542b WAL \u65f6\u7684\u603b\u4f30\u8ba1\u503c\uff0c\u4f30\u8ba1\u76ee\u6807\u5927\u5c0f\u5c31\u4f1a\u7ee7\u7eed\u589e\u52a0\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "-P --progress"}}, {"summary": "\u8bbe\u7f6e\u4ece\u6e90\u670d\u52a1\u5668\u6536\u96c6\u6570\u636e\u65f6\u5141\u8bb8\u7684\u6700\u5927\u4f20\u8f93\u901f\u7387\u3002\u8fd9\u6709\u52a9\u4e8e\u9650\u5236 pg_basebackup \u5bf9\u670d\u52a1\u5668\u7684\u5f71\u54cd\u3002\u53d6\u503c\u5355\u4f4d\u4e3a\u6bcf\u79d2\u5343\u5b57\u8282\u3002\u4f7f\u7528\u540e\u7f00 M \u8868\u793a\u6bcf\u79d2\u5146\u5b57\u8282\u3002\u4e5f\u63a5\u53d7\u540e\u7f00 k \uff0c\u4f46\u6ca1\u6709\u5b9e\u9645\u5f71\u54cd\u3002\u6709\u6548\u53d6\u503c\u8303\u56f4\u4e3a\u6bcf\u79d2 32 \u5343\u5b57\u8282\u5230\u6bcf\u79d2 1024 \u5146\u5b57\u8282\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "-r rate --max-rate= rate"}}, {"summary": "\u6b64\u9009\u9879\u53ea\u80fd\u4e0e -X stream \u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u4f1a\u4f7f WAL \u6d41\u5f0f\u4f20\u8f93\u4f7f\u7528\u6307\u5b9a\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u6b64\u57fa\u7840\u5907\u4efd\u6253\u7b97\u7528\u4f5c\u4f7f\u7528\u590d\u5236\u69fd\u7684\u6d41\u590d\u5236\u5907\u5e93\uff0c\u90a3\u4e48\u8be5\u5907\u5e93\u5e94\u5c06\u540c\u4e00\u4e2a\u590d\u5236\u69fd\u540d\u79f0\u7528\u4f5c primary_slot_name \u7684\u503c\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u4e3b\u5e93\u5728\u57fa\u7840\u5907\u4efd\u7ed3\u675f\u4e0e\u65b0\u5907\u5e93\u5f00\u59cb\u6d41\u590d\u5236\u4e4b\u95f4\u7684\u8fd9\u6bb5\u65f6\u95f4\u5185\uff0c\u4e0d\u4f1a\u79fb\u9664\u4efb\u4f55\u5fc5\u9700\u7684 WAL \u6570\u636e\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "-S slotname --slot= slotname"}}, {"summary": "\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\u3002\u5b83\u4f1a\u5728\u542f\u52a8\u548c\u5173\u95ed\u8fc7\u7a0b\u4e2d\u8f93\u51fa\u4e00\u4e9b\u989d\u5916\u6b65\u9aa4\uff1b\u5982\u679c\u540c\u65f6\u542f\u7528\u4e86\u8fdb\u5ea6\u62a5\u544a\uff0c\u8fd8\u4f1a\u663e\u793a\u5f53\u524d\u6b63\u5728\u5904\u7406\u7684\u786e\u5207\u6587\u4ef6\u540d\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "-v --verbose"}}, {"summary": "\u6307\u5b9a\u5e94\u7528\u5230\u5907\u4efd\u6e05\u5355\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u7684\u6821\u9a8c\u548c\u7b97\u6cd5\u3002\u76ee\u524d\u53ef\u7528\u7684\u7b97\u6cd5\u6709 NONE \u3001 CRC32C \u3001 SHA224 \u3001 SHA256 \u3001 SHA384 \u548c SHA512 \u3002\u9ed8\u8ba4\u503c\u4e3a CRC32C \u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "--manifest-checksums= algorithm"}}, {"summary": "\u5f3a\u5236\u5c06\u5907\u4efd\u6e05\u5355\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u540d\u7f16\u7801\u4e3a\u5341\u516d\u8fdb\u5236\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u5bf9\u975e UTF8 \u6587\u4ef6\u540d\u8fdb\u884c\u5341\u516d\u8fdb\u5236\u7f16\u7801\u3002\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u8bfb\u53d6\u5907\u4efd\u6e05\u5355\u6587\u4ef6\u7684\u5de5\u5177\u662f\u5426\u80fd\u6b63\u786e\u5904\u7406\u8fd9\u79cd\u60c5\u51b5\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "--manifest-force-encode"}}, {"summary": "\u7981\u6b62\u670d\u52a1\u5668\u4f30\u7b97\u5c06\u8981\u6d41\u5f0f\u4f20\u8f93\u7684\u5907\u4efd\u6570\u636e\u603b\u91cf\uff0c\u56e0\u6b64 pg_stat_progress_basebackup \u89c6\u56fe\u4e2d\u7684 backup_total \u5217\u59cb\u7ec8\u4e3a NULL\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "--no-estimate-size"}}, {"summary": "\u7981\u6b62\u751f\u6210\u5907\u4efd\u6e05\u5355\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u670d\u52a1\u5668\u5c06\u751f\u6210\u5e76\u53d1\u9001\u4e00\u4e2a\u5907\u4efd\u6e05\u5355\uff0c\u53ef\u4f7f\u7528 pg_verifybackup \u8fdb\u884c\u9a8c\u8bc1\u3002\u8be5\u6e05\u5355\u5217\u51fa\u4e86\u5907\u4efd\u4e2d\u7684\u6bcf\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u4e0d\u5305\u62ec\u53ef\u80fd\u5305\u542b\u5728\u5176\u4e2d\u7684\u4efb\u4f55 WAL \u6587\u4ef6\u3002\u5b83\u8fd8\u4f1a\u4fdd\u5b58\u6bcf\u4e2a\u6587\u4ef6\u7684\u5927\u5c0f\u3001\u6700\u540e\u4fee\u6539\u65f6\u95f4\u4ee5\u53ca\u53ef\u9009\u7684\u6821\u9a8c\u548c\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "--no-manifest"}}, {"summary": "\u9632\u6b62\u4e3a\u5907\u4efd\u521b\u5efa\u4e34\u65f6\u590d\u5236\u69fd\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "--no-slot"}}, {"summary": "\u5982\u679c\u83b7\u53d6\u57fa\u7840\u5907\u4efd\u7684\u670d\u52a1\u5668\u542f\u7528\u4e86\u6821\u9a8c\u548c\uff0c\u5219\u7981\u7528\u5bf9\u8fd9\u4e9b\u6821\u9a8c\u548c\u7684\u9a8c\u8bc1\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "--no-verify-checksums"}}, {"summary": "\u4ee5 \u8fde\u63a5\u5b57\u7b26\u4e32 \u7684\u5f62\u5f0f\u6307\u5b9a\u7528\u4e8e\u8fde\u63a5\u670d\u52a1\u5668\u7684\u53c2\u6570\uff1b\u8fd9\u4e9b\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u76f8\u4e92\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "-d connstr --dbname= connstr"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGHOST \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff1b\u5426\u5219\u4f1a\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "-h host --host= host"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u6240\u4f7f\u7528\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u4e2d\u7684\u503c\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u786e\u5b9a\u7684\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "-p port --port= port"}}, {"summary": "\u6307\u5b9a\u53d1\u9001\u56de\u6e90\u670d\u52a1\u5668\u7684\u72b6\u6001\u5305\u4e4b\u95f4\u76f8\u9694\u7684\u79d2\u6570\u3002\u8f83\u5c0f\u7684\u503c\u53ef\u4ee5\u8ba9\u670d\u52a1\u5668\u7aef\u5bf9\u5907\u4efd\u8fdb\u5ea6\u7684\u76d1\u63a7\u66f4\u7cbe\u786e\u3002\u503c\u4e3a\u96f6\u65f6\u4f1a\u5b8c\u5168\u7981\u7528\u5468\u671f\u6027\u72b6\u6001\u66f4\u65b0\uff0c\u4e0d\u8fc7\u5f53\u670d\u52a1\u5668\u8bf7\u6c42\u65f6\u4ecd\u4f1a\u53d1\u9001\u66f4\u65b0\uff0c\u4ee5\u907f\u514d\u56e0\u8d85\u65f6\u800c\u65ad\u5f00\u8fde\u63a5\u3002\u9ed8\u8ba4\u503c\u662f 10 \u79d2\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "-s interval --status-interval= interval"}}, {"summary": "\u6307\u5b9a\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "-U username --username= username"}}, {"summary": "\u7981\u6b62\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\uff08\u4f8b\u5982 .pgpass \u6587\u4ef6\uff09\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u6b64\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u79cd\u573a\u666f\u4e0b\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 pg_basebackup \u5728\u8fde\u63a5\u6e90\u670d\u52a1\u5668\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "-W --password"}}, {"summary": "\u8f93\u51fa pg_basebackup \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "-V --version"}}, {"summary": "\u663e\u793a pg_basebackup \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/14/app-pgbasebackup.html", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}], "options": [{"names": ["-D directory", "--pgdata= directory"], "summary": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty.", "signature": "-D directory --pgdata= directory", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty. When the backup is in tar format, the target directory may be specified as - (dash), causing the tar file to be written to stdout . This option is required."}, {"names": ["-F format", "--format= format"], "summary": "Selects the format for the output. format can be one of the following:", "signature": "-F format --format= format", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the source server's data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory's contents will be written to a file named base.tar , and each other tablespace will be written to a separate tar file named after that tablespace's OID. If the target directory is specified as - (dash), the tar contents will be written to standard output, suitable for piping to (for example) gzip . This is only allowed if the cluster has no additional tablespaces and WAL streaming is not used."}, {"names": ["-R", "--write-recovery-conf"], "summary": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup.", "signature": "-R --write-recovery-conf", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup. The postgresql.auto.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that streaming replication will use the same settings later on."}, {"names": ["-T olddir = newdir", "--tablespace-mapping= olddir = newdir"], "summary": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces.", "signature": "-T olddir = newdir --tablespace-mapping= olddir = newdir", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected."}, {"names": ["--waldir= waldir"], "summary": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format.", "signature": "--waldir= waldir", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format."}, {"names": ["-X method", "--wal-method= method"], "summary": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the log archive, thus making the output a completely standalone backup.", "signature": "-X method --wal-method= method", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the log archive, thus making the output a completely standalone backup. The following method s for collecting the write-ahead logs are supported: n none Don't include write-ahead logs in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the source server's wal_keep_size parameter to be set high enough that the required log data is not removed before the end of the backup. If the required log data has been recycled before it's time to transfer it, the backup will fail and be unusable. When tar format is used, the write-ahead log files will be included in the base.tar file. s stream Stream write-ahead log data while the backup is being taken. This method will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will require two replication connections not just one. As long as the client can keep up with the write-ahead log data, using this method requires no extra write-ahead logs to be saved on the source server. When tar format is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default."}, {"names": ["-z", "--gzip"], "summary": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "signature": "-z --gzip", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-Z level", "--compress= level"], "summary": "Enables gzip compression of tar file output, and specifies the compression level (0 through 9, 0 being no compression and 9 being best compression). Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "signature": "-Z level --compress= level", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Enables gzip compression of tar file output, and specifies the compression level (0 through 9, 0 being no compression and 9 being best compression). Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-c fast|spread", "--checkpoint= fast|spread"], "summary": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 26.3.3 ).", "signature": "-c fast|spread --checkpoint= fast|spread", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 26.3.3 )."}, {"names": ["-C", "--create-slot"], "summary": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists.", "signature": "-C --create-slot", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists."}, {"names": ["-l label", "--label= label"], "summary": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used.", "signature": "-l label --label= label", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used."}, {"names": ["-n", "--no-clean"], "summary": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging.", "signature": "-n --no-clean", "source_url": "/docs/14/app-pgbasebackup.html", "description": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way."}, {"names": ["-N", "--no-sync"], "summary": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.", "signature": "-N --no-sync", "source_url": "/docs/14/app-pgbasebackup.html", "description": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."}, {"names": ["-P", "--progress"], "summary": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.", "signature": "-P --progress", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL."}, {"names": ["-r rate", "--max-rate= rate"], "summary": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second.", "signature": "-r rate --max-rate= rate", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch ."}, {"names": ["-S slotname", "--slot= slotname"], "summary": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby.", "signature": "-S slotname --slot= slotname", "source_url": "/docs/14/app-pgbasebackup.html", "description": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby. The specified replication slot has to exist unless the option -C is also used. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming."}, {"names": ["-v", "--verbose"], "summary": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.", "signature": "-v --verbose", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."}, {"names": ["--manifest-checksums= algorithm"], "summary": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C .", "signature": "--manifest-checksums= algorithm", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C . If NONE is selected, the backup manifest will not contain any checksums. Otherwise, it will contain a checksum of each file in the backup using the specified algorithm. In addition, the manifest will always contain a SHA256 checksum of its own contents. The SHA algorithms are significantly more CPU-intensive than CRC32C , so selecting one of them may increase the time required to complete the backup. Using a SHA hash function provides a cryptographically secure digest of each file for users who wish to verify that the backup has not been tampered with, while the CRC32C algorithm provides a checksum that is much faster to calculate; it is good at catching errors due to accidental changes but is not resistant to malicious modifications. Note that, to be useful against an adversary who has access to the backup, the backup manifest would need to be stored securely elsewhere or otherwise verified not to have been modified since the backup was taken. pg_verifybackup can be used to check the integrity of a backup against the backup manifest."}, {"names": ["--manifest-force-encode"], "summary": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case.", "signature": "--manifest-force-encode", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case."}, {"names": ["--no-estimate-size"], "summary": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL .", "signature": "--no-estimate-size", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL . Without this option, the backup will start by enumerating the size of the entire database, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent. This option is useful to avoid such estimation time if it's too long. This option is not allowed when using --progress ."}, {"names": ["--no-manifest"], "summary": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file.", "signature": "--no-manifest", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file."}, {"names": ["--no-slot"], "summary": "Prevents the creation of a temporary replication slot for the backup.", "signature": "--no-slot", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Prevents the creation of a temporary replication slot for the backup. By default, if log streaming is selected but no slot name is given with the -S option, then a temporary replication slot is created (if supported by the source server). The main purpose of this option is to allow taking a base backup when the server has no free replication slots. Using a replication slot is almost always preferred, because it prevents needed WAL from being removed by the server during the backup."}, {"names": ["--no-verify-checksums"], "summary": "Disables verification of checksums, if they are enabled on the server the base backup is taken from.", "signature": "--no-verify-checksums", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Disables verification of checksums, if they are enabled on the server the base backup is taken from. By default, checksums are verified and checksum failures will result in a non-zero exit status. However, the base backup will not be removed in such a case, as if the --no-clean option had been used. Checksum verification failures will also be reported in the pg_stat_database view."}, {"names": ["-d connstr", "--dbname= connstr"], "summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": "-d connstr --dbname= connstr", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. The option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, any database name in the connection string will be ignored."}, {"names": ["-h host", "--host= host"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "signature": "-h host --host= host", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "signature": "-p port --port= port", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-s interval", "--status-interval= interval"], "summary": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds.", "signature": "-s interval --status-interval= interval", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds."}, {"names": ["-U username", "--username= username"], "summary": "Specifies the user name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Specifies the user name to connect as."}, {"names": ["-w", "--no-password"], "summary": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "summary": "Forces pg_basebackup to prompt for a password before connecting to the source server.", "signature": "-W --password", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Forces pg_basebackup to prompt for a password before connecting to the source server. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["-V", "--version"], "summary": "Prints the pg_basebackup version and exits.", "signature": "-V --version", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Prints the pg_basebackup version and exits."}, {"names": ["-?", "--help"], "summary": "Shows help about pg_basebackup command line arguments, and exits.", "signature": "-? --help", "source_url": "/docs/14/app-pgbasebackup.html", "description": "Shows help about pg_basebackup command line arguments, and exits."}], "related": [{"url": "/wiki/conn/?v=14", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v14.24/postgresql-14.24.tar.bz2", "label": "14.24", "major": "14", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/14/postgresql-14-A4.pdf", "bytes": 14354704, "pages": 2944, "sha256": "8bc6b9dd7b246888bb77f0a5e8c39a2eae52e9926569832669c7d1600becb27c", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/14/postgresql-14-US.pdf", "bytes": 14242178, "pages": 3102, "sha256": "b7ecb5a5f62d8b9f73a69e25a7d26ba285373bc53168a553bff7b77955506db4", "built_at": "2026-09-26"}}, "tree": "14", "index": "index.html", "major": "14", "pages": 1158, "release": "14.24", "source_url": "https://ftp.postgresql.org/pub/source/v14.24/postgresql-14.24.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "a7fa7ed3d558172355f51406097a7bd4f6b473be80f311ef7cda96bf383d8897"}, "revision": "588700d46356d8837c77c7c0a4e71e645fe6535983b8f1830aa8f2e4e41c40ae", "evidence_kind": "English manual and source declarations", "source_sha256": "a7fa7ed3d558172355f51406097a7bd4f6b473be80f311ef7cda96bf383d8897"}, "sources": [{"url": "https://pg.center/docs/14/app-pgbasebackup.html", "file": "app-pgbasebackup.html", "label": "14.24 English manual \u00b7 app-pgbasebackup.html", "anchor": "", "sha256": "4951b5a64ee637d73e383c5c5c0f4135363311b71bbf1022f3b741b1d2798c1c", "language": "en", "original_url": "/docs/14/app-pgbasebackup.html"}, {"url": "https://pg.center/docs/14/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "5a13567a052954dfe494dfaab9f50919faa1ae56023930fdbb78d45e53feccde", "language": "en", "original_url": "/docs/14/reference-client.html"}], "sections": [], "synopsis": ["pg_basebackup [ option ...]"], "signature": "pg_basebackup [ option ...]", "description": ["pg_basebackup \u2014 \u83b7\u53d6 PostgreSQL \u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd"], "environment": [], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGBASEBACKUP\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_basebackup</span></span></h2>\n<p lang=\"zh\">pg_basebackup \u2014 \u83b7\u53d6<span class=\"productname\">PostgreSQL</span>\u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.10.4.1\"><code class=\"command\">pg_basebackup</code> [<em class=\"replaceable\"><code>option</code></em>...]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u7528\u4e8e\u83b7\u53d6\u6b63\u5728\u8fd0\u884c\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd\u3002\u5907\u4efd\u8fc7\u7a0b\u4e0d\u4f1a\u5f71\u54cd\u6570\u636e\u5e93\u7684\u5176\u4ed6\u5ba2\u6237\u7aef\uff0c\u5e76\u4e14\u8be5\u5907\u4efd\u65e2\u53ef\u7528\u4e8e\u65f6\u95f4\u70b9\u6062\u590d\uff08\u89c1<a class=\"xref\" href=\"/docs/14/continuous-archiving.html\" title=\"26.3.\u00a0\u6301\u7eed\u5f52\u6863\u548c\u65f6\u95f4\u70b9\u6062\u590d\uff08PITR\uff09\">\u7b2c\u00a026.3\u00a0\u8282</a>\uff09\uff0c\u4e5f\u53ef\u7528\u4f5c\u65e5\u5fd7\u4f20\u9001\u6216\u6d41\u590d\u5236\u5907\u5e93\u7684\u8d77\u70b9\uff08\u89c1<a class=\"xref\" href=\"/docs/14/warm-standby.html\" title=\"27.2.\u00a0\u65e5\u5fd7\u4f20\u9001\u5907\u5e93\">\u7b2c\u00a027.2\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u4f1a\u7cbe\u786e\u590d\u5236\u6570\u636e\u5e93\u96c6\u7c07\u7684\u6587\u4ef6\uff0c\u540c\u65f6\u786e\u4fdd\u670d\u52a1\u5668\u81ea\u52a8\u8fdb\u5165\u548c\u9000\u51fa\u5907\u4efd\u6a21\u5f0f\u3002\u5907\u4efd\u59cb\u7ec8\u9488\u5bf9\u6574\u4e2a\u6570\u636e\u5e93\u96c6\u7c07\uff1b\u4e0d\u53ef\u80fd\u53ea\u5907\u4efd\u5355\u4e2a\u6570\u636e\u5e93\u6216\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u5bf9\u4e8e\u9009\u62e9\u6027\u5907\u4efd\uff0c\u5fc5\u987b\u4f7f\u7528\u8bf8\u5982<a class=\"xref\" href=\"/docs/14/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>\u4e4b\u7c7b\u7684\u5176\u4ed6\u5de5\u5177\u3002</p>\n<p lang=\"zh\">\u5907\u4efd\u662f\u901a\u8fc7\u4e00\u4e2a\u4f7f\u7528\u590d\u5236\u534f\u8bae\u7684\u5e38\u89c4<span class=\"productname\">PostgreSQL</span>\u8fde\u63a5\u8fdb\u884c\u7684\u3002\u5efa\u7acb\u8be5\u8fde\u63a5\u6240\u4f7f\u7528\u7684\u7528\u6237 ID \u5fc5\u987b\u5177\u6709<code class=\"literal\">REPLICATION</code>\u6743\u9650\uff08\u89c1<a class=\"xref\" href=\"/docs/14/role-attributes.html\" title=\"22.2.\u00a0\u89d2\u8272\u5c5e\u6027\">\u7b2c\u00a022.2\u00a0\u8282</a>\uff09\uff0c\u6216\u8005\u662f\u8d85\u7ea7\u7528\u6237\uff0c\u5e76\u4e14<a class=\"link\" href=\"/docs/14/client-authentication.html#AUTH-PG-HBA-CONF\" title=\"21.1.\u00a0pg_hba.conf \u6587\u4ef6\"><code class=\"filename\">pg_hba.conf</code></a>\u5fc5\u987b\u5141\u8bb8\u8be5\u590d\u5236\u8fde\u63a5\u3002\u670d\u52a1\u5668\u8fd8\u5fc5\u987b\u5c06<a class=\"xref\" href=\"/docs/14/runtime-config-replication.html#GUC-MAX-WAL-SENDERS\">max_wal_senders</a>\u8bbe\u7f6e\u5f97\u8db3\u591f\u9ad8\uff0c\u4ee5\u4fbf\u81f3\u5c11\u63d0\u4f9b\u4e00\u4e2a\u7528\u4e8e\u5907\u4efd\u7684 WAL \u53d1\u9001\u8fdb\u7a0b\uff0c\u5e76\u5728\u4f7f\u7528 WAL \u6d41\u5f0f\u4f20\u8f93\u65f6\u518d\u63d0\u4f9b\u4e00\u4e2a WAL \u53d1\u9001\u8fdb\u7a0b\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u540c\u65f6\u8fd0\u884c\u591a\u4e2a<code class=\"command\">pg_basebackup</code>\uff0c\u4f46\u4ece\u6027\u80fd\u89d2\u5ea6\u6765\u770b\uff0c\u901a\u5e38\u6700\u597d\u53ea\u6267\u884c\u4e00\u6b21\u5907\u4efd\uff0c\u7136\u540e\u590d\u5236\u5176\u7ed3\u679c\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u4e0d\u4ec5\u53ef\u4ee5\u4ece\u4e3b\u5e93\u83b7\u53d6\u57fa\u7840\u5907\u4efd\uff0c\u4e5f\u53ef\u4ee5\u4ece\u5907\u5e93\u83b7\u53d6\u3002\u8981\u4ece\u5907\u5e93\u83b7\u53d6\u5907\u4efd\uff0c\u9700\u8981\u5c06\u5907\u5e93\u914d\u7f6e\u4e3a\u80fd\u591f\u63a5\u53d7\u590d\u5236\u8fde\u63a5\uff08\u5373\u8bbe\u7f6e<code class=\"varname\">max_wal_senders</code>\u548c<a class=\"xref\" href=\"/docs/14/runtime-config-replication.html#GUC-HOT-STANDBY\">hot_standby</a>\uff0c\u5e76\u9002\u5f53\u5730\u914d\u7f6e\u5176<code class=\"filename\">pg_hba.conf</code>\uff09\u3002\u8fd8\u9700\u8981\u5728\u4e3b\u5e93\u4e0a\u542f\u7528<a class=\"xref\" href=\"/docs/14/runtime-config-wal.html#GUC-FULL-PAGE-WRITES\">full_page_writes</a>\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u4ece\u5907\u5e93\u83b7\u53d6\u5907\u4efd\u5b58\u5728\u4e00\u4e9b\u9650\u5236\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5907\u4efd\u5386\u53f2\u6587\u4ef6\u4e0d\u4f1a\u5728\u88ab\u5907\u4efd\u7684\u6570\u636e\u5e93\u96c6\u7c07\u4e2d\u521b\u5efa\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">pg_basebackup</span>\u65e0\u6cd5\u5f3a\u5236\u5907\u5e93\u5728\u5907\u4efd\u7ed3\u675f\u65f6\u5207\u6362\u5230\u65b0\u7684 WAL \u6587\u4ef6\u3002\u5f53\u4f7f\u7528<code class=\"literal\">-X none</code>\u65f6\uff0c\u5982\u679c\u4e3b\u5e93\u4e0a\u7684\u5199\u5165\u6d3b\u52a8\u8f83\u5c11\uff0c<span class=\"application\">pg_basebackup</span>\u53ef\u80fd\u9700\u8981\u957f\u65f6\u95f4\u7b49\u5f85\uff0c\u76f4\u5230\u5907\u4efd\u6240\u9700\u7684\u6700\u540e\u4e00\u4e2a WAL \u6587\u4ef6\u88ab\u5207\u6362\u5e76\u5f52\u6863\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5728\u4e3b\u5e93\u4e0a\u8fd0\u884c<code class=\"function\">pg_switch_wal</code>\uff0c\u4ee5\u7acb\u5373\u89e6\u53d1 WAL \u6587\u4ef6\u5207\u6362\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5982\u679c\u5907\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u88ab\u63d0\u5347\u4e3a\u4e3b\u5e93\uff0c\u5219\u5907\u4efd\u4f1a\u5931\u8d25\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5907\u4efd\u6240\u9700\u7684\u6240\u6709 WAL \u8bb0\u5f55\u90fd\u5fc5\u987b\u5305\u542b\u8db3\u591f\u7684\u6574\u9875\u5199\u5165\uff0c\u56e0\u6b64\u5fc5\u987b\u5728\u4e3b\u5e93\u4e0a\u542f\u7528<code class=\"varname\">full_page_writes</code>\uff0c\u5e76\u4e14\u4e0d\u80fd\u628a<span class=\"application\">pg_compresslog</span>\u4e4b\u7c7b\u7684\u5de5\u5177\u7528\u4f5c<code class=\"varname\">archive_command</code>\uff0c\u4ece WAL \u6587\u4ef6\u4e2d\u79fb\u9664\u6574\u9875\u5199\u5165\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u6bcf\u5f53<span class=\"application\">pg_basebackup</span>\u6267\u884c\u57fa\u7840\u5907\u4efd\u65f6\uff0c\u670d\u52a1\u5668\u7684<code class=\"structname\">pg_stat_progress_basebackup</code>\u89c6\u56fe\u90fd\u4f1a\u62a5\u544a\u5907\u4efd\u8fdb\u5ea6\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/14/progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING\" title=\"28.4.5.\u00a0\u57fa\u7840\u5907\u4efd\u8fdb\u5ea6\u62a5\u544a\">\u7b2c\u00a028.4.5\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u8f93\u51fa\u7684\u4f4d\u7f6e\u548c\u683c\u5f0f\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>directory</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u5199\u5165\u8f93\u51fa\u7684\u76ee\u6807\u76ee\u5f55\u3002\u5982\u679c\u8be5\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u521b\u5efa\u5b83\uff08\u4ee5\u53ca\u6240\u6709\u7f3a\u5931\u7684\u7236\u76ee\u5f55\uff09\u3002\u5982\u679c\u8be5\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002</p>\n<p lang=\"zh\">\u5f53\u5907\u4efd\u91c7\u7528 tar \u683c\u5f0f\u65f6\uff0c\u76ee\u6807\u76ee\u5f55\u53ef\u4ee5\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff08\u77ed\u6a2a\u7ebf\uff09\uff0c\u4ece\u800c\u5c06 tar \u6587\u4ef6\u5199\u5230<code class=\"literal\">stdout</code>\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u662f\u5fc5\u9700\u7684\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>format</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--format=<em class=\"replaceable\"><code>format</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u9009\u62e9\u8f93\u51fa\u683c\u5f0f\u3002<em class=\"replaceable\"><code>format</code></em>\u53ef\u4ee5\u662f\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">p</code><br/></span><span class=\"term\"><code class=\"literal\">plain</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u5199\u4e3a\u666e\u901a\u6587\u4ef6\uff0c\u5176\u5e03\u5c40\u4e0e\u6e90\u670d\u52a1\u5668\u7684\u6570\u636e\u76ee\u5f55\u548c\u8868\u7a7a\u95f4\u76f8\u540c\u3002\u5f53\u96c6\u7c07\u6ca1\u6709\u989d\u5916\u8868\u7a7a\u95f4\u65f6\uff0c\u6574\u4e2a\u6570\u636e\u5e93\u90fd\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u3002\u5982\u679c\u96c6\u7c07\u5305\u542b\u989d\u5916\u8868\u7a7a\u95f4\uff0c\u5219\u4e3b\u6570\u636e\u76ee\u5f55\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\uff0c\u800c\u5176\u4ed6\u6240\u6709\u8868\u7a7a\u95f4\u90fd\u4f1a\u653e\u5728\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u76f8\u540c\u7684\u7edd\u5bf9\u8def\u5f84\u4e2d\u3002\uff08\u5982\u9700\u6539\u53d8\u8fd9\u4e00\u70b9\uff0c\u89c1<code class=\"option\">--tablespace-mapping</code>\u3002\uff09</p>\n<p lang=\"zh\">\u8fd9\u662f\u9ed8\u8ba4\u683c\u5f0f\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">t</code><br/></span><span class=\"term\"><code class=\"literal\">tar</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u5199\u4e3a\u76ee\u6807\u76ee\u5f55\u4e2d\u7684 tar \u6587\u4ef6\u3002\u4e3b\u6570\u636e\u76ee\u5f55\u7684\u5185\u5bb9\u4f1a\u5199\u5165\u540d\u4e3a<code class=\"filename\">base.tar</code>\u7684\u6587\u4ef6\u4e2d\uff0c\u800c\u6bcf\u4e2a\u5176\u4ed6\u8868\u7a7a\u95f4\u90fd\u4f1a\u5199\u5165\u4e00\u4e2a\u4ee5\u8be5\u8868\u7a7a\u95f4 OID \u547d\u540d\u7684\u72ec\u7acb tar \u6587\u4ef6\u4e2d\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u76ee\u6807\u76ee\u5f55\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff08\u77ed\u6a2a\u7ebf\uff09\uff0ctar \u5185\u5bb9\u5c06\u5199\u5165\u6807\u51c6\u8f93\u51fa\uff0c\u9002\u5408\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u4f8b\u5982<span class=\"productname\">gzip</span>\u3002\u53ea\u6709\u5f53\u96c6\u7c07\u6ca1\u6709\u989d\u5916\u8868\u7a7a\u95f4\u4e14\u672a\u4f7f\u7528 WAL \u6d41\u5f0f\u4f20\u8f93\u65f6\uff0c\u624d\u5141\u8bb8\u8fd9\u6837\u505a\u3002</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code><br/></span><span class=\"term\"><code class=\"option\">--write-recovery-conf</code></span></dt>\n<dd>\n<p lang=\"zh\">\u521b\u5efa<a class=\"link\" href=\"/docs/14/warm-standby.html#FILE-STANDBY-SIGNAL\"><code class=\"filename\">standby.signal</code></a> <a class=\"indexterm\" id=\"id-1.9.4.10.6.2.1.3.3.1.2\" name=\"id-1.9.4.10.6.2.1.3.3.1.2\"></a>\u6587\u4ef6\uff0c\u5e76\u5c06\u8fde\u63a5\u8bbe\u7f6e\u8ffd\u52a0\u5230\u76ee\u6807\u76ee\u5f55\u4e2d\u7684<code class=\"filename\">postgresql.auto.conf</code>\u6587\u4ef6\u4e2d\uff08\u5982\u679c\u4f7f\u7528 tar \u683c\u5f0f\uff0c\u5219\u8ffd\u52a0\u5230\u57fa\u7840\u5f52\u6863\u6587\u4ef6\u5185\uff09\u3002\u8fd9\u6837\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u5229\u7528\u5907\u4efd\u7ed3\u679c\u642d\u5efa\u5907\u5e93\u3002</p>\n<p lang=\"zh\"><code class=\"filename\">postgresql.auto.conf</code>\u6587\u4ef6\u4f1a\u8bb0\u5f55<span class=\"application\">pg_basebackup</span>\u6240\u7528\u7684\u8fde\u63a5\u8bbe\u7f6e\uff0c\u4ee5\u53ca\u590d\u5236\u69fd\uff08\u5982\u679c\u6307\u5b9a\u4e86\uff09\uff0c\u4ee5\u4fbf\u6d41\u590d\u5236\u4ee5\u540e\u4f7f\u7528\u76f8\u540c\u7684\u8bbe\u7f6e\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>olddir</code></em>=<em class=\"replaceable\"><code>newdir</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--tablespace-mapping=<em class=\"replaceable\"><code>olddir</code></em>=<em class=\"replaceable\"><code>newdir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u671f\u95f4\uff0c\u5c06\u76ee\u5f55<em class=\"replaceable\"><code>olddir</code></em>\u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230<em class=\"replaceable\"><code>newdir</code></em>\u3002\u8981\u4f7f\u6b64\u9009\u9879\u751f\u6548\uff0c<em class=\"replaceable\"><code>olddir</code></em>\u5fc5\u987b\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u5b9a\u4e49\u7684\u8be5\u8868\u7a7a\u95f4\u8def\u5f84\u5b8c\u5168\u4e00\u81f4\u3002\uff08\u4f46\u5982\u679c\u6e90\u670d\u52a1\u5668\u4e0a\u5728<em class=\"replaceable\"><code>olddir</code></em>\u4e2d\u6ca1\u6709\u8868\u7a7a\u95f4\uff0c\u4e5f\u4e0d\u7b97\u9519\u8bef\u3002\uff09\u4e0e\u6b64\u540c\u65f6\uff0c<em class=\"replaceable\"><code>newdir</code></em>\u662f\u63a5\u6536\u4e3b\u673a\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u4e00\u4e2a\u76ee\u5f55\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c<em class=\"replaceable\"><code>newdir</code></em>\u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002<em class=\"replaceable\"><code>olddir</code></em>\u548c<em class=\"replaceable\"><code>newdir</code></em>\u90fd\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u5982\u679c\u4efb\u4e00\u8def\u5f84\u4e2d\u9700\u8981\u5305\u542b\u7b49\u53f7\uff08<code class=\"literal\">=</code>\uff09\uff0c\u8bf7\u5728\u5176\u524d\u9762\u52a0\u4e0a\u53cd\u659c\u6760\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u4ee5\u5904\u7406\u591a\u4e2a\u8868\u7a7a\u95f4\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u91cd\u5b9a\u4f4d\u8868\u7a7a\u95f4\uff0c\u4e3b\u6570\u636e\u76ee\u5f55\u4e2d\u7684\u7b26\u53f7\u94fe\u63a5\u5c06\u88ab\u66f4\u65b0\u4e3a\u6307\u5411\u65b0\u4f4d\u7f6e\u3002\u56e0\u6b64\uff0c\u65b0\u6570\u636e\u76ee\u5f55\u5df2\u53ef\u76f4\u63a5\u7528\u4e8e\u542f\u52a8\u4e00\u4e2a\u6240\u6709\u8868\u7a7a\u95f4\u90fd\u4f4d\u4e8e\u66f4\u65b0\u540e\u4f4d\u7f6e\u7684\u65b0\u670d\u52a1\u5668\u5b9e\u4f8b\u3002</p>\n<p lang=\"zh\">\u76ee\u524d\uff0c\u6b64\u9009\u9879\u4ec5\u9002\u7528\u4e8e\u666e\u901a\u6587\u4ef6\u8f93\u51fa\u683c\u5f0f\uff1b\u5982\u679c\u9009\u62e9\u4e86 tar \u683c\u5f0f\uff0c\u5219\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--waldir=<em class=\"replaceable\"><code>waldir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5199\u5165 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cWAL \u6587\u4ef6\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u7684<code class=\"filename\">pg_wal</code>\u5b50\u76ee\u5f55\u4e2d\uff0c\u4f46\u6b64\u9009\u9879\u53ef\u7528\u4e8e\u5c06\u5176\u653e\u5728\u5176\u4ed6\u4f4d\u7f6e\u3002<em class=\"replaceable\"><code>waldir</code></em>\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c<em class=\"replaceable\"><code>waldir</code></em>\u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002\u53ea\u6709\u5f53\u5907\u4efd\u91c7\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u624d\u80fd\u6307\u5b9a\u6b64\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-X <em class=\"replaceable\"><code>method</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--wal-method=<em class=\"replaceable\"><code>method</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u4e2d\u5305\u542b\u6240\u9700\u7684 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u3002\u8fd9\u5c06\u5305\u62ec\u5907\u4efd\u671f\u95f4\u751f\u6210\u7684\u6240\u6709\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u9664\u975e\u6307\u5b9a\u65b9\u6cd5<code class=\"literal\">none</code>\uff0c\u5426\u5219\u5c31\u53ef\u4ee5\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u542f\u52a8 postmaster\uff0c\u800c\u65e0\u9700\u67e5\u9605 WAL \u5f52\u6863\uff0c\u4ece\u800c\u4f7f\u8f93\u51fa\u6210\u4e3a\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u5907\u4efd\u3002</p>\n<p lang=\"zh\">\u652f\u6301\u4ee5\u4e0b\u7528\u4e8e\u6536\u96c6\u9884\u5199\u5f0f\u65e5\u5fd7\u7684<em class=\"replaceable\"><code>method</code></em>\u503c\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">n</code><br/></span><span class=\"term\"><code class=\"literal\">none</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u5728\u5907\u4efd\u4e2d\u5305\u542b\u9884\u5199\u5f0f\u65e5\u5fd7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">f</code><br/></span><span class=\"term\"><code class=\"literal\">fetch</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u7ed3\u675f\u65f6\u6536\u96c6\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u3002\u56e0\u6b64\uff0c\u6e90\u670d\u52a1\u5668\u7684<a class=\"xref\" href=\"/docs/14/runtime-config-replication.html#GUC-WAL-KEEP-SIZE\">wal_keep_size</a>\u53c2\u6570\u5fc5\u987b\u8bbe\u7f6e\u5f97\u8db3\u591f\u9ad8\uff0c\u4ee5\u786e\u4fdd\u5728\u5907\u4efd\u7ed3\u675f\u524d\u4e0d\u4f1a\u79fb\u9664\u6240\u9700\u7684\u65e5\u5fd7\u6570\u636e\u3002\u5982\u679c\u5728\u4f20\u8f93\u8fd9\u4e9b\u6570\u636e\u4e4b\u524d\u5b83\u4eec\u5df2\u7ecf\u88ab\u56de\u6536\uff0c\u5219\u5907\u4efd\u4f1a\u5931\u8d25\u5e76\u4e14\u65e0\u6cd5\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u4f1a\u5305\u542b\u5728<code class=\"filename\">base.tar</code>\u6587\u4ef6\u4e2d\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">s</code><br/></span><span class=\"term\"><code class=\"literal\">stream</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u6267\u884c\u5907\u4efd\u7684\u540c\u65f6\u6d41\u5f0f\u4f20\u8f93\u9884\u5199\u5f0f\u65e5\u5fd7\u6570\u636e\u3002\u6b64\u65b9\u6cd5\u4f1a\u5411\u670d\u52a1\u5668\u6253\u5f00\u7b2c\u4e8c\u4e2a\u8fde\u63a5\uff0c\u5e76\u5728\u6267\u884c\u5907\u4efd\u65f6\u5e76\u884c\u5f00\u59cb\u6d41\u5f0f\u4f20\u8f93\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u56e0\u6b64\uff0c\u5b83\u9700\u8981\u4e24\u4e2a\u590d\u5236\u8fde\u63a5\uff0c\u800c\u4e0d\u53ea\u662f\u4e00\u4e2a\u3002\u53ea\u8981\u5ba2\u6237\u7aef\u80fd\u591f\u8ddf\u4e0a\u9884\u5199\u5f0f\u65e5\u5fd7\u6570\u636e\uff0c\u4f7f\u7528\u6b64\u65b9\u6cd5\u5c31\u4e0d\u9700\u8981\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u989d\u5916\u4fdd\u7559\u9884\u5199\u5f0f\u65e5\u5fd7\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u4f1a\u5199\u5165\u4e00\u4e2a\u540d\u4e3a<code class=\"filename\">pg_wal.tar</code>\u7684\u72ec\u7acb\u6587\u4ef6\u4e2d\uff08\u5982\u679c\u670d\u52a1\u5668\u7248\u672c\u65e9\u4e8e 10\uff0c\u5219\u6587\u4ef6\u540d\u4e3a<code class=\"filename\">pg_xlog.tar</code>\uff09\u3002</p>\n<p lang=\"zh\">\u8fd9\u662f\u9ed8\u8ba4\u503c\u3002</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-z</code><br/></span><span class=\"term\"><code class=\"option\">--gzip</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u4f7f\u7528\u9ed8\u8ba4\u538b\u7f29\u7ea7\u522b\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0<code class=\"filename\">.gz</code>\u540e\u7f00\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-Z <em class=\"replaceable\"><code>level</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--compress=<em class=\"replaceable\"><code>level</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u5e76\u6307\u5b9a\u538b\u7f29\u7ea7\u522b\uff080 \u5230 9\uff0c\u5176\u4e2d 0 \u8868\u793a\u4e0d\u538b\u7f29\uff0c9 \u8868\u793a\u6700\u4f73\u538b\u7f29\uff09\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0<code class=\"filename\">.gz</code>\u540e\u7f00\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u5907\u4efd\u7684\u751f\u6210\u548c\u7a0b\u5e8f\u7684\u8c03\u7528\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>fast|spread</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--checkpoint=<em class=\"replaceable\"><code>fast|spread</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u68c0\u67e5\u70b9\u6a21\u5f0f\u8bbe\u7f6e\u4e3a fast\uff08\u7acb\u5373\uff09\u6216 spread\uff08\u9ed8\u8ba4\uff09\uff08\u89c1<a class=\"xref\" href=\"/docs/14/continuous-archiving.html#BACKUP-LOWLEVEL-BASE-BACKUP\" title=\"26.3.3.\u00a0\u4f7f\u7528\u4f4e\u7ea7 API \u8fdb\u884c\u57fa\u7840\u5907\u4efd\">\u7b2c\u00a026.3.3\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--create-slot</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728\u5f00\u59cb\u5907\u4efd\u4e4b\u524d\uff0c\u5e94\u521b\u5efa\u7531<code class=\"literal\">--slot</code>\u9009\u9879\u6307\u5b9a\u540d\u79f0\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u8be5\u69fd\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u9519\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>label</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--label=<em class=\"replaceable\"><code>label</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5907\u4efd\u6807\u7b7e\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u503c<span class=\"quote\">\u201c<span class=\"quote\"><code class=\"literal\">pg_basebackup base backup</code></span>\u201d</span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-clean</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53<code class=\"command\">pg_basebackup</code>\u56e0\u9519\u8bef\u4e2d\u6b62\u65f6\uff0c\u5b83\u4f1a\u5220\u9664\u5728\u53d1\u73b0\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u76ee\u5f55\uff08\u4f8b\u5982\u76ee\u6807\u76ee\u5f55\u548c\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\uff09\u3002\u6b64\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u5f88\u6709\u5e2e\u52a9\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u65e0\u8bba\u662f\u5426\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u8868\u7a7a\u95f4\u76ee\u5f55\u90fd\u4e0d\u4f1a\u88ab\u6e05\u7406\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N</code><br/></span><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">pg_basebackup</code>\u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u88ab\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f1a\u4f7f<code class=\"command\">pg_basebackup</code>\u4e0d\u7ecf\u7b49\u5f85\u5c31\u76f4\u63a5\u8fd4\u56de\uff0c\u56e0\u6b64\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u968f\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u57fa\u7840\u5907\u4efd\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u5408\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P</code><br/></span><span class=\"term\"><code class=\"option\">--progress</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528\u8fdb\u5ea6\u62a5\u544a\u3002\u6253\u5f00\u6b64\u9009\u9879\u540e\uff0c\u4f1a\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u7ed9\u51fa\u4e00\u4e2a\u8fd1\u4f3c\u7684\u8fdb\u5ea6\u62a5\u544a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u53d1\u751f\u53d8\u5316\uff0c\u56e0\u6b64\u8fd9\u53ea\u662f\u8fd1\u4f3c\u503c\uff0c\u6700\u7ec8\u672a\u5fc5\u6070\u597d\u7ed3\u675f\u5728<code class=\"literal\">100%</code>\u3002\u7279\u522b\u662f\u5f53\u5907\u4efd\u4e2d\u5305\u542b WAL \u65f6\uff0c\u603b\u6570\u636e\u91cf\u65e0\u6cd5\u9884\u5148\u4f30\u8ba1\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u65e6\u8fdb\u5ea6\u8d85\u8fc7\u4e0d\u542b WAL \u65f6\u7684\u603b\u4f30\u8ba1\u503c\uff0c\u4f30\u8ba1\u76ee\u6807\u5927\u5c0f\u5c31\u4f1a\u7ee7\u7eed\u589e\u52a0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r <em class=\"replaceable\"><code>rate</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--max-rate=<em class=\"replaceable\"><code>rate</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u4ece\u6e90\u670d\u52a1\u5668\u6536\u96c6\u6570\u636e\u65f6\u5141\u8bb8\u7684\u6700\u5927\u4f20\u8f93\u901f\u7387\u3002\u8fd9\u6709\u52a9\u4e8e\u9650\u5236<span class=\"application\">pg_basebackup</span>\u5bf9\u670d\u52a1\u5668\u7684\u5f71\u54cd\u3002\u53d6\u503c\u5355\u4f4d\u4e3a\u6bcf\u79d2\u5343\u5b57\u8282\u3002\u4f7f\u7528\u540e\u7f00<code class=\"literal\">M</code>\u8868\u793a\u6bcf\u79d2\u5146\u5b57\u8282\u3002\u4e5f\u63a5\u53d7\u540e\u7f00<code class=\"literal\">k</code>\uff0c\u4f46\u6ca1\u6709\u5b9e\u9645\u5f71\u54cd\u3002\u6709\u6548\u53d6\u503c\u8303\u56f4\u4e3a\u6bcf\u79d2 32 \u5343\u5b57\u8282\u5230\u6bcf\u79d2 1024 \u5146\u5b57\u8282\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u59cb\u7ec8\u5f71\u54cd\u6570\u636e\u76ee\u5f55\u7684\u4f20\u8f93\u3002\u53ea\u6709\u5f53\u6536\u96c6\u65b9\u6cd5\u4e3a<code class=\"literal\">fetch</code>\u65f6\uff0cWAL \u6587\u4ef6\u7684\u4f20\u8f93\u624d\u4f1a\u53d7\u5230\u5f71\u54cd\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>slotname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--slot=<em class=\"replaceable\"><code>slotname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u53ea\u80fd\u4e0e<code class=\"literal\">-X stream</code>\u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u4f1a\u4f7f WAL \u6d41\u5f0f\u4f20\u8f93\u4f7f\u7528\u6307\u5b9a\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u6b64\u57fa\u7840\u5907\u4efd\u6253\u7b97\u7528\u4f5c\u4f7f\u7528\u590d\u5236\u69fd\u7684\u6d41\u590d\u5236\u5907\u5e93\uff0c\u90a3\u4e48\u8be5\u5907\u5e93\u5e94\u5c06\u540c\u4e00\u4e2a\u590d\u5236\u69fd\u540d\u79f0\u7528\u4f5c<a class=\"xref\" href=\"/docs/14/runtime-config-replication.html#GUC-PRIMARY-SLOT-NAME\">primary_slot_name</a>\u7684\u503c\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u4e3b\u5e93\u5728\u57fa\u7840\u5907\u4efd\u7ed3\u675f\u4e0e\u65b0\u5907\u5e93\u5f00\u59cb\u6d41\u590d\u5236\u4e4b\u95f4\u7684\u8fd9\u6bb5\u65f6\u95f4\u5185\uff0c\u4e0d\u4f1a\u79fb\u9664\u4efb\u4f55\u5fc5\u9700\u7684 WAL \u6570\u636e\u3002</p>\n<p lang=\"zh\">\u6307\u5b9a\u7684\u590d\u5236\u69fd\u5fc5\u987b\u5df2\u7ecf\u5b58\u5728\uff0c\u9664\u975e\u8fd8\u540c\u65f6\u4f7f\u7528\u4e86<code class=\"option\">-C</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5e76\u4e14\u670d\u52a1\u5668\u652f\u6301\u4e34\u65f6\u590d\u5236\u69fd\uff0810 \u53ca\u4ee5\u4e0a\u7248\u672c\uff09\uff0c\u5219\u4f1a\u81ea\u52a8\u4f7f\u7528\u4e34\u65f6\u590d\u5236\u69fd\u8fdb\u884c WAL \u6d41\u5f0f\u4f20\u8f93\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\u3002\u5b83\u4f1a\u5728\u542f\u52a8\u548c\u5173\u95ed\u8fc7\u7a0b\u4e2d\u8f93\u51fa\u4e00\u4e9b\u989d\u5916\u6b65\u9aa4\uff1b\u5982\u679c\u540c\u65f6\u542f\u7528\u4e86\u8fdb\u5ea6\u62a5\u544a\uff0c\u8fd8\u4f1a\u663e\u793a\u5f53\u524d\u6b63\u5728\u5904\u7406\u7684\u786e\u5207\u6587\u4ef6\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--manifest-checksums=<em class=\"replaceable\"><code>algorithm</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u5e94\u7528\u5230\u5907\u4efd\u6e05\u5355\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u7684\u6821\u9a8c\u548c\u7b97\u6cd5\u3002\u76ee\u524d\u53ef\u7528\u7684\u7b97\u6cd5\u6709<code class=\"literal\">NONE</code>\u3001<code class=\"literal\">CRC32C</code>\u3001<code class=\"literal\">SHA224</code>\u3001<code class=\"literal\">SHA256</code>\u3001<code class=\"literal\">SHA384</code>\u548c<code class=\"literal\">SHA512</code>\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">CRC32C</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">NONE</code>\uff0c\u5907\u4efd\u6e05\u5355\u5c06\u4e0d\u5305\u542b\u4efb\u4f55\u6821\u9a8c\u548c\u3002\u5426\u5219\uff0c\u5b83\u5c06\u5305\u542b\u4f7f\u7528\u6307\u5b9a\u7b97\u6cd5\u4e3a\u5907\u4efd\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u8ba1\u7b97\u7684\u6821\u9a8c\u548c\u3002\u6b64\u5916\uff0c\u6e05\u5355\u59cb\u7ec8\u4f1a\u5305\u542b\u5176\u81ea\u8eab\u5185\u5bb9\u7684<code class=\"literal\">SHA256</code>\u6821\u9a8c\u548c\u3002<code class=\"literal\">SHA</code>\u7b97\u6cd5\u660e\u663e\u6bd4<code class=\"literal\">CRC32C</code>\u66f4\u8017\u8d39 CPU\uff0c\u56e0\u6b64\u9009\u62e9\u5176\u4e2d\u4e00\u79cd\u53ef\u80fd\u4f1a\u589e\u52a0\u5b8c\u6210\u5907\u4efd\u6240\u9700\u7684\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u5e0c\u671b\u9a8c\u8bc1\u5907\u4efd\u672a\u88ab\u7be1\u6539\u7684\u7528\u6237\uff0c\u4f7f\u7528 SHA hash \u51fd\u6570\u53ef\u4ee5\u4e3a\u6bcf\u4e2a\u6587\u4ef6\u63d0\u4f9b\u5177\u6709\u5bc6\u7801\u5b66\u5b89\u5168\u6027\u7684\u6458\u8981\uff1b\u800c CRC32C \u7b97\u6cd5\u63d0\u4f9b\u7684\u6821\u9a8c\u548c\u8ba1\u7b97\u901f\u5ea6\u8981\u5feb\u5f97\u591a\uff0c\u867d\u7136\u5b83\u5f88\u9002\u5408\u53d1\u73b0\u7531\u4e8e\u610f\u5916\u6539\u52a8\u9020\u6210\u7684\u9519\u8bef\uff0c\u4f46\u5e76\u4e0d\u80fd\u62b5\u5fa1\u6076\u610f\u4fee\u6539\u3002\u8bf7\u6ce8\u610f\uff0c\u8981\u60f3\u5bf9\u80fd\u591f\u8bbf\u95ee\u5907\u4efd\u7684\u653b\u51fb\u8005\u5f62\u6210\u9632\u62a4\uff0c\u5907\u4efd\u6e05\u5355\u5c31\u9700\u8981\u5b89\u5168\u5730\u4fdd\u5b58\u5728\u5176\u4ed6\u5730\u65b9\uff0c\u6216\u8005\u4ee5\u5176\u4ed6\u65b9\u5f0f\u786e\u8ba4\u81ea\u5907\u4efd\u5b8c\u6210\u540e\u672a\u88ab\u4fee\u6539\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528<a class=\"xref\" href=\"/docs/14/app-pgverifybackup.html\" title=\"pg_verifybackup\"><span class=\"refentrytitle\"><span class=\"application\">pg_verifybackup</span></span></a>\u6839\u636e\u5907\u4efd\u6e05\u5355\u68c0\u67e5\u5907\u4efd\u7684\u5b8c\u6574\u6027\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--manifest-force-encode</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f3a\u5236\u5c06\u5907\u4efd\u6e05\u5355\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u540d\u7f16\u7801\u4e3a\u5341\u516d\u8fdb\u5236\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u5bf9\u975e UTF8 \u6587\u4ef6\u540d\u8fdb\u884c\u5341\u516d\u8fdb\u5236\u7f16\u7801\u3002\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u8bfb\u53d6\u5907\u4efd\u6e05\u5355\u6587\u4ef6\u7684\u5de5\u5177\u662f\u5426\u80fd\u6b63\u786e\u5904\u7406\u8fd9\u79cd\u60c5\u51b5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-estimate-size</code></span></dt>\n<dd>\n<p lang=\"zh\">\u7981\u6b62\u670d\u52a1\u5668\u4f30\u7b97\u5c06\u8981\u6d41\u5f0f\u4f20\u8f93\u7684\u5907\u4efd\u6570\u636e\u603b\u91cf\uff0c\u56e0\u6b64 pg_stat_progress_basebackup \u89c6\u56fe\u4e2d\u7684 backup_total \u5217\u59cb\u7ec8\u4e3a NULL\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5907\u4efd\u4f1a\u5148\u679a\u4e3e\u6574\u4e2a\u6570\u636e\u5e93\u7684\u5927\u5c0f\uff0c\u7136\u540e\u518d\u56de\u8fc7\u5934\u6765\u53d1\u9001\u5b9e\u9645\u5185\u5bb9\u3002\u8fd9\u53ef\u80fd\u4f1a\u8ba9\u5907\u4efd\u8017\u65f6\u7565\u957f\uff0c\u7279\u522b\u662f\u5728\u53d1\u9001\u7b2c\u4e00\u6279\u6570\u636e\u4e4b\u524d\u6240\u9700\u65f6\u95f4\u4f1a\u66f4\u4e45\u3002\u5982\u679c\u8fd9\u79cd\u4f30\u7b97\u8017\u65f6\u8fc7\u957f\uff0c\u6b64\u9009\u9879\u5c31\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u5b83\u53ef\u4ee5\u907f\u514d\u8fd9\u6bb5\u4f30\u7b97\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--progress</code>\u65f6\uff0c\u4e0d\u5141\u8bb8\u4f7f\u7528\u6b64\u9009\u9879\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-manifest</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7981\u6b62\u751f\u6210\u5907\u4efd\u6e05\u5355\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u670d\u52a1\u5668\u5c06\u751f\u6210\u5e76\u53d1\u9001\u4e00\u4e2a\u5907\u4efd\u6e05\u5355\uff0c\u53ef\u4f7f\u7528<a class=\"xref\" href=\"/docs/14/app-pgverifybackup.html\" title=\"pg_verifybackup\"><span class=\"refentrytitle\"><span class=\"application\">pg_verifybackup</span></span></a>\u8fdb\u884c\u9a8c\u8bc1\u3002\u8be5\u6e05\u5355\u5217\u51fa\u4e86\u5907\u4efd\u4e2d\u7684\u6bcf\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u4e0d\u5305\u62ec\u53ef\u80fd\u5305\u542b\u5728\u5176\u4e2d\u7684\u4efb\u4f55 WAL \u6587\u4ef6\u3002\u5b83\u8fd8\u4f1a\u4fdd\u5b58\u6bcf\u4e2a\u6587\u4ef6\u7684\u5927\u5c0f\u3001\u6700\u540e\u4fee\u6539\u65f6\u95f4\u4ee5\u53ca\u53ef\u9009\u7684\u6821\u9a8c\u548c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-slot</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9632\u6b62\u4e3a\u5907\u4efd\u521b\u5efa\u4e34\u65f6\u590d\u5236\u69fd\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u9009\u62e9\u4e86 WAL \u6d41\u5f0f\u4f20\u8f93\uff0c\u4f46\u6ca1\u6709\u4f7f\u7528<code class=\"option\">-S</code>\u9009\u9879\u7ed9\u51fa\u69fd\u540d\uff0c\u90a3\u4e48\u4f1a\u521b\u5efa\u4e00\u4e2a\u4e34\u65f6\u590d\u5236\u69fd\uff08\u5982\u679c\u6e90\u670d\u52a1\u5668\u652f\u6301\uff09\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7684\u4e3b\u8981\u76ee\u7684\u662f\u5728\u670d\u52a1\u5668\u6ca1\u6709\u7a7a\u95f2\u590d\u5236\u69fd\u65f6\uff0c\u4ecd\u7136\u5141\u8bb8\u6267\u884c\u57fa\u7840\u5907\u4efd\u3002\u51e0\u4e4e\u603b\u662f\u9996\u9009\u4f7f\u7528\u590d\u5236\u69fd\uff0c\u56e0\u4e3a\u5b83\u80fd\u9632\u6b62\u670d\u52a1\u5668\u5728\u5907\u4efd\u671f\u95f4\u79fb\u9664\u6240\u9700\u7684 WAL\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-verify-checksums</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u83b7\u53d6\u57fa\u7840\u5907\u4efd\u7684\u670d\u52a1\u5668\u542f\u7528\u4e86\u6821\u9a8c\u548c\uff0c\u5219\u7981\u7528\u5bf9\u8fd9\u4e9b\u6821\u9a8c\u548c\u7684\u9a8c\u8bc1\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f1a\u9a8c\u8bc1\u6821\u9a8c\u548c\uff1b\u6821\u9a8c\u548c\u9a8c\u8bc1\u5931\u8d25\u5c06\u5bfc\u81f4\u975e\u96f6\u9000\u51fa\u72b6\u6001\u3002\u4e0d\u8fc7\uff0c\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u57fa\u7840\u5907\u4efd\u4e0d\u4f1a\u88ab\u5220\u9664\uff0c\u5c31\u50cf\u4f7f\u7528\u4e86<code class=\"option\">--no-clean</code>\u4e00\u6837\u3002\u6821\u9a8c\u548c\u9a8c\u8bc1\u5931\u8d25\u4e5f\u4f1a\u5728<a class=\"link\" href=\"/docs/14/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW\" title=\"28.2.13.\u00a0pg_stat_database\"><code class=\"structname\">pg_stat_database</code></a>\u89c6\u56fe\u4e2d\u62a5\u544a\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u5230\u6e90\u670d\u52a1\u5668\u7684\u8fde\u63a5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>connstr</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>connstr</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ee5<a class=\"link\" href=\"/docs/14/libpq.html#LIBPQ-CONNSTRING\" title=\"34.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u7684\u5f62\u5f0f\u6307\u5b9a\u7528\u4e8e\u8fde\u63a5\u670d\u52a1\u5668\u7684\u53c2\u6570\uff1b\u8fd9\u4e9b\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u76f8\u4e92\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u51fa\u4e8e\u4e0e\u5176\u4ed6\u5ba2\u6237\u7aef\u5e94\u7528\u4fdd\u6301\u4e00\u81f4\u7684\u8003\u8651\uff0c\u6b64\u9009\u9879\u540d\u4e3a<code class=\"literal\">--dbname</code>\uff1b\u4f46\u7531\u4e8e<span class=\"application\">pg_basebackup</span>\u5e76\u4e0d\u8fde\u63a5\u5230\u96c6\u7c07\u4e2d\u7684\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u4e2d\u7684\u4efb\u4f55\u6570\u636e\u5e93\u540d\u90fd\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea<code class=\"envar\">PGHOST</code>\u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff1b\u5426\u5219\u4f1a\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u6240\u4f7f\u7528\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u4f7f\u7528<code class=\"envar\">PGPORT</code>\u73af\u5883\u53d8\u91cf\u4e2d\u7684\u503c\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u786e\u5b9a\u7684\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s <em class=\"replaceable\"><code>interval</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--status-interval=<em class=\"replaceable\"><code>interval</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u53d1\u9001\u56de\u6e90\u670d\u52a1\u5668\u7684\u72b6\u6001\u5305\u4e4b\u95f4\u76f8\u9694\u7684\u79d2\u6570\u3002\u8f83\u5c0f\u7684\u503c\u53ef\u4ee5\u8ba9\u670d\u52a1\u5668\u7aef\u5bf9\u5907\u4efd\u8fdb\u5ea6\u7684\u76d1\u63a7\u66f4\u7cbe\u786e\u3002\u503c\u4e3a\u96f6\u65f6\u4f1a\u5b8c\u5168\u7981\u7528\u5468\u671f\u6027\u72b6\u6001\u66f4\u65b0\uff0c\u4e0d\u8fc7\u5f53\u670d\u52a1\u5668\u8bf7\u6c42\u65f6\u4ecd\u4f1a\u53d1\u9001\u66f4\u65b0\uff0c\u4ee5\u907f\u514d\u56e0\u8d85\u65f6\u800c\u65ad\u5f00\u8fde\u63a5\u3002\u9ed8\u8ba4\u503c\u662f 10 \u79d2\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7981\u6b62\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\uff08\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff09\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u6b64\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u79cd\u573a\u666f\u4e0b\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236<span class=\"application\">pg_basebackup</span>\u5728\u8fde\u63a5\u6e90\u670d\u52a1\u5668\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7edd\u975e\u5fc5\u9700\uff0c\u56e0\u4e3a\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u81ea\u52a8\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\u6765\u53d1\u73b0\u670d\u52a1\u5668\u9700\u8981\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u8f93\u5165<code class=\"option\">-W</code>\u4ee5\u907f\u514d\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u662f\u503c\u5f97\u7684\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5176\u4ed6\u9009\u9879\u4e5f\u53ef\u7528\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa<span class=\"application\">pg_basebackup</span>\u7684\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"application\">pg_basebackup</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6<span class=\"productname\">PostgreSQL</span>\u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528<span class=\"application\">libpq</span>\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/14/libpq-envars.html\" title=\"34.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a034.15\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\">\u73af\u5883\u53d8\u91cf<code class=\"envar\">PG_COLOR</code>\u6307\u5b9a\u662f\u5426\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a<code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c<code class=\"literal\">never</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u5728\u5907\u4efd\u5f00\u59cb\u65f6\uff0c\u9700\u8981\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u6267\u884c\u4e00\u6b21\u68c0\u67e5\u70b9\u3002\u8fd9\u53ef\u80fd\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\uff08\u5c24\u5176\u662f\u5728\u672a\u4f7f\u7528<code class=\"literal\">--checkpoint=fast</code>\u9009\u9879\u65f6\uff09\uff1b\u5728\u6b64\u671f\u95f4\uff0c<span class=\"application\">pg_basebackup</span>\u770b\u8d77\u6765\u4f1a\u5904\u4e8e\u7a7a\u95f2\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u5907\u4efd\u5c06\u5305\u62ec\u6570\u636e\u76ee\u5f55\u548c\u8868\u7a7a\u95f4\u4e2d\u7684\u6240\u6709\u6587\u4ef6\uff0c\u5305\u62ec\u914d\u7f6e\u6587\u4ef6\u4ee5\u53ca\u7b2c\u4e09\u65b9\u653e\u5728\u8fd9\u4e9b\u76ee\u5f55\u4e2d\u7684\u4efb\u4f55\u989d\u5916\u6587\u4ef6\uff0c\u4f46\u7531 PostgreSQL \u7ba1\u7406\u7684\u67d0\u4e9b\u4e34\u65f6\u6587\u4ef6\u9664\u5916\u3002\u4e0d\u8fc7\uff0c\u53ea\u6709\u666e\u901a\u6587\u4ef6\u548c\u76ee\u5f55\u4f1a\u88ab\u590d\u5236\uff0c\u4f46\u7528\u4e8e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u4f1a\u88ab\u4fdd\u7559\u3002\u6307\u5411 PostgreSQL \u5df2\u77e5\u7684\u67d0\u4e9b\u76ee\u5f55\u7684\u7b26\u53f7\u94fe\u63a5\u4f1a\u88ab\u590d\u5236\u4e3a\u7a7a\u76ee\u5f55\u3002\u5176\u4ed6\u7b26\u53f7\u94fe\u63a5\u548c\u7279\u6b8a\u8bbe\u5907\u6587\u4ef6\u5219\u4f1a\u88ab\u8df3\u8fc7\u3002\u5177\u4f53\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/14/protocol-replication.html\" title=\"53.4.\u00a0\u6d41\u590d\u5236\u534f\u8bae\">\u7b2c\u00a053.4\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5728\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u4e2d\uff0c\u9664\u975e\u4f7f\u7528\u4e86<code class=\"literal\">--tablespace-mapping</code>\u9009\u9879\uff0c\u5426\u5219\u8868\u7a7a\u95f4\u4f1a\u5907\u4efd\u5230\u5176\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u7684\u76f8\u540c\u8def\u5f84\u3002\u5982\u679c\u4e0d\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u90a3\u4e48\u5f53\u8868\u7a7a\u95f4\u6b63\u5728\u4f7f\u7528\u65f6\uff0c\u5c31\u65e0\u6cd5\u5728\u4e0e\u670d\u52a1\u5668\u76f8\u540c\u7684\u4e3b\u673a\u4e0a\u6267\u884c\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u7684\u57fa\u7840\u5907\u4efd\uff0c\u56e0\u4e3a\u5907\u4efd\u5c06\u4e0d\u5f97\u4e0d\u5199\u5165\u4e0e\u539f\u59cb\u8868\u7a7a\u95f4\u76f8\u540c\u7684\u76ee\u5f55\u4f4d\u7f6e\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u7528\u6237\u9700\u8981\u5728\u542f\u52a8\u4f7f\u7528\u8fd9\u4e9b\u6570\u636e\u7684 PostgreSQL \u670d\u52a1\u5668\u4e4b\u524d\uff0c\u81ea\u884c\u89e3\u5f00\u6bcf\u4e2a tar \u6587\u4ef6\u3002\u5982\u679c\u5b58\u5728\u989d\u5916\u7684\u8868\u7a7a\u95f4\uff0c\u5fc5\u987b\u5c06\u5bf9\u5e94\u7684 tar \u6587\u4ef6\u89e3\u538b\u5230\u6b63\u786e\u4f4d\u7f6e\u3002\u6b64\u65f6\uff0c\u670d\u52a1\u5668\u4f1a\u6839\u636e base.tar \u4e2d tablespace_map \u6587\u4ef6\u7684\u5185\u5bb9\uff0c\u4e3a\u8fd9\u4e9b\u8868\u7a7a\u95f4\u521b\u5efa\u7b26\u53f7\u94fe\u63a5\u3002</p>\n<p lang=\"zh\">pg_basebackup \u53ef\u4e0e\u76f8\u540c\u6216\u66f4\u65e9\u4e3b\u8981\u7248\u672c\u7684\u670d\u52a1\u5668\u914d\u5408\u4f7f\u7528\uff0c\u6700\u4f4e\u652f\u6301 9.1\u3002\u4e0d\u8fc7\uff0cWAL \u6d41\u5f0f\u4f20\u8f93\u6a21\u5f0f\uff08-X stream\uff09\u53ea\u9002\u7528\u4e8e 9.3 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\uff0ctar \u683c\u5f0f\uff08--format=tar\uff09\u53ea\u9002\u7528\u4e8e 9.5 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6e90\u96c6\u7c07\u542f\u7528\u4e86\u6570\u636e\u6587\u4ef6\u7684\u7ec4\u6743\u9650\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u4fdd\u7559\u8fd9\u4e9b\u7ec4\u6743\u9650\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.9\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u8981\u4e3a\u670d\u52a1\u5668<code class=\"literal\">mydbserver</code>\u521b\u5efa\u4e00\u4e2a\u57fa\u7840\u5907\u4efd\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5230\u672c\u5730\u76ee\u5f55<code class=\"filename\">/usr/local/pgsql/data</code>\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -h mydbserver -D /usr/local/pgsql/data</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u672c\u5730\u670d\u52a1\u5668\u521b\u5efa\u4e00\u4e2a\u5907\u4efd\uff0c\u4e3a\u6bcf\u4e2a\u8868\u7a7a\u95f4\u5404\u751f\u6210\u4e00\u4e2a\u538b\u7f29\u7684 tar \u6587\u4ef6\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5728\u76ee\u5f55<code class=\"filename\">backup</code>\u4e2d\uff0c\u540c\u65f6\u5728\u8fd0\u884c\u671f\u95f4\u663e\u793a\u8fdb\u5ea6\u62a5\u544a\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup -Ft -z -P</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u4e00\u4e2a\u4ec5\u5305\u542b\u5355\u4e2a\u8868\u7a7a\u95f4\u7684\u672c\u5730\u6570\u636e\u5e93\u521b\u5efa\u5907\u4efd\uff0c\u5e76\u4f7f\u7528<span class=\"productname\">bzip2</span>\u8fdb\u884c\u538b\u7f29\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D - -Ft -X fetch | bzip2 &gt; backup.tar.bz2</code></strong>\n</pre>\n<p lang=\"zh\">\uff08\u5982\u679c\u8be5\u6570\u636e\u5e93\u4e2d\u6709\u591a\u4e2a\u8868\u7a7a\u95f4\uff0c\u6b64\u547d\u4ee4\u5c06\u5931\u8d25\u3002\uff09</p>\n<p lang=\"zh\">\u8981\u521b\u5efa\u4e00\u4e2a\u672c\u5730\u6570\u636e\u5e93\u7684\u5907\u4efd\uff0c\u5e76\u5c06\u4f4d\u4e8e<code class=\"filename\">/opt/ts</code>\u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230<code class=\"filename\">./backup/ts</code>\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup/data -T /opt/ts=$(pwd)/backup/ts</code></strong>\n</pre>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.10\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/14/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/14/progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING\" title=\"28.4.5.\u00a0Base Backup Progress Reporting\">Section\u00a028.4.5</a></span>\n</div>\n</div></div>", "manual_path": "app-pgbasebackup.html", "localization": {"status": "complete", "sources": [{"url": "/docs/14/app-pgbasebackup.html", "method": "same-major semantic node", "sha256": "df724e791cecd2e71109bd74451563b62e16036005fcca4adc81d50b5e7805b2", "language": "zh", "matched_nodes": ["#APP-PGBASEBACKUP/div[2]/p[1]", "#APP-PGBASEBACKUP/div[3]/h2[0]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[0]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[1]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[2]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[3]", "#APP-PGBASEBACKUP/div[4]/p[1]", "#APP-PGBASEBACKUP/div[4]/p[2]", "#APP-PGBASEBACKUP/div[4]/p[3]", "#APP-PGBASEBACKUP/div[4]/p[4]", "#APP-PGBASEBACKUP/div[4]/p[5]", "#APP-PGBASEBACKUP/div[4]/p[6]", "#APP-PGBASEBACKUP/div[4]/p[8]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/div[2]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/div[2]/dl[0]/dd[3]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/div[2]/dl[0]/dd[5]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/div[2]/dl[0]/dd[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/div[2]/dl[0]/dd[5]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[3]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[5]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[7]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[7]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[7]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[17]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[19]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[19]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[19]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[19]/p[3]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[21]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[23]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[23]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[25]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[27]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[27]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[27]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[29]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[29]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[7]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[7]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[7]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[8]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[8]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/p[3]", "#APP-PGBASEBACKUP/div[5]/p[5]", "#APP-PGBASEBACKUP/div[5]/p[7]", "#APP-PGBASEBACKUP/div[6]/h2[0]", "#APP-PGBASEBACKUP/div[6]/p[1]", "#APP-PGBASEBACKUP/div[6]/p[2]", "#APP-PGBASEBACKUP/div[7]/h2[0]", "#APP-PGBASEBACKUP/div[7]/p[1]", "#APP-PGBASEBACKUP/div[7]/p[2]", "#APP-PGBASEBACKUP/div[7]/p[3]", "#APP-PGBASEBACKUP/div[7]/p[6]", "#APP-PGBASEBACKUP/div[8]/h2[0]", "#APP-PGBASEBACKUP/div[8]/p[1]", "#APP-PGBASEBACKUP/div[8]/p[3]", "#APP-PGBASEBACKUP/div[8]/p[5]", "#APP-PGBASEBACKUP/div[8]/p[7]", "#APP-PGBASEBACKUP/div[8]/p[8]", "#APP-PGBASEBACKUP/div[9]/h2[0]"]}], "language": "zh", "original_text": {"/versions/14/description/0": "pg_basebackup \u2014 take a base backup of a PostgreSQL cluster", "/versions/14/facts/0/label": "Documented executable", "/versions/14/facts/1/label": "Executable version", "/versions/14/facts/2/label": "Reference inventory", "/versions/14/facts/2/value": "Client applications", "/versions/14/facts/3/label": "Option definition groups", "/versions/14/tables/0/title": "Documented options", "/versions/14/related/0/label": "libpq connection parameters", "/versions/14/tables/0/rows/0/summary": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty.", "/versions/14/tables/0/rows/1/summary": "Selects the format for the output. format can be one of the following:", "/versions/14/tables/0/rows/2/summary": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup.", "/versions/14/tables/0/rows/3/summary": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces.", "/versions/14/tables/0/rows/4/summary": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format.", "/versions/14/tables/0/rows/5/summary": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the log archive, thus making the output a completely standalone backup.", "/versions/14/tables/0/rows/6/summary": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "/versions/14/tables/0/rows/7/summary": "Enables gzip compression of tar file output, and specifies the compression level (0 through 9, 0 being no compression and 9 being best compression). Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "/versions/14/tables/0/rows/8/summary": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 26.3.3 ).", "/versions/14/tables/0/rows/9/summary": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists.", "/versions/14/tables/0/columns/0/label": "Option and arguments", "/versions/14/tables/0/columns/1/label": "Description", "/versions/14/tables/0/rows/10/summary": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used.", "/versions/14/tables/0/rows/11/summary": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging.", "/versions/14/tables/0/rows/12/summary": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.", "/versions/14/tables/0/rows/13/summary": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.", "/versions/14/tables/0/rows/14/summary": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second.", "/versions/14/tables/0/rows/15/summary": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby.", "/versions/14/tables/0/rows/16/summary": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.", "/versions/14/tables/0/rows/17/summary": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C .", "/versions/14/tables/0/rows/18/summary": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case.", "/versions/14/tables/0/rows/19/summary": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL .", "/versions/14/tables/0/rows/20/summary": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file.", "/versions/14/tables/0/rows/21/summary": "Prevents the creation of a temporary replication slot for the backup.", "/versions/14/tables/0/rows/22/summary": "Disables verification of checksums, if they are enabled on the server the base backup is taken from.", "/versions/14/tables/0/rows/23/summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "/versions/14/tables/0/rows/24/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "/versions/14/tables/0/rows/25/summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "/versions/14/tables/0/rows/26/summary": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds.", "/versions/14/tables/0/rows/27/summary": "Specifies the user name to connect as.", "/versions/14/tables/0/rows/28/summary": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/14/tables/0/rows/29/summary": "Forces pg_basebackup to prompt for a password before connecting to the source server.", "/versions/14/tables/0/rows/30/summary": "Prints the pg_basebackup version and exits.", "/versions/14/tables/0/rows/31/summary": "Shows help about pg_basebackup command line arguments, and exits."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "5516e81e8dd50b1c18ccadb05060fbbb3f074b370807cd2015778a44dfdb3a68"}, "comparison_data": {"options": [{"names": ["-D directory", "--pgdata= directory"], "signature": "-D directory --pgdata= directory", "description": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty. When the backup is in tar format, the target directory may be specified as - (dash), causing the tar file to be written to stdout . This option is required."}, {"names": ["-F format", "--format= format"], "signature": "-F format --format= format", "description": "Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the source server's data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory's contents will be written to a file named base.tar , and each other tablespace will be written to a separate tar file named after that tablespace's OID. If the target directory is specified as - (dash), the tar contents will be written to standard output, suitable for piping to (for example) gzip . This is only allowed if the cluster has no additional tablespaces and WAL streaming is not used."}, {"names": ["-R", "--write-recovery-conf"], "signature": "-R --write-recovery-conf", "description": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup. The postgresql.auto.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that streaming replication will use the same settings later on."}, {"names": ["-T olddir = newdir", "--tablespace-mapping= olddir = newdir"], "signature": "-T olddir = newdir --tablespace-mapping= olddir = newdir", "description": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected."}, {"names": ["--waldir= waldir"], "signature": "--waldir= waldir", "description": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format."}, {"names": ["-X method", "--wal-method= method"], "signature": "-X method --wal-method= method", "description": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the log archive, thus making the output a completely standalone backup. The following method s for collecting the write-ahead logs are supported: n none Don't include write-ahead logs in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the source server's wal_keep_size parameter to be set high enough that the required log data is not removed before the end of the backup. If the required log data has been recycled before it's time to transfer it, the backup will fail and be unusable. When tar format is used, the write-ahead log files will be included in the base.tar file. s stream Stream write-ahead log data while the backup is being taken. This method will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will require two replication connections not just one. As long as the client can keep up with the write-ahead log data, using this method requires no extra write-ahead logs to be saved on the source server. When tar format is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default."}, {"names": ["-z", "--gzip"], "signature": "-z --gzip", "description": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-Z level", "--compress= level"], "signature": "-Z level --compress= level", "description": "Enables gzip compression of tar file output, and specifies the compression level (0 through 9, 0 being no compression and 9 being best compression). Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-c fast|spread", "--checkpoint= fast|spread"], "signature": "-c fast|spread --checkpoint= fast|spread", "description": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 26.3.3 )."}, {"names": ["-C", "--create-slot"], "signature": "-C --create-slot", "description": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists."}, {"names": ["-l label", "--label= label"], "signature": "-l label --label= label", "description": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used."}, {"names": ["-n", "--no-clean"], "signature": "-n --no-clean", "description": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way."}, {"names": ["-N", "--no-sync"], "signature": "-N --no-sync", "description": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."}, {"names": ["-P", "--progress"], "signature": "-P --progress", "description": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL."}, {"names": ["-r rate", "--max-rate= rate"], "signature": "-r rate --max-rate= rate", "description": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch ."}, {"names": ["-S slotname", "--slot= slotname"], "signature": "-S slotname --slot= slotname", "description": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby. The specified replication slot has to exist unless the option -C is also used. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."}, {"names": ["--manifest-checksums= algorithm"], "signature": "--manifest-checksums= algorithm", "description": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C . If NONE is selected, the backup manifest will not contain any checksums. Otherwise, it will contain a checksum of each file in the backup using the specified algorithm. In addition, the manifest will always contain a SHA256 checksum of its own contents. The SHA algorithms are significantly more CPU-intensive than CRC32C , so selecting one of them may increase the time required to complete the backup. Using a SHA hash function provides a cryptographically secure digest of each file for users who wish to verify that the backup has not been tampered with, while the CRC32C algorithm provides a checksum that is much faster to calculate; it is good at catching errors due to accidental changes but is not resistant to malicious modifications. Note that, to be useful against an adversary who has access to the backup, the backup manifest would need to be stored securely elsewhere or otherwise verified not to have been modified since the backup was taken. pg_verifybackup can be used to check the integrity of a backup against the backup manifest."}, {"names": ["--manifest-force-encode"], "signature": "--manifest-force-encode", "description": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case."}, {"names": ["--no-estimate-size"], "signature": "--no-estimate-size", "description": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL . Without this option, the backup will start by enumerating the size of the entire database, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent. This option is useful to avoid such estimation time if it's too long. This option is not allowed when using --progress ."}, {"names": ["--no-manifest"], "signature": "--no-manifest", "description": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file."}, {"names": ["--no-slot"], "signature": "--no-slot", "description": "Prevents the creation of a temporary replication slot for the backup. By default, if log streaming is selected but no slot name is given with the -S option, then a temporary replication slot is created (if supported by the source server). The main purpose of this option is to allow taking a base backup when the server has no free replication slots. Using a replication slot is almost always preferred, because it prevents needed WAL from being removed by the server during the backup."}, {"names": ["--no-verify-checksums"], "signature": "--no-verify-checksums", "description": "Disables verification of checksums, if they are enabled on the server the base backup is taken from. By default, checksums are verified and checksum failures will result in a non-zero exit status. However, the base backup will not be removed in such a case, as if the --no-clean option had been used. Checksum verification failures will also be reported in the pg_stat_database view."}, {"names": ["-d connstr", "--dbname= connstr"], "signature": "-d connstr --dbname= connstr", "description": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. The option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, any database name in the connection string will be ignored."}, {"names": ["-h host", "--host= host"], "signature": "-h host --host= host", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-s interval", "--status-interval= interval"], "signature": "-s interval --status-interval= interval", "description": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Specifies the user name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Forces pg_basebackup to prompt for a password before connecting to the source server. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Prints the pg_basebackup version and exits."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Shows help about pg_basebackup command line arguments, and exits."}], "synopsis": ["pg_basebackup [ option ...]"], "environment": []}, "comparison_hash": "5e35443c9d7bf4da4f5379ce1dd021f75d1351076791f58aa9f545a2fe0cba95", "manual_language": "zh"}, "15": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_basebackup"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "15.19"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "33"}], "tables": [{"key": "options", "rows": [{"summary": "\u8bbe\u7f6e\u5199\u5165\u8f93\u51fa\u7684\u76ee\u6807\u76ee\u5f55\u3002\u5982\u679c\u8be5\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c pg_basebackup \u4f1a\u521b\u5efa\u5b83\uff08\u4ee5\u53ca\u6240\u6709\u7f3a\u5931\u7684\u7236\u76ee\u5f55\uff09\u3002\u5982\u679c\u8be5\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-D directory --pgdata= directory"}}, {"summary": "\u9009\u62e9\u8f93\u51fa\u683c\u5f0f\u3002 format \u53ef\u4ee5\u662f\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-F format --format= format"}}, {"summary": "\u521b\u5efa standby.signal \u6587\u4ef6\uff0c\u5e76\u5c06\u8fde\u63a5\u8bbe\u7f6e\u8ffd\u52a0\u5230\u76ee\u6807\u76ee\u5f55\u4e2d\u7684 postgresql.auto.conf \u6587\u4ef6\u4e2d\uff08\u5982\u679c\u4f7f\u7528 tar \u683c\u5f0f\uff0c\u5219\u8ffd\u52a0\u5230\u57fa\u7840\u5f52\u6863\u6587\u4ef6\u5185\uff09\u3002\u8fd9\u6837\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u5229\u7528\u5907\u4efd\u7ed3\u679c\u642d\u5efa\u5907\u5e93\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-R --write-recovery-conf"}}, {"summary": "\u6307\u793a\u670d\u52a1\u5668\u5c06\u57fa\u7840\u5907\u4efd\u653e\u5230\u54ea\u91cc\u3002\u9ed8\u8ba4\u76ee\u6807\u662f client \uff0c\u8868\u793a\u5907\u4efd\u5e94\u53d1\u9001\u5230\u8fd0\u884c pg_basebackup \u7684\u90a3\u53f0\u673a\u5668\u3002\u5982\u679c\u76ee\u6807\u6539\u4e3a server:/some/path \uff0c\u5219\u5907\u4efd\u4f1a\u5b58\u50a8\u5728\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684 /some/path \u76ee\u5f55\u4e2d\u3002\u5c06\u5907\u4efd\u5b58\u50a8\u5728\u670d\u52a1\u5668\u4e0a\u9700\u8981\u8d85\u7ea7\u7528\u6237\u6743\u9650\uff0c\u6216\u62e5\u6709 pg_write_server_files \u89d2\u8272\u7684\u6743\u9650\u3002\u5982\u679c\u76ee\u6807\u8bbe\u7f6e\u4e3a blackhole \uff0c\u5219\u5185\u5bb9\u4f1a\u88ab\u4e22\u5f03\uff0c\u4e0d\u4f1a\u5b58\u50a8\u5230\u4efb\u4f55\u5730\u65b9\u3002\u8fd9\u53ea\u5e94\u7528\u4e8e\u6d4b\u8bd5\u76ee\u7684\uff0c\u56e0\u4e3a\u6700\u7ec8\u4e0d\u4f1a\u5f97\u5230\u5b9e\u9645\u5907\u4efd\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-t target --target= target"}}, {"summary": "\u5728\u5907\u4efd\u671f\u95f4\uff0c\u5c06\u76ee\u5f55 olddir \u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230 newdir \u3002\u8981\u4f7f\u6b64\u9009\u9879\u751f\u6548\uff0c olddir \u5fc5\u987b\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u5b9a\u4e49\u7684\u8be5\u8868\u7a7a\u95f4\u8def\u5f84\u5b8c\u5168\u4e00\u81f4\u3002\uff08\u4f46\u5982\u679c\u6e90\u670d\u52a1\u5668\u4e0a\u5728 olddir \u4e2d\u6ca1\u6709\u8868\u7a7a\u95f4\uff0c\u4e5f\u4e0d\u7b97\u9519\u8bef\u3002\uff09\u4e0e\u6b64\u540c\u65f6\uff0c newdir \u662f\u63a5\u6536\u4e3b\u673a\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u4e00\u4e2a\u76ee\u5f55\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c newdir \u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002 olddir \u548c newdir \u90fd\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u5982\u679c\u4efb\u4e00\u8def\u5f84\u4e2d\u9700\u8981\u5305\u542b\u7b49\u53f7\uff08 = \uff09\uff0c\u8bf7\u5728\u5176\u524d\u9762\u52a0\u4e0a\u53cd\u659c\u6760\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u4ee5\u5904\u7406\u591a\u4e2a\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-T olddir = newdir --tablespace-mapping= olddir = newdir"}}, {"summary": "\u8bbe\u7f6e\u5199\u5165 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cWAL \u6587\u4ef6\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u7684 pg_wal \u5b50\u76ee\u5f55\u4e2d\uff0c\u4f46\u6b64\u9009\u9879\u53ef\u7528\u4e8e\u5c06\u5176\u653e\u5728\u5176\u4ed6\u4f4d\u7f6e\u3002 waldir \u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c waldir \u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002\u53ea\u6709\u5f53\u5907\u4efd\u91c7\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u624d\u80fd\u6307\u5b9a\u6b64\u9009\u9879\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "--waldir= waldir"}}, {"summary": "\u5728\u5907\u4efd\u4e2d\u5305\u542b\u6240\u9700\u7684 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u3002\u8fd9\u5c06\u5305\u62ec\u5907\u4efd\u671f\u95f4\u751f\u6210\u7684\u6240\u6709\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u9664\u975e\u6307\u5b9a\u65b9\u6cd5 none \uff0c\u5426\u5219\u5c31\u53ef\u4ee5\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u542f\u52a8 postmaster\uff0c\u800c\u65e0\u9700\u67e5\u9605 WAL \u5f52\u6863\uff0c\u4ece\u800c\u4f7f\u8f93\u51fa\u6210\u4e3a\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u5907\u4efd\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-X method --wal-method= method"}}, {"summary": "\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u4f7f\u7528\u9ed8\u8ba4\u538b\u7f29\u7ea7\u522b\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0 .gz \u540e\u7f00\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-z --gzip"}}, {"summary": "\u8bf7\u6c42\u5bf9\u5907\u4efd\u8fdb\u884c\u538b\u7f29\u3002\u5982\u679c\u5305\u542b client \u6216 server \uff0c\u5219\u6307\u5b9a\u538b\u7f29\u6267\u884c\u7684\u4f4d\u7f6e\u3002\u5728\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4f1a\u51cf\u5c11\u4f20\u8f93\u5e26\u5bbd\u5360\u7528\uff0c\u4f46\u4f1a\u589e\u52a0\u670d\u52a1\u5668 CPU \u6d88\u8017\u3002\u9ed8\u8ba4\u503c\u662f client \uff0c\u4f46\u4f7f\u7528 --target \u65f6\u9664\u5916\uff1b\u6b64\u65f6\u5907\u4efd\u4e0d\u4f1a\u53d1\u9001\u5230\u5ba2\u6237\u7aef\uff0c\u56e0\u6b64\u53ea\u6709\u670d\u52a1\u5668\u7aef\u538b\u7f29\u624d\u6709\u610f\u4e49\u3002\u4f7f\u7528\u9ed8\u8ba4\u7684 -Xstream \u65f6\uff0c\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4e0d\u4f1a\u5e94\u7528\u4e8e WAL\u3002\u82e5\u8981\u538b\u7f29 WAL\uff0c\u8bf7\u4f7f\u7528\u5ba2\u6237\u7aef\u538b\u7f29\uff0c\u6216\u8005\u6307\u5b9a -Xfetch \u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]"}}, {"summary": "\u5c06\u68c0\u67e5\u70b9\u6a21\u5f0f\u8bbe\u7f6e\u4e3a fast\uff08\u7acb\u5373\uff09\u6216 spread\uff08\u9ed8\u8ba4\uff09\uff08\u89c1 \u7b2c 26.3.3 \u8282 \uff09\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-c {fast|spread} --checkpoint={fast|spread}"}}, {"summary": "\u6307\u5b9a\u5728\u5f00\u59cb\u5907\u4efd\u4e4b\u524d\uff0c\u5e94\u521b\u5efa\u7531 --slot \u9009\u9879\u6307\u5b9a\u540d\u79f0\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u8be5\u69fd\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u9519\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-C --create-slot"}}, {"summary": "\u8bbe\u7f6e\u5907\u4efd\u6807\u7b7e\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u503c \u201c pg_basebackup base backup \u201d \u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-l label --label= label"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53 pg_basebackup \u56e0\u9519\u8bef\u4e2d\u6b62\u65f6\uff0c\u5b83\u4f1a\u5220\u9664\u5728\u53d1\u73b0\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u76ee\u5f55\uff08\u4f8b\u5982\u76ee\u6807\u76ee\u5f55\u548c\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\uff09\u3002\u6b64\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u5f88\u6709\u5e2e\u52a9\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-n --no-clean"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_basebackup \u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u88ab\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f1a\u4f7f pg_basebackup \u4e0d\u7ecf\u7b49\u5f85\u5c31\u76f4\u63a5\u8fd4\u56de\uff0c\u56e0\u6b64\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u968f\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u57fa\u7840\u5907\u4efd\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u5408\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-N --no-sync"}}, {"summary": "\u542f\u7528\u8fdb\u5ea6\u62a5\u544a\u3002\u6253\u5f00\u6b64\u9009\u9879\u540e\uff0c\u4f1a\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u7ed9\u51fa\u4e00\u4e2a\u8fd1\u4f3c\u7684\u8fdb\u5ea6\u62a5\u544a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u53d1\u751f\u53d8\u5316\uff0c\u56e0\u6b64\u8fd9\u53ea\u662f\u8fd1\u4f3c\u503c\uff0c\u6700\u7ec8\u672a\u5fc5\u6070\u597d\u7ed3\u675f\u5728 100% \u3002\u7279\u522b\u662f\u5f53\u5907\u4efd\u4e2d\u5305\u542b WAL \u65f6\uff0c\u603b\u6570\u636e\u91cf\u65e0\u6cd5\u9884\u5148\u4f30\u8ba1\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u65e6\u8fdb\u5ea6\u8d85\u8fc7\u4e0d\u542b WAL \u65f6\u7684\u603b\u4f30\u8ba1\u503c\uff0c\u4f30\u8ba1\u76ee\u6807\u5927\u5c0f\u5c31\u4f1a\u7ee7\u7eed\u589e\u52a0\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-P --progress"}}, {"summary": "\u8bbe\u7f6e\u4ece\u6e90\u670d\u52a1\u5668\u6536\u96c6\u6570\u636e\u65f6\u5141\u8bb8\u7684\u6700\u5927\u4f20\u8f93\u901f\u7387\u3002\u8fd9\u6709\u52a9\u4e8e\u9650\u5236 pg_basebackup \u5bf9\u670d\u52a1\u5668\u7684\u5f71\u54cd\u3002\u53d6\u503c\u5355\u4f4d\u4e3a\u6bcf\u79d2\u5343\u5b57\u8282\u3002\u4f7f\u7528\u540e\u7f00 M \u8868\u793a\u6bcf\u79d2\u5146\u5b57\u8282\u3002\u4e5f\u63a5\u53d7\u540e\u7f00 k \uff0c\u4f46\u6ca1\u6709\u5b9e\u9645\u5f71\u54cd\u3002\u6709\u6548\u53d6\u503c\u8303\u56f4\u4e3a\u6bcf\u79d2 32 \u5343\u5b57\u8282\u5230\u6bcf\u79d2 1024 \u5146\u5b57\u8282\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-r rate --max-rate= rate"}}, {"summary": "\u6b64\u9009\u9879\u53ea\u80fd\u4e0e -X stream \u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u4f1a\u4f7f WAL \u6d41\u5f0f\u4f20\u8f93\u4f7f\u7528\u6307\u5b9a\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u6b64\u57fa\u7840\u5907\u4efd\u6253\u7b97\u7528\u4f5c\u4f7f\u7528\u590d\u5236\u69fd\u7684\u6d41\u590d\u5236\u5907\u5e93\uff0c\u90a3\u4e48\u8be5\u5907\u5e93\u5e94\u5c06\u540c\u4e00\u4e2a\u590d\u5236\u69fd\u540d\u79f0\u7528\u4f5c primary_slot_name \u7684\u503c\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u4e3b\u5e93\u5728\u57fa\u7840\u5907\u4efd\u7ed3\u675f\u4e0e\u65b0\u5907\u5e93\u5f00\u59cb\u6d41\u590d\u5236\u4e4b\u95f4\u7684\u8fd9\u6bb5\u65f6\u95f4\u5185\uff0c\u4e0d\u4f1a\u79fb\u9664\u4efb\u4f55\u5fc5\u9700\u7684 WAL \u6570\u636e\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-S slotname --slot= slotname"}}, {"summary": "\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\u3002\u5b83\u4f1a\u5728\u542f\u52a8\u548c\u5173\u95ed\u8fc7\u7a0b\u4e2d\u8f93\u51fa\u4e00\u4e9b\u989d\u5916\u6b65\u9aa4\uff1b\u5982\u679c\u540c\u65f6\u542f\u7528\u4e86\u8fdb\u5ea6\u62a5\u544a\uff0c\u8fd8\u4f1a\u663e\u793a\u5f53\u524d\u6b63\u5728\u5904\u7406\u7684\u786e\u5207\u6587\u4ef6\u540d\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-v --verbose"}}, {"summary": "\u6307\u5b9a\u5e94\u7528\u5230\u5907\u4efd\u6e05\u5355\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u7684\u6821\u9a8c\u548c\u7b97\u6cd5\u3002\u76ee\u524d\u53ef\u7528\u7684\u7b97\u6cd5\u6709 NONE \u3001 CRC32C \u3001 SHA224 \u3001 SHA256 \u3001 SHA384 \u548c SHA512 \u3002\u9ed8\u8ba4\u503c\u4e3a CRC32C \u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "--manifest-checksums= algorithm"}}, {"summary": "\u5f3a\u5236\u5c06\u5907\u4efd\u6e05\u5355\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u540d\u7f16\u7801\u4e3a\u5341\u516d\u8fdb\u5236\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u5bf9\u975e UTF8 \u6587\u4ef6\u540d\u8fdb\u884c\u5341\u516d\u8fdb\u5236\u7f16\u7801\u3002\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u8bfb\u53d6\u5907\u4efd\u6e05\u5355\u6587\u4ef6\u7684\u5de5\u5177\u662f\u5426\u80fd\u6b63\u786e\u5904\u7406\u8fd9\u79cd\u60c5\u51b5\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "--manifest-force-encode"}}, {"summary": "\u7981\u6b62\u670d\u52a1\u5668\u4f30\u7b97\u5c06\u8981\u6d41\u5f0f\u4f20\u8f93\u7684\u5907\u4efd\u6570\u636e\u603b\u91cf\uff0c\u56e0\u6b64 pg_stat_progress_basebackup \u89c6\u56fe\u4e2d\u7684 backup_total \u5217\u59cb\u7ec8\u4e3a NULL\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "--no-estimate-size"}}, {"summary": "\u7981\u6b62\u751f\u6210\u5907\u4efd\u6e05\u5355\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u670d\u52a1\u5668\u5c06\u751f\u6210\u5e76\u53d1\u9001\u4e00\u4e2a\u5907\u4efd\u6e05\u5355\uff0c\u53ef\u4f7f\u7528 pg_verifybackup \u8fdb\u884c\u9a8c\u8bc1\u3002\u8be5\u6e05\u5355\u5217\u51fa\u4e86\u5907\u4efd\u4e2d\u7684\u6bcf\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u4e0d\u5305\u62ec\u53ef\u80fd\u5305\u542b\u5728\u5176\u4e2d\u7684\u4efb\u4f55 WAL \u6587\u4ef6\u3002\u5b83\u8fd8\u4f1a\u4fdd\u5b58\u6bcf\u4e2a\u6587\u4ef6\u7684\u5927\u5c0f\u3001\u6700\u540e\u4fee\u6539\u65f6\u95f4\u4ee5\u53ca\u53ef\u9009\u7684\u6821\u9a8c\u548c\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "--no-manifest"}}, {"summary": "\u9632\u6b62\u4e3a\u5907\u4efd\u521b\u5efa\u4e34\u65f6\u590d\u5236\u69fd\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "--no-slot"}}, {"summary": "\u5982\u679c\u83b7\u53d6\u57fa\u7840\u5907\u4efd\u7684\u670d\u52a1\u5668\u542f\u7528\u4e86\u6821\u9a8c\u548c\uff0c\u5219\u7981\u7528\u5bf9\u8fd9\u4e9b\u6821\u9a8c\u548c\u7684\u9a8c\u8bc1\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "--no-verify-checksums"}}, {"summary": "\u4ee5 \u8fde\u63a5\u5b57\u7b26\u4e32 \u7684\u5f62\u5f0f\u6307\u5b9a\u7528\u4e8e\u8fde\u63a5\u670d\u52a1\u5668\u7684\u53c2\u6570\uff1b\u8fd9\u4e9b\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u76f8\u4e92\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-d connstr --dbname= connstr"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGHOST \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff1b\u5426\u5219\u4f1a\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-h host --host= host"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u6240\u4f7f\u7528\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u4e2d\u7684\u503c\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u786e\u5b9a\u7684\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-p port --port= port"}}, {"summary": "\u6307\u5b9a\u53d1\u9001\u56de\u6e90\u670d\u52a1\u5668\u7684\u72b6\u6001\u5305\u4e4b\u95f4\u76f8\u9694\u7684\u79d2\u6570\u3002\u8f83\u5c0f\u7684\u503c\u53ef\u4ee5\u8ba9\u670d\u52a1\u5668\u7aef\u5bf9\u5907\u4efd\u8fdb\u5ea6\u7684\u76d1\u63a7\u66f4\u7cbe\u786e\u3002\u503c\u4e3a\u96f6\u65f6\u4f1a\u5b8c\u5168\u7981\u7528\u5468\u671f\u6027\u72b6\u6001\u66f4\u65b0\uff0c\u4e0d\u8fc7\u5f53\u670d\u52a1\u5668\u8bf7\u6c42\u65f6\u4ecd\u4f1a\u53d1\u9001\u66f4\u65b0\uff0c\u4ee5\u907f\u514d\u56e0\u8d85\u65f6\u800c\u65ad\u5f00\u8fde\u63a5\u3002\u9ed8\u8ba4\u503c\u662f 10 \u79d2\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-s interval --status-interval= interval"}}, {"summary": "\u6307\u5b9a\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-U username --username= username"}}, {"summary": "\u7981\u6b62\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\uff08\u4f8b\u5982 .pgpass \u6587\u4ef6\uff09\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u6b64\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u79cd\u573a\u666f\u4e0b\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 pg_basebackup \u5728\u8fde\u63a5\u6e90\u670d\u52a1\u5668\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-W --password"}}, {"summary": "\u8f93\u51fa pg_basebackup \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-V --version"}}, {"summary": "\u663e\u793a pg_basebackup \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/15/app-pgbasebackup.html", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}], "options": [{"names": ["-D directory", "--pgdata= directory"], "summary": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty.", "signature": "-D directory --pgdata= directory", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty. When the backup is in tar format, the target directory may be specified as - (dash), causing the tar file to be written to stdout . This option is required."}, {"names": ["-F format", "--format= format"], "summary": "Selects the format for the output. format can be one of the following:", "signature": "-F format --format= format", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the source server's data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory's contents will be written to a file named base.tar , and each other tablespace will be written to a separate tar file named after that tablespace's OID. If the target directory is specified as - (dash), the tar contents will be written to standard output, suitable for piping to (for example) gzip . This is only allowed if the cluster has no additional tablespaces and WAL streaming is not used."}, {"names": ["-R", "--write-recovery-conf"], "summary": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup.", "signature": "-R --write-recovery-conf", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup. The postgresql.auto.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that streaming replication will use the same settings later on."}, {"names": ["-t target", "--target= target"], "summary": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup.", "signature": "-t target --target= target", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup. Since WAL streaming is implemented by pg_basebackup rather than by the server, this option cannot be used together with -Xstream . Since that is the default, when this option is specified, you must also specify either -Xfetch or -Xnone ."}, {"names": ["-T olddir = newdir", "--tablespace-mapping= olddir = newdir"], "summary": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces.", "signature": "-T olddir = newdir --tablespace-mapping= olddir = newdir", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected."}, {"names": ["--waldir= waldir"], "summary": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format.", "signature": "--waldir= waldir", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format."}, {"names": ["-X method", "--wal-method= method"], "summary": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the log archive, thus making the output a completely standalone backup.", "signature": "-X method --wal-method= method", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the log archive, thus making the output a completely standalone backup. The following method s for collecting the write-ahead logs are supported: n none Don't include write-ahead logs in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the source server's wal_keep_size parameter to be set high enough that the required log data is not removed before the end of the backup. If the required log data has been recycled before it's time to transfer it, the backup will fail and be unusable. When tar format is used, the write-ahead log files will be included in the base.tar file. s stream Stream write-ahead log data while the backup is being taken. This method will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will require two replication connections not just one. As long as the client can keep up with the write-ahead log data, using this method requires no extra write-ahead logs to be saved on the source server. When tar format is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default."}, {"names": ["-z", "--gzip"], "summary": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "signature": "-z --gzip", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-Z level", "-Z [{client|server}-] method [: detail ]", "--compress= level", "--compress=[{client|server}-] method [: detail ]"], "summary": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch .", "signature": "-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch . The compression method can be set to gzip , lz4 , zstd , or none for no compression. A compression detail string can optionally be specified. If the detail string is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form keyword or keyword=value . Currently, the supported keywords are level and workers . If no compression level is specified, the default compression level will be used. If only a level is specified without mentioning an algorithm, gzip compression will be used if the level is greater than 0, and no compression will be used if the level is 0. When the tar format is used with gzip , lz4 , or zstd , the suffix .gz , .lz4 , or .zst , respectively, will be automatically added to all tar filenames. When the plain format is used, client-side compression may not be specified, but it is still possible to request server-side compression. If this is done, the server will compress the backup for transmission, and the client will decompress and extract it. When this option is used in combination with -Xstream , pg_wal.tar will be compressed using gzip if client-side gzip compression is selected, but will not be compressed if any other compression algorithm is selected, or if server-side compression is selected."}, {"names": ["-c {fast|spread}", "--checkpoint={fast|spread}"], "summary": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 26.3.3 ).", "signature": "-c {fast|spread} --checkpoint={fast|spread}", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 26.3.3 )."}, {"names": ["-C", "--create-slot"], "summary": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists.", "signature": "-C --create-slot", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists."}, {"names": ["-l label", "--label= label"], "summary": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used.", "signature": "-l label --label= label", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used."}, {"names": ["-n", "--no-clean"], "summary": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging.", "signature": "-n --no-clean", "source_url": "/docs/15/app-pgbasebackup.html", "description": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way."}, {"names": ["-N", "--no-sync"], "summary": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.", "signature": "-N --no-sync", "source_url": "/docs/15/app-pgbasebackup.html", "description": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."}, {"names": ["-P", "--progress"], "summary": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.", "signature": "-P --progress", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL."}, {"names": ["-r rate", "--max-rate= rate"], "summary": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second.", "signature": "-r rate --max-rate= rate", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch ."}, {"names": ["-S slotname", "--slot= slotname"], "summary": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby.", "signature": "-S slotname --slot= slotname", "source_url": "/docs/15/app-pgbasebackup.html", "description": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby. The specified replication slot has to exist unless the option -C is also used. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming."}, {"names": ["-v", "--verbose"], "summary": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.", "signature": "-v --verbose", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."}, {"names": ["--manifest-checksums= algorithm"], "summary": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C .", "signature": "--manifest-checksums= algorithm", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C . If NONE is selected, the backup manifest will not contain any checksums. Otherwise, it will contain a checksum of each file in the backup using the specified algorithm. In addition, the manifest will always contain a SHA256 checksum of its own contents. The SHA algorithms are significantly more CPU-intensive than CRC32C , so selecting one of them may increase the time required to complete the backup. Using a SHA hash function provides a cryptographically secure digest of each file for users who wish to verify that the backup has not been tampered with, while the CRC32C algorithm provides a checksum that is much faster to calculate; it is good at catching errors due to accidental changes but is not resistant to malicious modifications. Note that, to be useful against an adversary who has access to the backup, the backup manifest would need to be stored securely elsewhere or otherwise verified not to have been modified since the backup was taken. pg_verifybackup can be used to check the integrity of a backup against the backup manifest."}, {"names": ["--manifest-force-encode"], "summary": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case.", "signature": "--manifest-force-encode", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case."}, {"names": ["--no-estimate-size"], "summary": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL .", "signature": "--no-estimate-size", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL . Without this option, the backup will start by enumerating the size of the entire database, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent. This option is useful to avoid such estimation time if it's too long. This option is not allowed when using --progress ."}, {"names": ["--no-manifest"], "summary": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file.", "signature": "--no-manifest", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file."}, {"names": ["--no-slot"], "summary": "Prevents the creation of a temporary replication slot for the backup.", "signature": "--no-slot", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Prevents the creation of a temporary replication slot for the backup. By default, if log streaming is selected but no slot name is given with the -S option, then a temporary replication slot is created (if supported by the source server). The main purpose of this option is to allow taking a base backup when the server has no free replication slots. Using a replication slot is almost always preferred, because it prevents needed WAL from being removed by the server during the backup."}, {"names": ["--no-verify-checksums"], "summary": "Disables verification of checksums, if they are enabled on the server the base backup is taken from.", "signature": "--no-verify-checksums", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Disables verification of checksums, if they are enabled on the server the base backup is taken from. By default, checksums are verified and checksum failures will result in a non-zero exit status. However, the base backup will not be removed in such a case, as if the --no-clean option had been used. Checksum verification failures will also be reported in the pg_stat_database view."}, {"names": ["-d connstr", "--dbname= connstr"], "summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": "-d connstr --dbname= connstr", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. The option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, any database name in the connection string will be ignored."}, {"names": ["-h host", "--host= host"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "signature": "-h host --host= host", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "signature": "-p port --port= port", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-s interval", "--status-interval= interval"], "summary": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds.", "signature": "-s interval --status-interval= interval", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds."}, {"names": ["-U username", "--username= username"], "summary": "Specifies the user name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Specifies the user name to connect as."}, {"names": ["-w", "--no-password"], "summary": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "summary": "Forces pg_basebackup to prompt for a password before connecting to the source server.", "signature": "-W --password", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Forces pg_basebackup to prompt for a password before connecting to the source server. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["-V", "--version"], "summary": "Prints the pg_basebackup version and exits.", "signature": "-V --version", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Prints the pg_basebackup version and exits."}, {"names": ["-?", "--help"], "summary": "Shows help about pg_basebackup command line arguments, and exits.", "signature": "-? --help", "source_url": "/docs/15/app-pgbasebackup.html", "description": "Shows help about pg_basebackup command line arguments, and exits."}], "related": [{"url": "/wiki/conn/?v=15", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v15.19/postgresql-15.19.tar.bz2", "label": "15.19", "major": "15", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/15/postgresql-15-A4.pdf", "bytes": 14609140, "pages": 2987, "sha256": "66228564a4d16efb47d6a914085716ecfe22ca1566db56bc7c3d82f790646d72", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/15/postgresql-15-US.pdf", "bytes": 14495690, "pages": 3153, "sha256": "645a498c2390d47a6223ec74770631185807a19c484edb0fc5a295d9f460bc02", "built_at": "2026-09-26"}}, "tree": "15", "index": "index.html", "major": "15", "pages": 1168, "release": "15.19", "source_url": "https://ftp.postgresql.org/pub/source/v15.19/postgresql-15.19.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "e1a64a87a46b825b88c082e4518161a47aab53c45694964f8ba1df28f7859f89"}, "revision": "6af958c6520151fc7697d56e0616b03fb00522c4568158674d452ae0644ba545", "evidence_kind": "English manual and source declarations", "source_sha256": "e1a64a87a46b825b88c082e4518161a47aab53c45694964f8ba1df28f7859f89"}, "sources": [{"url": "https://pg.center/docs/15/app-pgbasebackup.html", "file": "app-pgbasebackup.html", "label": "15.19 English manual \u00b7 app-pgbasebackup.html", "anchor": "", "sha256": "0363f172e413c5ea3f20ba9ae3420e514ace28021d3c3cd67297e348b20b107f", "language": "en", "original_url": "/docs/15/app-pgbasebackup.html"}, {"url": "https://pg.center/docs/15/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "015b2ea2bd205946a55a1b837e735570631bac831c92074a6bf58444f9a3cb98", "language": "en", "original_url": "/docs/15/reference-client.html"}], "sections": [], "synopsis": ["pg_basebackup [ option ...]"], "signature": "pg_basebackup [ option ...]", "description": ["pg_basebackup \u2014 \u83b7\u53d6 PostgreSQL \u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd"], "environment": [], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGBASEBACKUP\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_basebackup</span></span></h2>\n<p lang=\"zh\">pg_basebackup \u2014 \u83b7\u53d6<span class=\"productname\">PostgreSQL</span>\u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.10.4.1\"><code class=\"command\">pg_basebackup</code> [<em class=\"replaceable\"><code>option</code></em>...]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u7528\u4e8e\u83b7\u53d6\u6b63\u5728\u8fd0\u884c\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd\u3002\u5907\u4efd\u8fc7\u7a0b\u4e0d\u4f1a\u5f71\u54cd\u6570\u636e\u5e93\u7684\u5176\u4ed6\u5ba2\u6237\u7aef\uff0c\u5e76\u4e14\u8be5\u5907\u4efd\u65e2\u53ef\u7528\u4e8e\u65f6\u95f4\u70b9\u6062\u590d\uff08\u89c1<a class=\"xref\" href=\"/docs/15/continuous-archiving.html\" title=\"26.3.\u00a0\u6301\u7eed\u5f52\u6863\u548c\u65f6\u95f4\u70b9\u6062\u590d\uff08PITR\uff09\">\u7b2c\u00a026.3\u00a0\u8282</a>\uff09\uff0c\u4e5f\u53ef\u7528\u4f5c\u65e5\u5fd7\u4f20\u9001\u6216\u6d41\u590d\u5236\u5907\u5e93\u7684\u8d77\u70b9\uff08\u89c1<a class=\"xref\" href=\"/docs/15/warm-standby.html\" title=\"27.2.\u00a0\u65e5\u5fd7\u4f20\u9001\u5907\u5e93\">\u7b2c\u00a027.2\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u4f1a\u7cbe\u786e\u590d\u5236\u6570\u636e\u5e93\u96c6\u7c07\u7684\u6587\u4ef6\uff0c\u540c\u65f6\u786e\u4fdd\u670d\u52a1\u5668\u81ea\u52a8\u8fdb\u5165\u548c\u9000\u51fa\u5907\u4efd\u6a21\u5f0f\u3002\u5907\u4efd\u59cb\u7ec8\u9488\u5bf9\u6574\u4e2a\u6570\u636e\u5e93\u96c6\u7c07\uff1b\u4e0d\u53ef\u80fd\u53ea\u5907\u4efd\u5355\u4e2a\u6570\u636e\u5e93\u6216\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u5bf9\u4e8e\u9009\u62e9\u6027\u5907\u4efd\uff0c\u5fc5\u987b\u4f7f\u7528\u8bf8\u5982<a class=\"xref\" href=\"/docs/15/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>\u4e4b\u7c7b\u7684\u5176\u4ed6\u5de5\u5177\u3002</p>\n<p lang=\"zh\">\u5907\u4efd\u662f\u901a\u8fc7\u4e00\u4e2a\u4f7f\u7528\u590d\u5236\u534f\u8bae\u7684\u5e38\u89c4<span class=\"productname\">PostgreSQL</span>\u8fde\u63a5\u8fdb\u884c\u7684\u3002\u5efa\u7acb\u8be5\u8fde\u63a5\u6240\u4f7f\u7528\u7684\u7528\u6237 ID \u5fc5\u987b\u5177\u6709<code class=\"literal\">REPLICATION</code>\u6743\u9650\uff08\u89c1<a class=\"xref\" href=\"/docs/15/role-attributes.html\" title=\"22.2.\u00a0\u89d2\u8272\u5c5e\u6027\">\u7b2c\u00a022.2\u00a0\u8282</a>\uff09\uff0c\u6216\u8005\u662f\u8d85\u7ea7\u7528\u6237\uff0c\u5e76\u4e14<a class=\"link\" href=\"/docs/15/client-authentication.html#AUTH-PG-HBA-CONF\" title=\"21.1.\u00a0pg_hba.conf \u6587\u4ef6\"><code class=\"filename\">pg_hba.conf</code></a>\u5fc5\u987b\u5141\u8bb8\u8be5\u590d\u5236\u8fde\u63a5\u3002\u670d\u52a1\u5668\u8fd8\u5fc5\u987b\u5c06<a class=\"xref\" href=\"/docs/15/runtime-config-replication.html#GUC-MAX-WAL-SENDERS\">max_wal_senders</a>\u8bbe\u7f6e\u5f97\u8db3\u591f\u9ad8\uff0c\u4ee5\u4fbf\u81f3\u5c11\u63d0\u4f9b\u4e00\u4e2a\u7528\u4e8e\u5907\u4efd\u7684 WAL \u53d1\u9001\u8fdb\u7a0b\uff0c\u5e76\u5728\u4f7f\u7528 WAL \u6d41\u5f0f\u4f20\u8f93\u65f6\u518d\u63d0\u4f9b\u4e00\u4e2a WAL \u53d1\u9001\u8fdb\u7a0b\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u540c\u65f6\u8fd0\u884c\u591a\u4e2a<code class=\"command\">pg_basebackup</code>\uff0c\u4f46\u4ece\u6027\u80fd\u89d2\u5ea6\u6765\u770b\uff0c\u901a\u5e38\u6700\u597d\u53ea\u6267\u884c\u4e00\u6b21\u5907\u4efd\uff0c\u7136\u540e\u590d\u5236\u5176\u7ed3\u679c\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u4e0d\u4ec5\u53ef\u4ee5\u4ece\u4e3b\u5e93\u83b7\u53d6\u57fa\u7840\u5907\u4efd\uff0c\u4e5f\u53ef\u4ee5\u4ece\u5907\u5e93\u83b7\u53d6\u3002\u8981\u4ece\u5907\u5e93\u83b7\u53d6\u5907\u4efd\uff0c\u9700\u8981\u5c06\u5907\u5e93\u914d\u7f6e\u4e3a\u80fd\u591f\u63a5\u53d7\u590d\u5236\u8fde\u63a5\uff08\u5373\u8bbe\u7f6e<code class=\"varname\">max_wal_senders</code>\u548c<a class=\"xref\" href=\"/docs/15/runtime-config-replication.html#GUC-HOT-STANDBY\">hot_standby</a>\uff0c\u5e76\u9002\u5f53\u5730\u914d\u7f6e\u5176<code class=\"filename\">pg_hba.conf</code>\uff09\u3002\u8fd8\u9700\u8981\u5728\u4e3b\u5e93\u4e0a\u542f\u7528<a class=\"xref\" href=\"/docs/15/runtime-config-wal.html#GUC-FULL-PAGE-WRITES\">full_page_writes</a>\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u4ece\u5907\u5e93\u83b7\u53d6\u5907\u4efd\u5b58\u5728\u4e00\u4e9b\u9650\u5236\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5907\u4efd\u5386\u53f2\u6587\u4ef6\u4e0d\u4f1a\u5728\u88ab\u5907\u4efd\u7684\u6570\u636e\u5e93\u96c6\u7c07\u4e2d\u521b\u5efa\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">pg_basebackup</span>\u65e0\u6cd5\u5f3a\u5236\u5907\u5e93\u5728\u5907\u4efd\u7ed3\u675f\u65f6\u5207\u6362\u5230\u65b0\u7684 WAL \u6587\u4ef6\u3002\u5f53\u4f7f\u7528<code class=\"literal\">-X none</code>\u65f6\uff0c\u5982\u679c\u4e3b\u5e93\u4e0a\u7684\u5199\u5165\u6d3b\u52a8\u8f83\u5c11\uff0c<span class=\"application\">pg_basebackup</span>\u53ef\u80fd\u9700\u8981\u957f\u65f6\u95f4\u7b49\u5f85\uff0c\u76f4\u5230\u5907\u4efd\u6240\u9700\u7684\u6700\u540e\u4e00\u4e2a WAL \u6587\u4ef6\u88ab\u5207\u6362\u5e76\u5f52\u6863\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5728\u4e3b\u5e93\u4e0a\u8fd0\u884c<code class=\"function\">pg_switch_wal</code>\uff0c\u4ee5\u7acb\u5373\u89e6\u53d1 WAL \u6587\u4ef6\u5207\u6362\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5982\u679c\u5907\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u88ab\u63d0\u5347\u4e3a\u4e3b\u5e93\uff0c\u5219\u5907\u4efd\u4f1a\u5931\u8d25\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5907\u4efd\u6240\u9700\u7684\u6240\u6709 WAL \u8bb0\u5f55\u90fd\u5fc5\u987b\u5305\u542b\u8db3\u591f\u7684\u6574\u9875\u5199\u5165\uff0c\u56e0\u6b64\u5fc5\u987b\u5728\u4e3b\u5e93\u4e0a\u542f\u7528<code class=\"varname\">full_page_writes</code>\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u6bcf\u5f53<span class=\"application\">pg_basebackup</span>\u6267\u884c\u57fa\u7840\u5907\u4efd\u65f6\uff0c\u670d\u52a1\u5668\u7684<code class=\"structname\">pg_stat_progress_basebackup</code>\u89c6\u56fe\u90fd\u4f1a\u62a5\u544a\u5907\u4efd\u8fdb\u5ea6\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/15/progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING\" title=\"28.4.5.\u00a0\u57fa\u7840\u5907\u4efd\u8fdb\u5ea6\u62a5\u544a\">\u7b2c\u00a028.4.5\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u8f93\u51fa\u7684\u4f4d\u7f6e\u548c\u683c\u5f0f\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>directory</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u5199\u5165\u8f93\u51fa\u7684\u76ee\u6807\u76ee\u5f55\u3002\u5982\u679c\u8be5\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u521b\u5efa\u5b83\uff08\u4ee5\u53ca\u6240\u6709\u7f3a\u5931\u7684\u7236\u76ee\u5f55\uff09\u3002\u5982\u679c\u8be5\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002</p>\n<p lang=\"zh\">\u5f53\u5907\u4efd\u91c7\u7528 tar \u683c\u5f0f\u65f6\uff0c\u76ee\u6807\u76ee\u5f55\u53ef\u4ee5\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff08\u77ed\u6a2a\u7ebf\uff09\uff0c\u4ece\u800c\u5c06 tar \u6587\u4ef6\u5199\u5230<code class=\"literal\">stdout</code>\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u662f\u5fc5\u9700\u7684\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>format</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--format=<em class=\"replaceable\"><code>format</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u9009\u62e9\u8f93\u51fa\u683c\u5f0f\u3002<em class=\"replaceable\"><code>format</code></em>\u53ef\u4ee5\u662f\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">p</code><br/></span><span class=\"term\"><code class=\"literal\">plain</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u5199\u4e3a\u666e\u901a\u6587\u4ef6\uff0c\u5176\u5e03\u5c40\u4e0e\u6e90\u670d\u52a1\u5668\u7684\u6570\u636e\u76ee\u5f55\u548c\u8868\u7a7a\u95f4\u76f8\u540c\u3002\u5f53\u96c6\u7c07\u6ca1\u6709\u989d\u5916\u8868\u7a7a\u95f4\u65f6\uff0c\u6574\u4e2a\u6570\u636e\u5e93\u90fd\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u3002\u5982\u679c\u96c6\u7c07\u5305\u542b\u989d\u5916\u8868\u7a7a\u95f4\uff0c\u5219\u4e3b\u6570\u636e\u76ee\u5f55\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\uff0c\u800c\u5176\u4ed6\u6240\u6709\u8868\u7a7a\u95f4\u90fd\u4f1a\u653e\u5728\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u76f8\u540c\u7684\u7edd\u5bf9\u8def\u5f84\u4e2d\u3002\uff08\u5982\u9700\u6539\u53d8\u8fd9\u4e00\u70b9\uff0c\u89c1<code class=\"option\">--tablespace-mapping</code>\u3002\uff09</p>\n<p lang=\"zh\">\u8fd9\u662f\u9ed8\u8ba4\u683c\u5f0f\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">t</code><br/></span><span class=\"term\"><code class=\"literal\">tar</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u5199\u4e3a\u76ee\u6807\u76ee\u5f55\u4e2d\u7684 tar \u6587\u4ef6\u3002\u4e3b\u6570\u636e\u76ee\u5f55\u7684\u5185\u5bb9\u4f1a\u5199\u5165\u540d\u4e3a<code class=\"filename\">base.tar</code>\u7684\u6587\u4ef6\u4e2d\uff0c\u800c\u6bcf\u4e2a\u5176\u4ed6\u8868\u7a7a\u95f4\u90fd\u4f1a\u5199\u5165\u4e00\u4e2a\u4ee5\u8be5\u8868\u7a7a\u95f4 OID \u547d\u540d\u7684\u72ec\u7acb tar \u6587\u4ef6\u4e2d\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u76ee\u6807\u76ee\u5f55\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff08\u77ed\u6a2a\u7ebf\uff09\uff0ctar \u5185\u5bb9\u5c06\u5199\u5165\u6807\u51c6\u8f93\u51fa\uff0c\u9002\u5408\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u4f8b\u5982<span class=\"productname\">gzip</span>\u3002\u53ea\u6709\u5f53\u96c6\u7c07\u6ca1\u6709\u989d\u5916\u8868\u7a7a\u95f4\u4e14\u672a\u4f7f\u7528 WAL \u6d41\u5f0f\u4f20\u8f93\u65f6\uff0c\u624d\u5141\u8bb8\u8fd9\u6837\u505a\u3002</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code><br/></span><span class=\"term\"><code class=\"option\">--write-recovery-conf</code></span></dt>\n<dd>\n<p lang=\"zh\">\u521b\u5efa<a class=\"link\" href=\"/docs/15/warm-standby.html#FILE-STANDBY-SIGNAL\"><code class=\"filename\">standby.signal</code></a> <a class=\"indexterm\" id=\"id-1.9.4.10.6.2.1.3.3.1.2\" name=\"id-1.9.4.10.6.2.1.3.3.1.2\"></a>\u6587\u4ef6\uff0c\u5e76\u5c06\u8fde\u63a5\u8bbe\u7f6e\u8ffd\u52a0\u5230\u76ee\u6807\u76ee\u5f55\u4e2d\u7684<code class=\"filename\">postgresql.auto.conf</code>\u6587\u4ef6\u4e2d\uff08\u5982\u679c\u4f7f\u7528 tar \u683c\u5f0f\uff0c\u5219\u8ffd\u52a0\u5230\u57fa\u7840\u5f52\u6863\u6587\u4ef6\u5185\uff09\u3002\u8fd9\u6837\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u5229\u7528\u5907\u4efd\u7ed3\u679c\u642d\u5efa\u5907\u5e93\u3002</p>\n<p lang=\"zh\"><code class=\"filename\">postgresql.auto.conf</code>\u6587\u4ef6\u4f1a\u8bb0\u5f55<span class=\"application\">pg_basebackup</span>\u6240\u7528\u7684\u8fde\u63a5\u8bbe\u7f6e\uff0c\u4ee5\u53ca\u590d\u5236\u69fd\uff08\u5982\u679c\u6307\u5b9a\u4e86\uff09\uff0c\u4ee5\u4fbf\u6d41\u590d\u5236\u4ee5\u540e\u4f7f\u7528\u76f8\u540c\u7684\u8bbe\u7f6e\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t <em class=\"replaceable\"><code>target</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--target=<em class=\"replaceable\"><code>target</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u793a\u670d\u52a1\u5668\u5c06\u57fa\u7840\u5907\u4efd\u653e\u5230\u54ea\u91cc\u3002\u9ed8\u8ba4\u76ee\u6807\u662f<code class=\"literal\">client</code>\uff0c\u8868\u793a\u5907\u4efd\u5e94\u53d1\u9001\u5230\u8fd0\u884c<span class=\"application\">pg_basebackup</span>\u7684\u90a3\u53f0\u673a\u5668\u3002\u5982\u679c\u76ee\u6807\u6539\u4e3a<code class=\"literal\">server:/some/path</code>\uff0c\u5219\u5907\u4efd\u4f1a\u5b58\u50a8\u5728\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684<code class=\"literal\">/some/path</code>\u76ee\u5f55\u4e2d\u3002\u5c06\u5907\u4efd\u5b58\u50a8\u5728\u670d\u52a1\u5668\u4e0a\u9700\u8981\u8d85\u7ea7\u7528\u6237\u6743\u9650\uff0c\u6216\u62e5\u6709<code class=\"literal\">pg_write_server_files</code>\u89d2\u8272\u7684\u6743\u9650\u3002\u5982\u679c\u76ee\u6807\u8bbe\u7f6e\u4e3a<code class=\"literal\">blackhole</code>\uff0c\u5219\u5185\u5bb9\u4f1a\u88ab\u4e22\u5f03\uff0c\u4e0d\u4f1a\u5b58\u50a8\u5230\u4efb\u4f55\u5730\u65b9\u3002\u8fd9\u53ea\u5e94\u7528\u4e8e\u6d4b\u8bd5\u76ee\u7684\uff0c\u56e0\u4e3a\u6700\u7ec8\u4e0d\u4f1a\u5f97\u5230\u5b9e\u9645\u5907\u4efd\u3002</p>\n<p lang=\"zh\">\u7531\u4e8e WAL \u6d41\u5f0f\u4f20\u8f93\u662f\u7531<span class=\"application\">pg_basebackup</span>\u800c\u4e0d\u662f\u670d\u52a1\u5668\u5b9e\u73b0\u7684\uff0c\u56e0\u6b64\u6b64\u9009\u9879\u4e0d\u80fd\u4e0e<code class=\"literal\">-Xstream</code>\u4e00\u8d77\u4f7f\u7528\u3002\u7531\u4e8e\u540e\u8005\u662f\u9ed8\u8ba4\u503c\uff0c\u6240\u4ee5\u6307\u5b9a\u6b64\u9009\u9879\u65f6\uff0c\u8fd8\u5fc5\u987b\u540c\u65f6\u6307\u5b9a<code class=\"literal\">-Xfetch</code>\u6216<code class=\"literal\">-Xnone</code>\u4e4b\u4e00\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>olddir</code></em>=<em class=\"replaceable\"><code>newdir</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--tablespace-mapping=<em class=\"replaceable\"><code>olddir</code></em>=<em class=\"replaceable\"><code>newdir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u671f\u95f4\uff0c\u5c06\u76ee\u5f55<em class=\"replaceable\"><code>olddir</code></em>\u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230<em class=\"replaceable\"><code>newdir</code></em>\u3002\u8981\u4f7f\u6b64\u9009\u9879\u751f\u6548\uff0c<em class=\"replaceable\"><code>olddir</code></em>\u5fc5\u987b\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u5b9a\u4e49\u7684\u8be5\u8868\u7a7a\u95f4\u8def\u5f84\u5b8c\u5168\u4e00\u81f4\u3002\uff08\u4f46\u5982\u679c\u6e90\u670d\u52a1\u5668\u4e0a\u5728<em class=\"replaceable\"><code>olddir</code></em>\u4e2d\u6ca1\u6709\u8868\u7a7a\u95f4\uff0c\u4e5f\u4e0d\u7b97\u9519\u8bef\u3002\uff09\u4e0e\u6b64\u540c\u65f6\uff0c<em class=\"replaceable\"><code>newdir</code></em>\u662f\u63a5\u6536\u4e3b\u673a\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u4e00\u4e2a\u76ee\u5f55\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c<em class=\"replaceable\"><code>newdir</code></em>\u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002<em class=\"replaceable\"><code>olddir</code></em>\u548c<em class=\"replaceable\"><code>newdir</code></em>\u90fd\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u5982\u679c\u4efb\u4e00\u8def\u5f84\u4e2d\u9700\u8981\u5305\u542b\u7b49\u53f7\uff08<code class=\"literal\">=</code>\uff09\uff0c\u8bf7\u5728\u5176\u524d\u9762\u52a0\u4e0a\u53cd\u659c\u6760\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u4ee5\u5904\u7406\u591a\u4e2a\u8868\u7a7a\u95f4\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u91cd\u5b9a\u4f4d\u8868\u7a7a\u95f4\uff0c\u4e3b\u6570\u636e\u76ee\u5f55\u4e2d\u7684\u7b26\u53f7\u94fe\u63a5\u5c06\u88ab\u66f4\u65b0\u4e3a\u6307\u5411\u65b0\u4f4d\u7f6e\u3002\u56e0\u6b64\uff0c\u65b0\u6570\u636e\u76ee\u5f55\u5df2\u53ef\u76f4\u63a5\u7528\u4e8e\u542f\u52a8\u4e00\u4e2a\u6240\u6709\u8868\u7a7a\u95f4\u90fd\u4f4d\u4e8e\u66f4\u65b0\u540e\u4f4d\u7f6e\u7684\u65b0\u670d\u52a1\u5668\u5b9e\u4f8b\u3002</p>\n<p lang=\"zh\">\u76ee\u524d\uff0c\u6b64\u9009\u9879\u4ec5\u9002\u7528\u4e8e\u666e\u901a\u6587\u4ef6\u8f93\u51fa\u683c\u5f0f\uff1b\u5982\u679c\u9009\u62e9\u4e86 tar \u683c\u5f0f\uff0c\u5219\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--waldir=<em class=\"replaceable\"><code>waldir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5199\u5165 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cWAL \u6587\u4ef6\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u7684<code class=\"filename\">pg_wal</code>\u5b50\u76ee\u5f55\u4e2d\uff0c\u4f46\u6b64\u9009\u9879\u53ef\u7528\u4e8e\u5c06\u5176\u653e\u5728\u5176\u4ed6\u4f4d\u7f6e\u3002<em class=\"replaceable\"><code>waldir</code></em>\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c<em class=\"replaceable\"><code>waldir</code></em>\u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002\u53ea\u6709\u5f53\u5907\u4efd\u91c7\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u624d\u80fd\u6307\u5b9a\u6b64\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-X <em class=\"replaceable\"><code>method</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--wal-method=<em class=\"replaceable\"><code>method</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u4e2d\u5305\u542b\u6240\u9700\u7684 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u3002\u8fd9\u5c06\u5305\u62ec\u5907\u4efd\u671f\u95f4\u751f\u6210\u7684\u6240\u6709\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u9664\u975e\u6307\u5b9a\u65b9\u6cd5<code class=\"literal\">none</code>\uff0c\u5426\u5219\u5c31\u53ef\u4ee5\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u542f\u52a8 postmaster\uff0c\u800c\u65e0\u9700\u67e5\u9605 WAL \u5f52\u6863\uff0c\u4ece\u800c\u4f7f\u8f93\u51fa\u6210\u4e3a\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u5907\u4efd\u3002</p>\n<p lang=\"zh\">\u652f\u6301\u4ee5\u4e0b\u7528\u4e8e\u6536\u96c6\u9884\u5199\u5f0f\u65e5\u5fd7\u7684<em class=\"replaceable\"><code>method</code></em>\u503c\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">n</code><br/></span><span class=\"term\"><code class=\"literal\">none</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u5728\u5907\u4efd\u4e2d\u5305\u542b\u9884\u5199\u5f0f\u65e5\u5fd7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">f</code><br/></span><span class=\"term\"><code class=\"literal\">fetch</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u7ed3\u675f\u65f6\u6536\u96c6\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u3002\u56e0\u6b64\uff0c\u6e90\u670d\u52a1\u5668\u7684<a class=\"xref\" href=\"/docs/15/runtime-config-replication.html#GUC-WAL-KEEP-SIZE\">wal_keep_size</a>\u53c2\u6570\u5fc5\u987b\u8bbe\u7f6e\u5f97\u8db3\u591f\u9ad8\uff0c\u4ee5\u786e\u4fdd\u5728\u5907\u4efd\u7ed3\u675f\u524d\u4e0d\u4f1a\u79fb\u9664\u6240\u9700\u7684\u65e5\u5fd7\u6570\u636e\u3002\u5982\u679c\u5728\u4f20\u8f93\u8fd9\u4e9b\u6570\u636e\u4e4b\u524d\u5b83\u4eec\u5df2\u7ecf\u88ab\u56de\u6536\uff0c\u5219\u5907\u4efd\u4f1a\u5931\u8d25\u5e76\u4e14\u65e0\u6cd5\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u4f1a\u5305\u542b\u5728<code class=\"filename\">base.tar</code>\u6587\u4ef6\u4e2d\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">s</code><br/></span><span class=\"term\"><code class=\"literal\">stream</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u6267\u884c\u5907\u4efd\u7684\u540c\u65f6\u6d41\u5f0f\u4f20\u8f93\u9884\u5199\u5f0f\u65e5\u5fd7\u6570\u636e\u3002\u6b64\u65b9\u6cd5\u4f1a\u5411\u670d\u52a1\u5668\u6253\u5f00\u7b2c\u4e8c\u4e2a\u8fde\u63a5\uff0c\u5e76\u5728\u6267\u884c\u5907\u4efd\u65f6\u5e76\u884c\u5f00\u59cb\u6d41\u5f0f\u4f20\u8f93\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u56e0\u6b64\uff0c\u5b83\u9700\u8981\u4e24\u4e2a\u590d\u5236\u8fde\u63a5\uff0c\u800c\u4e0d\u53ea\u662f\u4e00\u4e2a\u3002\u53ea\u8981\u5ba2\u6237\u7aef\u80fd\u591f\u8ddf\u4e0a\u9884\u5199\u5f0f\u65e5\u5fd7\u6570\u636e\uff0c\u4f7f\u7528\u6b64\u65b9\u6cd5\u5c31\u4e0d\u9700\u8981\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u989d\u5916\u4fdd\u7559\u9884\u5199\u5f0f\u65e5\u5fd7\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u4f1a\u5199\u5165\u4e00\u4e2a\u540d\u4e3a<code class=\"filename\">pg_wal.tar</code>\u7684\u72ec\u7acb\u6587\u4ef6\u4e2d\uff08\u5982\u679c\u670d\u52a1\u5668\u7248\u672c\u65e9\u4e8e 10\uff0c\u5219\u6587\u4ef6\u540d\u4e3a<code class=\"filename\">pg_xlog.tar</code>\uff09\u3002</p>\n<p lang=\"zh\">\u8fd9\u662f\u9ed8\u8ba4\u503c\u3002</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-z</code><br/></span><span class=\"term\"><code class=\"option\">--gzip</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u4f7f\u7528\u9ed8\u8ba4\u538b\u7f29\u7ea7\u522b\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0<code class=\"filename\">.gz</code>\u540e\u7f00\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-Z <em class=\"replaceable\"><code>level</code></em></code><br/></span><span class=\"term\"><code class=\"option\">-Z [{client|server}-]<em class=\"replaceable\"><code>method</code></em>[:<em class=\"replaceable\"><code>detail</code></em>]</code><br/></span><span class=\"term\"><code class=\"option\">--compress=<em class=\"replaceable\"><code>level</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--compress=[{client|server}-]<em class=\"replaceable\"><code>method</code></em>[:<em class=\"replaceable\"><code>detail</code></em>]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bf7\u6c42\u5bf9\u5907\u4efd\u8fdb\u884c\u538b\u7f29\u3002\u5982\u679c\u5305\u542b<code class=\"literal\">client</code>\u6216<code class=\"literal\">server</code>\uff0c\u5219\u6307\u5b9a\u538b\u7f29\u6267\u884c\u7684\u4f4d\u7f6e\u3002\u5728\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4f1a\u51cf\u5c11\u4f20\u8f93\u5e26\u5bbd\u5360\u7528\uff0c\u4f46\u4f1a\u589e\u52a0\u670d\u52a1\u5668 CPU \u6d88\u8017\u3002\u9ed8\u8ba4\u503c\u662f<code class=\"literal\">client</code>\uff0c\u4f46\u4f7f\u7528<code class=\"literal\">--target</code>\u65f6\u9664\u5916\uff1b\u6b64\u65f6\u5907\u4efd\u4e0d\u4f1a\u53d1\u9001\u5230\u5ba2\u6237\u7aef\uff0c\u56e0\u6b64\u53ea\u6709\u670d\u52a1\u5668\u7aef\u538b\u7f29\u624d\u6709\u610f\u4e49\u3002\u4f7f\u7528\u9ed8\u8ba4\u7684<code class=\"literal\">-Xstream</code>\u65f6\uff0c\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4e0d\u4f1a\u5e94\u7528\u4e8e WAL\u3002\u82e5\u8981\u538b\u7f29 WAL\uff0c\u8bf7\u4f7f\u7528\u5ba2\u6237\u7aef\u538b\u7f29\uff0c\u6216\u8005\u6307\u5b9a<code class=\"literal\">-Xfetch</code>\u3002</p>\n<p lang=\"zh\">\u538b\u7f29\u65b9\u6cd5\u53ef\u4ee5\u8bbe\u7f6e\u4e3a<code class=\"literal\">gzip</code>\u3001<code class=\"literal\">lz4</code>\u3001<code class=\"literal\">zstd</code>\u6216\u8868\u793a\u4e0d\u538b\u7f29\u7684<code class=\"literal\">none</code>\u3002\u8fd8\u53ef\u4ee5\u9009\u62e9\u6027\u5730\u6307\u5b9a\u538b\u7f29\u7ec6\u8282\u5b57\u7b26\u4e32\u3002\u5982\u679c\u7ec6\u8282\u5b57\u7b26\u4e32\u662f\u6574\u6570\uff0c\u5219\u8868\u793a\u538b\u7f29\u7ea7\u522b\uff1b\u5426\u5219\uff0c\u5b83\u5e94\u4e3a\u9017\u53f7\u5206\u9694\u7684\u9879\u76ee\u5217\u8868\uff0c\u6bcf\u9879\u7684\u5f62\u5f0f\u4e3a<code class=\"literal\">keyword</code> \u6216<code class=\"literal\">keyword=value</code>\u3002\u76ee\u524d\u652f\u6301\u7684\u5173\u952e\u5b57\u6709<code class=\"literal\">level</code> \u548c<code class=\"literal\">workers</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u538b\u7f29\u7ea7\u522b\uff0c\u5c06\u4f7f\u7528\u9ed8\u8ba4\u7ea7\u522b\u3002\u5982\u679c\u53ea\u6307\u5b9a\u7ea7\u522b\u800c\u672a\u6307\u5b9a\u7b97\u6cd5\uff0c\u5219\u7ea7\u522b\u5927\u4e8e 0 \u65f6\u4f7f\u7528 gzip \u538b\u7f29\uff0c\u7ea7\u522b\u4e3a 0 \u65f6\u4e0d\u538b\u7f29\u3002</p>\n<p lang=\"zh\">\u5f53 tar \u683c\u5f0f\u914d\u5408<code class=\"literal\">gzip</code>\u3001<code class=\"literal\">lz4</code>\u6216<code class=\"literal\">zstd</code>\u4f7f\u7528\u65f6\uff0c\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u5206\u522b\u81ea\u52a8\u52a0\u4e0a<code class=\"filename\">.gz</code>\u3001<code class=\"filename\">.lz4</code>\u6216<code class=\"filename\">.zst</code>\u540e\u7f00\u3002\u4f7f\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u4e0d\u80fd\u6307\u5b9a\u5ba2\u6237\u7aef\u538b\u7f29\uff0c\u4f46\u4ecd\u53ef\u4ee5\u8bf7\u6c42\u670d\u52a1\u5668\u7aef\u538b\u7f29\u3002\u8fd9\u6837\u505a\u65f6\uff0c\u670d\u52a1\u5668\u4f1a\u5148\u538b\u7f29\u5907\u4efd\u518d\u4f20\u8f93\uff0c\u800c\u5ba2\u6237\u7aef\u4f1a\u5bf9\u5176\u8fdb\u884c\u89e3\u538b\u5e76\u63d0\u53d6\u3002</p>\n<p lang=\"zh\">\u5f53\u6b64\u9009\u9879\u4e0e<code class=\"literal\">-Xstream</code>\u7ec4\u5408\u4f7f\u7528\u65f6\uff0c\u5982\u679c\u9009\u62e9\u4e86\u5ba2\u6237\u7aef gzip \u538b\u7f29\uff0c\u5219<code class=\"literal\">pg_wal.tar</code>\u4f1a\u4f7f\u7528<code class=\"literal\">gzip</code>\u538b\u7f29\uff1b\u4f46\u5982\u679c\u9009\u62e9\u4e86\u5176\u4ed6\u538b\u7f29\u7b97\u6cd5\uff0c\u6216\u8005\u9009\u62e9\u4e86\u670d\u52a1\u5668\u7aef\u538b\u7f29\uff0c\u5219\u4e0d\u4f1a\u88ab\u538b\u7f29\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u5907\u4efd\u7684\u751f\u6210\u548c\u7a0b\u5e8f\u7684\u8c03\u7528\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-c {fast|spread}</code><br/></span><span class=\"term\"><code class=\"option\">--checkpoint={fast|spread}</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u68c0\u67e5\u70b9\u6a21\u5f0f\u8bbe\u7f6e\u4e3a fast\uff08\u7acb\u5373\uff09\u6216 spread\uff08\u9ed8\u8ba4\uff09\uff08\u89c1<a class=\"xref\" href=\"/docs/15/continuous-archiving.html#BACKUP-LOWLEVEL-BASE-BACKUP\" title=\"26.3.3.\u00a0\u4f7f\u7528\u4f4e\u7ea7 API \u8fdb\u884c\u57fa\u7840\u5907\u4efd\">\u7b2c\u00a026.3.3\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--create-slot</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728\u5f00\u59cb\u5907\u4efd\u4e4b\u524d\uff0c\u5e94\u521b\u5efa\u7531<code class=\"literal\">--slot</code>\u9009\u9879\u6307\u5b9a\u540d\u79f0\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u8be5\u69fd\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u9519\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>label</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--label=<em class=\"replaceable\"><code>label</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5907\u4efd\u6807\u7b7e\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u503c<span class=\"quote\">\u201c<span class=\"quote\"><code class=\"literal\">pg_basebackup base backup</code></span>\u201d</span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-clean</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53<code class=\"command\">pg_basebackup</code>\u56e0\u9519\u8bef\u4e2d\u6b62\u65f6\uff0c\u5b83\u4f1a\u5220\u9664\u5728\u53d1\u73b0\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u76ee\u5f55\uff08\u4f8b\u5982\u76ee\u6807\u76ee\u5f55\u548c\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\uff09\u3002\u6b64\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u5f88\u6709\u5e2e\u52a9\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u65e0\u8bba\u662f\u5426\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u8868\u7a7a\u95f4\u76ee\u5f55\u90fd\u4e0d\u4f1a\u88ab\u6e05\u7406\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N</code><br/></span><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">pg_basebackup</code>\u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u88ab\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f1a\u4f7f<code class=\"command\">pg_basebackup</code>\u4e0d\u7ecf\u7b49\u5f85\u5c31\u76f4\u63a5\u8fd4\u56de\uff0c\u56e0\u6b64\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u968f\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u57fa\u7840\u5907\u4efd\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u5408\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P</code><br/></span><span class=\"term\"><code class=\"option\">--progress</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528\u8fdb\u5ea6\u62a5\u544a\u3002\u6253\u5f00\u6b64\u9009\u9879\u540e\uff0c\u4f1a\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u7ed9\u51fa\u4e00\u4e2a\u8fd1\u4f3c\u7684\u8fdb\u5ea6\u62a5\u544a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u53d1\u751f\u53d8\u5316\uff0c\u56e0\u6b64\u8fd9\u53ea\u662f\u8fd1\u4f3c\u503c\uff0c\u6700\u7ec8\u672a\u5fc5\u6070\u597d\u7ed3\u675f\u5728<code class=\"literal\">100%</code>\u3002\u7279\u522b\u662f\u5f53\u5907\u4efd\u4e2d\u5305\u542b WAL \u65f6\uff0c\u603b\u6570\u636e\u91cf\u65e0\u6cd5\u9884\u5148\u4f30\u8ba1\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u65e6\u8fdb\u5ea6\u8d85\u8fc7\u4e0d\u542b WAL \u65f6\u7684\u603b\u4f30\u8ba1\u503c\uff0c\u4f30\u8ba1\u76ee\u6807\u5927\u5c0f\u5c31\u4f1a\u7ee7\u7eed\u589e\u52a0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r <em class=\"replaceable\"><code>rate</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--max-rate=<em class=\"replaceable\"><code>rate</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u4ece\u6e90\u670d\u52a1\u5668\u6536\u96c6\u6570\u636e\u65f6\u5141\u8bb8\u7684\u6700\u5927\u4f20\u8f93\u901f\u7387\u3002\u8fd9\u6709\u52a9\u4e8e\u9650\u5236<span class=\"application\">pg_basebackup</span>\u5bf9\u670d\u52a1\u5668\u7684\u5f71\u54cd\u3002\u53d6\u503c\u5355\u4f4d\u4e3a\u6bcf\u79d2\u5343\u5b57\u8282\u3002\u4f7f\u7528\u540e\u7f00<code class=\"literal\">M</code>\u8868\u793a\u6bcf\u79d2\u5146\u5b57\u8282\u3002\u4e5f\u63a5\u53d7\u540e\u7f00<code class=\"literal\">k</code>\uff0c\u4f46\u6ca1\u6709\u5b9e\u9645\u5f71\u54cd\u3002\u6709\u6548\u53d6\u503c\u8303\u56f4\u4e3a\u6bcf\u79d2 32 \u5343\u5b57\u8282\u5230\u6bcf\u79d2 1024 \u5146\u5b57\u8282\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u59cb\u7ec8\u5f71\u54cd\u6570\u636e\u76ee\u5f55\u7684\u4f20\u8f93\u3002\u53ea\u6709\u5f53\u6536\u96c6\u65b9\u6cd5\u4e3a<code class=\"literal\">fetch</code>\u65f6\uff0cWAL \u6587\u4ef6\u7684\u4f20\u8f93\u624d\u4f1a\u53d7\u5230\u5f71\u54cd\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>slotname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--slot=<em class=\"replaceable\"><code>slotname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u53ea\u80fd\u4e0e<code class=\"literal\">-X stream</code>\u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u4f1a\u4f7f WAL \u6d41\u5f0f\u4f20\u8f93\u4f7f\u7528\u6307\u5b9a\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u6b64\u57fa\u7840\u5907\u4efd\u6253\u7b97\u7528\u4f5c\u4f7f\u7528\u590d\u5236\u69fd\u7684\u6d41\u590d\u5236\u5907\u5e93\uff0c\u90a3\u4e48\u8be5\u5907\u5e93\u5e94\u5c06\u540c\u4e00\u4e2a\u590d\u5236\u69fd\u540d\u79f0\u7528\u4f5c<a class=\"xref\" href=\"/docs/15/runtime-config-replication.html#GUC-PRIMARY-SLOT-NAME\">primary_slot_name</a>\u7684\u503c\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u4e3b\u5e93\u5728\u57fa\u7840\u5907\u4efd\u7ed3\u675f\u4e0e\u65b0\u5907\u5e93\u5f00\u59cb\u6d41\u590d\u5236\u4e4b\u95f4\u7684\u8fd9\u6bb5\u65f6\u95f4\u5185\uff0c\u4e0d\u4f1a\u79fb\u9664\u4efb\u4f55\u5fc5\u9700\u7684 WAL \u6570\u636e\u3002</p>\n<p lang=\"zh\">\u6307\u5b9a\u7684\u590d\u5236\u69fd\u5fc5\u987b\u5df2\u7ecf\u5b58\u5728\uff0c\u9664\u975e\u8fd8\u540c\u65f6\u4f7f\u7528\u4e86<code class=\"option\">-C</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5e76\u4e14\u670d\u52a1\u5668\u652f\u6301\u4e34\u65f6\u590d\u5236\u69fd\uff0810 \u53ca\u4ee5\u4e0a\u7248\u672c\uff09\uff0c\u5219\u4f1a\u81ea\u52a8\u4f7f\u7528\u4e34\u65f6\u590d\u5236\u69fd\u8fdb\u884c WAL \u6d41\u5f0f\u4f20\u8f93\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\u3002\u5b83\u4f1a\u5728\u542f\u52a8\u548c\u5173\u95ed\u8fc7\u7a0b\u4e2d\u8f93\u51fa\u4e00\u4e9b\u989d\u5916\u6b65\u9aa4\uff1b\u5982\u679c\u540c\u65f6\u542f\u7528\u4e86\u8fdb\u5ea6\u62a5\u544a\uff0c\u8fd8\u4f1a\u663e\u793a\u5f53\u524d\u6b63\u5728\u5904\u7406\u7684\u786e\u5207\u6587\u4ef6\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--manifest-checksums=<em class=\"replaceable\"><code>algorithm</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u5e94\u7528\u5230\u5907\u4efd\u6e05\u5355\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u7684\u6821\u9a8c\u548c\u7b97\u6cd5\u3002\u76ee\u524d\u53ef\u7528\u7684\u7b97\u6cd5\u6709<code class=\"literal\">NONE</code>\u3001<code class=\"literal\">CRC32C</code>\u3001<code class=\"literal\">SHA224</code>\u3001<code class=\"literal\">SHA256</code>\u3001<code class=\"literal\">SHA384</code>\u548c<code class=\"literal\">SHA512</code>\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">CRC32C</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">NONE</code>\uff0c\u5907\u4efd\u6e05\u5355\u5c06\u4e0d\u5305\u542b\u4efb\u4f55\u6821\u9a8c\u548c\u3002\u5426\u5219\uff0c\u5b83\u5c06\u5305\u542b\u4f7f\u7528\u6307\u5b9a\u7b97\u6cd5\u4e3a\u5907\u4efd\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u8ba1\u7b97\u7684\u6821\u9a8c\u548c\u3002\u6b64\u5916\uff0c\u6e05\u5355\u59cb\u7ec8\u4f1a\u5305\u542b\u5176\u81ea\u8eab\u5185\u5bb9\u7684<code class=\"literal\">SHA256</code>\u6821\u9a8c\u548c\u3002<code class=\"literal\">SHA</code>\u7b97\u6cd5\u660e\u663e\u6bd4<code class=\"literal\">CRC32C</code>\u66f4\u8017\u8d39 CPU\uff0c\u56e0\u6b64\u9009\u62e9\u5176\u4e2d\u4e00\u79cd\u53ef\u80fd\u4f1a\u589e\u52a0\u5b8c\u6210\u5907\u4efd\u6240\u9700\u7684\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u5e0c\u671b\u9a8c\u8bc1\u5907\u4efd\u672a\u88ab\u7be1\u6539\u7684\u7528\u6237\uff0c\u4f7f\u7528 SHA hash \u51fd\u6570\u53ef\u4ee5\u4e3a\u6bcf\u4e2a\u6587\u4ef6\u63d0\u4f9b\u5177\u6709\u5bc6\u7801\u5b66\u5b89\u5168\u6027\u7684\u6458\u8981\uff1b\u800c CRC32C \u7b97\u6cd5\u63d0\u4f9b\u7684\u6821\u9a8c\u548c\u8ba1\u7b97\u901f\u5ea6\u8981\u5feb\u5f97\u591a\uff0c\u867d\u7136\u5b83\u5f88\u9002\u5408\u53d1\u73b0\u7531\u4e8e\u610f\u5916\u6539\u52a8\u9020\u6210\u7684\u9519\u8bef\uff0c\u4f46\u5e76\u4e0d\u80fd\u62b5\u5fa1\u6076\u610f\u4fee\u6539\u3002\u8bf7\u6ce8\u610f\uff0c\u8981\u60f3\u5bf9\u80fd\u591f\u8bbf\u95ee\u5907\u4efd\u7684\u653b\u51fb\u8005\u5f62\u6210\u9632\u62a4\uff0c\u5907\u4efd\u6e05\u5355\u5c31\u9700\u8981\u5b89\u5168\u5730\u4fdd\u5b58\u5728\u5176\u4ed6\u5730\u65b9\uff0c\u6216\u8005\u4ee5\u5176\u4ed6\u65b9\u5f0f\u786e\u8ba4\u81ea\u5907\u4efd\u5b8c\u6210\u540e\u672a\u88ab\u4fee\u6539\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528<a class=\"xref\" href=\"/docs/15/app-pgverifybackup.html\" title=\"pg_verifybackup\"><span class=\"refentrytitle\"><span class=\"application\">pg_verifybackup</span></span></a>\u6839\u636e\u5907\u4efd\u6e05\u5355\u68c0\u67e5\u5907\u4efd\u7684\u5b8c\u6574\u6027\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--manifest-force-encode</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f3a\u5236\u5c06\u5907\u4efd\u6e05\u5355\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u540d\u7f16\u7801\u4e3a\u5341\u516d\u8fdb\u5236\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u5bf9\u975e UTF8 \u6587\u4ef6\u540d\u8fdb\u884c\u5341\u516d\u8fdb\u5236\u7f16\u7801\u3002\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u8bfb\u53d6\u5907\u4efd\u6e05\u5355\u6587\u4ef6\u7684\u5de5\u5177\u662f\u5426\u80fd\u6b63\u786e\u5904\u7406\u8fd9\u79cd\u60c5\u51b5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-estimate-size</code></span></dt>\n<dd>\n<p lang=\"zh\">\u7981\u6b62\u670d\u52a1\u5668\u4f30\u7b97\u5c06\u8981\u6d41\u5f0f\u4f20\u8f93\u7684\u5907\u4efd\u6570\u636e\u603b\u91cf\uff0c\u56e0\u6b64 pg_stat_progress_basebackup \u89c6\u56fe\u4e2d\u7684 backup_total \u5217\u59cb\u7ec8\u4e3a NULL\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5907\u4efd\u4f1a\u5148\u679a\u4e3e\u6574\u4e2a\u6570\u636e\u5e93\u7684\u5927\u5c0f\uff0c\u7136\u540e\u518d\u56de\u8fc7\u5934\u6765\u53d1\u9001\u5b9e\u9645\u5185\u5bb9\u3002\u8fd9\u53ef\u80fd\u4f1a\u8ba9\u5907\u4efd\u8017\u65f6\u7565\u957f\uff0c\u7279\u522b\u662f\u5728\u53d1\u9001\u7b2c\u4e00\u6279\u6570\u636e\u4e4b\u524d\u6240\u9700\u65f6\u95f4\u4f1a\u66f4\u4e45\u3002\u5982\u679c\u8fd9\u79cd\u4f30\u7b97\u8017\u65f6\u8fc7\u957f\uff0c\u6b64\u9009\u9879\u5c31\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u5b83\u53ef\u4ee5\u907f\u514d\u8fd9\u6bb5\u4f30\u7b97\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--progress</code>\u65f6\uff0c\u4e0d\u5141\u8bb8\u4f7f\u7528\u6b64\u9009\u9879\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-manifest</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7981\u6b62\u751f\u6210\u5907\u4efd\u6e05\u5355\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u670d\u52a1\u5668\u5c06\u751f\u6210\u5e76\u53d1\u9001\u4e00\u4e2a\u5907\u4efd\u6e05\u5355\uff0c\u53ef\u4f7f\u7528<a class=\"xref\" href=\"/docs/15/app-pgverifybackup.html\" title=\"pg_verifybackup\"><span class=\"refentrytitle\"><span class=\"application\">pg_verifybackup</span></span></a>\u8fdb\u884c\u9a8c\u8bc1\u3002\u8be5\u6e05\u5355\u5217\u51fa\u4e86\u5907\u4efd\u4e2d\u7684\u6bcf\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u4e0d\u5305\u62ec\u53ef\u80fd\u5305\u542b\u5728\u5176\u4e2d\u7684\u4efb\u4f55 WAL \u6587\u4ef6\u3002\u5b83\u8fd8\u4f1a\u4fdd\u5b58\u6bcf\u4e2a\u6587\u4ef6\u7684\u5927\u5c0f\u3001\u6700\u540e\u4fee\u6539\u65f6\u95f4\u4ee5\u53ca\u53ef\u9009\u7684\u6821\u9a8c\u548c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-slot</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9632\u6b62\u4e3a\u5907\u4efd\u521b\u5efa\u4e34\u65f6\u590d\u5236\u69fd\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u9009\u62e9\u4e86 WAL \u6d41\u5f0f\u4f20\u8f93\uff0c\u4f46\u6ca1\u6709\u4f7f\u7528<code class=\"option\">-S</code>\u9009\u9879\u7ed9\u51fa\u69fd\u540d\uff0c\u90a3\u4e48\u4f1a\u521b\u5efa\u4e00\u4e2a\u4e34\u65f6\u590d\u5236\u69fd\uff08\u5982\u679c\u6e90\u670d\u52a1\u5668\u652f\u6301\uff09\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7684\u4e3b\u8981\u76ee\u7684\u662f\u5728\u670d\u52a1\u5668\u6ca1\u6709\u7a7a\u95f2\u590d\u5236\u69fd\u65f6\uff0c\u4ecd\u7136\u5141\u8bb8\u6267\u884c\u57fa\u7840\u5907\u4efd\u3002\u51e0\u4e4e\u603b\u662f\u9996\u9009\u4f7f\u7528\u590d\u5236\u69fd\uff0c\u56e0\u4e3a\u5b83\u80fd\u9632\u6b62\u670d\u52a1\u5668\u5728\u5907\u4efd\u671f\u95f4\u79fb\u9664\u6240\u9700\u7684 WAL\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-verify-checksums</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u83b7\u53d6\u57fa\u7840\u5907\u4efd\u7684\u670d\u52a1\u5668\u542f\u7528\u4e86\u6821\u9a8c\u548c\uff0c\u5219\u7981\u7528\u5bf9\u8fd9\u4e9b\u6821\u9a8c\u548c\u7684\u9a8c\u8bc1\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f1a\u9a8c\u8bc1\u6821\u9a8c\u548c\uff1b\u6821\u9a8c\u548c\u9a8c\u8bc1\u5931\u8d25\u5c06\u5bfc\u81f4\u975e\u96f6\u9000\u51fa\u72b6\u6001\u3002\u4e0d\u8fc7\uff0c\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u57fa\u7840\u5907\u4efd\u4e0d\u4f1a\u88ab\u5220\u9664\uff0c\u5c31\u50cf\u4f7f\u7528\u4e86<code class=\"option\">--no-clean</code>\u4e00\u6837\u3002\u6821\u9a8c\u548c\u9a8c\u8bc1\u5931\u8d25\u4e5f\u4f1a\u5728<a class=\"link\" href=\"/docs/15/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW\" title=\"28.2.15.\u00a0pg_stat_database\"><code class=\"structname\">pg_stat_database</code></a>\u89c6\u56fe\u4e2d\u62a5\u544a\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u5230\u6e90\u670d\u52a1\u5668\u7684\u8fde\u63a5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>connstr</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>connstr</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ee5<a class=\"link\" href=\"/docs/15/libpq.html#LIBPQ-CONNSTRING\" title=\"34.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u7684\u5f62\u5f0f\u6307\u5b9a\u7528\u4e8e\u8fde\u63a5\u670d\u52a1\u5668\u7684\u53c2\u6570\uff1b\u8fd9\u4e9b\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u76f8\u4e92\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u51fa\u4e8e\u4e0e\u5176\u4ed6\u5ba2\u6237\u7aef\u5e94\u7528\u4fdd\u6301\u4e00\u81f4\u7684\u8003\u8651\uff0c\u6b64\u9009\u9879\u540d\u4e3a<code class=\"literal\">--dbname</code>\uff1b\u4f46\u7531\u4e8e<span class=\"application\">pg_basebackup</span>\u5e76\u4e0d\u8fde\u63a5\u5230\u96c6\u7c07\u4e2d\u7684\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u4e2d\u7684\u4efb\u4f55\u6570\u636e\u5e93\u540d\u90fd\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea<code class=\"envar\">PGHOST</code>\u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff1b\u5426\u5219\u4f1a\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u6240\u4f7f\u7528\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u4f7f\u7528<code class=\"envar\">PGPORT</code>\u73af\u5883\u53d8\u91cf\u4e2d\u7684\u503c\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u786e\u5b9a\u7684\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s <em class=\"replaceable\"><code>interval</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--status-interval=<em class=\"replaceable\"><code>interval</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u53d1\u9001\u56de\u6e90\u670d\u52a1\u5668\u7684\u72b6\u6001\u5305\u4e4b\u95f4\u76f8\u9694\u7684\u79d2\u6570\u3002\u8f83\u5c0f\u7684\u503c\u53ef\u4ee5\u8ba9\u670d\u52a1\u5668\u7aef\u5bf9\u5907\u4efd\u8fdb\u5ea6\u7684\u76d1\u63a7\u66f4\u7cbe\u786e\u3002\u503c\u4e3a\u96f6\u65f6\u4f1a\u5b8c\u5168\u7981\u7528\u5468\u671f\u6027\u72b6\u6001\u66f4\u65b0\uff0c\u4e0d\u8fc7\u5f53\u670d\u52a1\u5668\u8bf7\u6c42\u65f6\u4ecd\u4f1a\u53d1\u9001\u66f4\u65b0\uff0c\u4ee5\u907f\u514d\u56e0\u8d85\u65f6\u800c\u65ad\u5f00\u8fde\u63a5\u3002\u9ed8\u8ba4\u503c\u662f 10 \u79d2\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7981\u6b62\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\uff08\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff09\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u6b64\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u79cd\u573a\u666f\u4e0b\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236<span class=\"application\">pg_basebackup</span>\u5728\u8fde\u63a5\u6e90\u670d\u52a1\u5668\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7edd\u975e\u5fc5\u9700\uff0c\u56e0\u4e3a\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u81ea\u52a8\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\u6765\u53d1\u73b0\u670d\u52a1\u5668\u9700\u8981\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u8f93\u5165<code class=\"option\">-W</code>\u4ee5\u907f\u514d\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u662f\u503c\u5f97\u7684\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5176\u4ed6\u9009\u9879\u4e5f\u53ef\u7528\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa<span class=\"application\">pg_basebackup</span>\u7684\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"application\">pg_basebackup</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6<span class=\"productname\">PostgreSQL</span>\u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528<span class=\"application\">libpq</span>\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/15/libpq-envars.html\" title=\"34.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a034.15\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\">\u73af\u5883\u53d8\u91cf<code class=\"envar\">PG_COLOR</code>\u6307\u5b9a\u662f\u5426\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a<code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c<code class=\"literal\">never</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u5728\u5907\u4efd\u5f00\u59cb\u65f6\uff0c\u9700\u8981\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u6267\u884c\u4e00\u6b21\u68c0\u67e5\u70b9\u3002\u8fd9\u53ef\u80fd\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\uff08\u5c24\u5176\u662f\u5728\u672a\u4f7f\u7528<code class=\"literal\">--checkpoint=fast</code>\u9009\u9879\u65f6\uff09\uff1b\u5728\u6b64\u671f\u95f4\uff0c<span class=\"application\">pg_basebackup</span>\u770b\u8d77\u6765\u4f1a\u5904\u4e8e\u7a7a\u95f2\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u5907\u4efd\u5c06\u5305\u62ec\u6570\u636e\u76ee\u5f55\u548c\u8868\u7a7a\u95f4\u4e2d\u7684\u6240\u6709\u6587\u4ef6\uff0c\u5305\u62ec\u914d\u7f6e\u6587\u4ef6\u4ee5\u53ca\u7b2c\u4e09\u65b9\u653e\u5728\u8fd9\u4e9b\u76ee\u5f55\u4e2d\u7684\u4efb\u4f55\u989d\u5916\u6587\u4ef6\uff0c\u4f46\u7531 PostgreSQL \u7ba1\u7406\u7684\u67d0\u4e9b\u4e34\u65f6\u6587\u4ef6\u548c\u64cd\u4f5c\u7cfb\u7edf\u6587\u4ef6\u9664\u5916\u3002\u4e0d\u8fc7\uff0c\u53ea\u6709\u666e\u901a\u6587\u4ef6\u548c\u76ee\u5f55\u4f1a\u88ab\u590d\u5236\uff0c\u4f46\u7528\u4e8e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u4f1a\u88ab\u4fdd\u7559\u3002\u6307\u5411 PostgreSQL \u5df2\u77e5\u7684\u67d0\u4e9b\u76ee\u5f55\u7684\u7b26\u53f7\u94fe\u63a5\u4f1a\u88ab\u590d\u5236\u4e3a\u7a7a\u76ee\u5f55\u3002\u5176\u4ed6\u7b26\u53f7\u94fe\u63a5\u548c\u7279\u6b8a\u8bbe\u5907\u6587\u4ef6\u5219\u4f1a\u88ab\u8df3\u8fc7\u3002\u5177\u4f53\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/15/protocol-replication.html\" title=\"55.4.\u00a0\u6d41\u590d\u5236\u534f\u8bae\">\u7b2c\u00a055.4\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5728\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u4e2d\uff0c\u9664\u975e\u4f7f\u7528\u4e86<code class=\"literal\">--tablespace-mapping</code>\u9009\u9879\uff0c\u5426\u5219\u8868\u7a7a\u95f4\u4f1a\u5907\u4efd\u5230\u5176\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u7684\u76f8\u540c\u8def\u5f84\u3002\u5982\u679c\u4e0d\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u90a3\u4e48\u5f53\u8868\u7a7a\u95f4\u6b63\u5728\u4f7f\u7528\u65f6\uff0c\u5c31\u65e0\u6cd5\u5728\u4e0e\u670d\u52a1\u5668\u76f8\u540c\u7684\u4e3b\u673a\u4e0a\u6267\u884c\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u7684\u57fa\u7840\u5907\u4efd\uff0c\u56e0\u4e3a\u5907\u4efd\u5c06\u4e0d\u5f97\u4e0d\u5199\u5165\u4e0e\u539f\u59cb\u8868\u7a7a\u95f4\u76f8\u540c\u7684\u76ee\u5f55\u4f4d\u7f6e\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u7528\u6237\u9700\u8981\u5728\u542f\u52a8\u4f7f\u7528\u8fd9\u4e9b\u6570\u636e\u7684 PostgreSQL \u670d\u52a1\u5668\u4e4b\u524d\uff0c\u81ea\u884c\u89e3\u5f00\u6bcf\u4e2a tar \u6587\u4ef6\u3002\u5982\u679c\u5b58\u5728\u989d\u5916\u7684\u8868\u7a7a\u95f4\uff0c\u5fc5\u987b\u5c06\u5bf9\u5e94\u7684 tar \u6587\u4ef6\u89e3\u538b\u5230\u6b63\u786e\u4f4d\u7f6e\u3002\u6b64\u65f6\uff0c\u670d\u52a1\u5668\u4f1a\u6839\u636e base.tar \u4e2d tablespace_map \u6587\u4ef6\u7684\u5185\u5bb9\uff0c\u4e3a\u8fd9\u4e9b\u8868\u7a7a\u95f4\u521b\u5efa\u7b26\u53f7\u94fe\u63a5\u3002</p>\n<p lang=\"zh\">pg_basebackup \u53ef\u4e0e\u76f8\u540c\u6216\u66f4\u65e9\u4e3b\u8981\u7248\u672c\u7684\u670d\u52a1\u5668\u914d\u5408\u4f7f\u7528\uff0c\u6700\u4f4e\u652f\u6301 9.1\u3002\u4e0d\u8fc7\uff0cWAL \u6d41\u5f0f\u4f20\u8f93\u6a21\u5f0f\uff08-X stream\uff09\u53ea\u9002\u7528\u4e8e 9.3 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\uff0ctar \u683c\u5f0f\uff08--format=tar\uff09\u53ea\u9002\u7528\u4e8e 9.5 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6e90\u96c6\u7c07\u542f\u7528\u4e86\u6570\u636e\u6587\u4ef6\u7684\u7ec4\u6743\u9650\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u4fdd\u7559\u8fd9\u4e9b\u7ec4\u6743\u9650\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.9\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u8981\u4e3a\u670d\u52a1\u5668<code class=\"literal\">mydbserver</code>\u521b\u5efa\u4e00\u4e2a\u57fa\u7840\u5907\u4efd\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5230\u672c\u5730\u76ee\u5f55<code class=\"filename\">/usr/local/pgsql/data</code>\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -h mydbserver -D /usr/local/pgsql/data</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u672c\u5730\u670d\u52a1\u5668\u521b\u5efa\u4e00\u4e2a\u5907\u4efd\uff0c\u4e3a\u6bcf\u4e2a\u8868\u7a7a\u95f4\u5404\u751f\u6210\u4e00\u4e2a\u538b\u7f29\u7684 tar \u6587\u4ef6\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5728\u76ee\u5f55<code class=\"filename\">backup</code>\u4e2d\uff0c\u540c\u65f6\u5728\u8fd0\u884c\u671f\u95f4\u663e\u793a\u8fdb\u5ea6\u62a5\u544a\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup -Ft -z -P</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u4e00\u4e2a\u4ec5\u5305\u542b\u5355\u4e2a\u8868\u7a7a\u95f4\u7684\u672c\u5730\u6570\u636e\u5e93\u521b\u5efa\u5907\u4efd\uff0c\u5e76\u4f7f\u7528<span class=\"productname\">bzip2</span>\u8fdb\u884c\u538b\u7f29\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D - -Ft -X fetch | bzip2 &gt; backup.tar.bz2</code></strong>\n</pre>\n<p lang=\"zh\">\uff08\u5982\u679c\u8be5\u6570\u636e\u5e93\u4e2d\u6709\u591a\u4e2a\u8868\u7a7a\u95f4\uff0c\u6b64\u547d\u4ee4\u5c06\u5931\u8d25\u3002\uff09</p>\n<p lang=\"zh\">\u8981\u521b\u5efa\u4e00\u4e2a\u672c\u5730\u6570\u636e\u5e93\u7684\u5907\u4efd\uff0c\u5e76\u5c06\u4f4d\u4e8e<code class=\"filename\">/opt/ts</code>\u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230<code class=\"filename\">./backup/ts</code>\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup/data -T /opt/ts=$(pwd)/backup/ts</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u672c\u5730\u670d\u52a1\u5668\u521b\u5efa\u4e00\u4e2a\u5907\u4efd\uff0c\u4e3a\u6bcf\u4e2a\u8868\u7a7a\u95f4\u751f\u6210\u4e00\u4e2a tar \u6587\u4ef6\uff0c\u5e76\u4f7f\u7528<span class=\"application\">gzip</span>\u4ee5 9 \u7ea7\u538b\u7f29\u540e\u5b58\u50a8\u5230\u76ee\u5f55<code class=\"filename\">backup</code>\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup -Ft --compress=gzip:9</code></strong>\n</pre>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.10\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/15/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/15/progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING\" title=\"28.4.5.\u00a0Base Backup Progress Reporting\">Section\u00a028.4.5</a></span>\n</div>\n</div></div>", "manual_path": "app-pgbasebackup.html", "localization": {"status": "complete", "sources": [{"url": "/docs/15/app-pgbasebackup.html", "method": "same-major semantic node", "sha256": "5cf0b02f2ac2af7a2e6e19b155ceb36e5779c116b08edae57d2a1df0931b8672", "language": "zh", "matched_nodes": ["#APP-PGBASEBACKUP/div[2]/p[1]", "#APP-PGBASEBACKUP/div[3]/h2[0]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[0]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[1]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[2]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[3]", "#APP-PGBASEBACKUP/div[4]/p[1]", "#APP-PGBASEBACKUP/div[4]/p[2]", "#APP-PGBASEBACKUP/div[4]/p[3]", "#APP-PGBASEBACKUP/div[4]/p[4]", "#APP-PGBASEBACKUP/div[4]/p[5]", "#APP-PGBASEBACKUP/div[4]/p[6]", "#APP-PGBASEBACKUP/div[4]/p[8]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/div[2]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/div[2]/dl[0]/dd[3]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/div[2]/dl[0]/dd[5]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/div[2]/dl[0]/dd[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/div[2]/dl[0]/dd[5]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[17]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[17]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[17]/p[3]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[17]/p[4]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[3]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[5]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[7]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[7]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[17]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[19]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[19]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[19]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[19]/p[3]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[21]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[23]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[23]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[25]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[27]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[27]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[27]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[29]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[29]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[7]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[7]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[7]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[8]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[8]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/p[3]", "#APP-PGBASEBACKUP/div[5]/p[5]", "#APP-PGBASEBACKUP/div[5]/p[7]", "#APP-PGBASEBACKUP/div[6]/h2[0]", "#APP-PGBASEBACKUP/div[6]/p[1]", "#APP-PGBASEBACKUP/div[6]/p[2]", "#APP-PGBASEBACKUP/div[7]/h2[0]", "#APP-PGBASEBACKUP/div[7]/p[1]", "#APP-PGBASEBACKUP/div[7]/p[2]", "#APP-PGBASEBACKUP/div[7]/p[3]", "#APP-PGBASEBACKUP/div[7]/p[6]", "#APP-PGBASEBACKUP/div[8]/h2[0]", "#APP-PGBASEBACKUP/div[8]/p[10]", "#APP-PGBASEBACKUP/div[8]/p[1]", "#APP-PGBASEBACKUP/div[8]/p[3]", "#APP-PGBASEBACKUP/div[8]/p[5]", "#APP-PGBASEBACKUP/div[8]/p[7]", "#APP-PGBASEBACKUP/div[8]/p[8]", "#APP-PGBASEBACKUP/div[9]/h2[0]"]}], "language": "zh", "original_text": {"/versions/15/description/0": "pg_basebackup \u2014 take a base backup of a PostgreSQL cluster", "/versions/15/facts/0/label": "Documented executable", "/versions/15/facts/1/label": "Executable version", "/versions/15/facts/2/label": "Reference inventory", "/versions/15/facts/2/value": "Client applications", "/versions/15/facts/3/label": "Option definition groups", "/versions/15/tables/0/title": "Documented options", "/versions/15/related/0/label": "libpq connection parameters", "/versions/15/tables/0/rows/0/summary": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty.", "/versions/15/tables/0/rows/1/summary": "Selects the format for the output. format can be one of the following:", "/versions/15/tables/0/rows/2/summary": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup.", "/versions/15/tables/0/rows/3/summary": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup.", "/versions/15/tables/0/rows/4/summary": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces.", "/versions/15/tables/0/rows/5/summary": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format.", "/versions/15/tables/0/rows/6/summary": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the log archive, thus making the output a completely standalone backup.", "/versions/15/tables/0/rows/7/summary": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "/versions/15/tables/0/rows/8/summary": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch .", "/versions/15/tables/0/rows/9/summary": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 26.3.3 ).", "/versions/15/tables/0/columns/0/label": "Option and arguments", "/versions/15/tables/0/columns/1/label": "Description", "/versions/15/tables/0/rows/10/summary": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists.", "/versions/15/tables/0/rows/11/summary": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used.", "/versions/15/tables/0/rows/12/summary": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging.", "/versions/15/tables/0/rows/13/summary": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.", "/versions/15/tables/0/rows/14/summary": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.", "/versions/15/tables/0/rows/15/summary": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second.", "/versions/15/tables/0/rows/16/summary": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby.", "/versions/15/tables/0/rows/17/summary": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.", "/versions/15/tables/0/rows/18/summary": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C .", "/versions/15/tables/0/rows/19/summary": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case.", "/versions/15/tables/0/rows/20/summary": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL .", "/versions/15/tables/0/rows/21/summary": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file.", "/versions/15/tables/0/rows/22/summary": "Prevents the creation of a temporary replication slot for the backup.", "/versions/15/tables/0/rows/23/summary": "Disables verification of checksums, if they are enabled on the server the base backup is taken from.", "/versions/15/tables/0/rows/24/summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "/versions/15/tables/0/rows/25/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "/versions/15/tables/0/rows/26/summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "/versions/15/tables/0/rows/27/summary": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds.", "/versions/15/tables/0/rows/28/summary": "Specifies the user name to connect as.", "/versions/15/tables/0/rows/29/summary": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/15/tables/0/rows/30/summary": "Forces pg_basebackup to prompt for a password before connecting to the source server.", "/versions/15/tables/0/rows/31/summary": "Prints the pg_basebackup version and exits.", "/versions/15/tables/0/rows/32/summary": "Shows help about pg_basebackup command line arguments, and exits."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "f0903e7d47a04e99dcb4bef976e177de1786d039e240dd30309af4c246da3d05"}, "comparison_data": {"options": [{"names": ["-D directory", "--pgdata= directory"], "signature": "-D directory --pgdata= directory", "description": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty. When the backup is in tar format, the target directory may be specified as - (dash), causing the tar file to be written to stdout . This option is required."}, {"names": ["-F format", "--format= format"], "signature": "-F format --format= format", "description": "Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the source server's data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory's contents will be written to a file named base.tar , and each other tablespace will be written to a separate tar file named after that tablespace's OID. If the target directory is specified as - (dash), the tar contents will be written to standard output, suitable for piping to (for example) gzip . This is only allowed if the cluster has no additional tablespaces and WAL streaming is not used."}, {"names": ["-R", "--write-recovery-conf"], "signature": "-R --write-recovery-conf", "description": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup. The postgresql.auto.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that streaming replication will use the same settings later on."}, {"names": ["-t target", "--target= target"], "signature": "-t target --target= target", "description": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup. Since WAL streaming is implemented by pg_basebackup rather than by the server, this option cannot be used together with -Xstream . Since that is the default, when this option is specified, you must also specify either -Xfetch or -Xnone ."}, {"names": ["-T olddir = newdir", "--tablespace-mapping= olddir = newdir"], "signature": "-T olddir = newdir --tablespace-mapping= olddir = newdir", "description": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected."}, {"names": ["--waldir= waldir"], "signature": "--waldir= waldir", "description": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format."}, {"names": ["-X method", "--wal-method= method"], "signature": "-X method --wal-method= method", "description": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the log archive, thus making the output a completely standalone backup. The following method s for collecting the write-ahead logs are supported: n none Don't include write-ahead logs in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the source server's wal_keep_size parameter to be set high enough that the required log data is not removed before the end of the backup. If the required log data has been recycled before it's time to transfer it, the backup will fail and be unusable. When tar format is used, the write-ahead log files will be included in the base.tar file. s stream Stream write-ahead log data while the backup is being taken. This method will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will require two replication connections not just one. As long as the client can keep up with the write-ahead log data, using this method requires no extra write-ahead logs to be saved on the source server. When tar format is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default."}, {"names": ["-z", "--gzip"], "signature": "-z --gzip", "description": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-Z level", "-Z [{client|server}-] method [: detail ]", "--compress= level", "--compress=[{client|server}-] method [: detail ]"], "signature": "-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]", "description": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch . The compression method can be set to gzip , lz4 , zstd , or none for no compression. A compression detail string can optionally be specified. If the detail string is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form keyword or keyword=value . Currently, the supported keywords are level and workers . If no compression level is specified, the default compression level will be used. If only a level is specified without mentioning an algorithm, gzip compression will be used if the level is greater than 0, and no compression will be used if the level is 0. When the tar format is used with gzip , lz4 , or zstd , the suffix .gz , .lz4 , or .zst , respectively, will be automatically added to all tar filenames. When the plain format is used, client-side compression may not be specified, but it is still possible to request server-side compression. If this is done, the server will compress the backup for transmission, and the client will decompress and extract it. When this option is used in combination with -Xstream , pg_wal.tar will be compressed using gzip if client-side gzip compression is selected, but will not be compressed if any other compression algorithm is selected, or if server-side compression is selected."}, {"names": ["-c {fast|spread}", "--checkpoint={fast|spread}"], "signature": "-c {fast|spread} --checkpoint={fast|spread}", "description": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 26.3.3 )."}, {"names": ["-C", "--create-slot"], "signature": "-C --create-slot", "description": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists."}, {"names": ["-l label", "--label= label"], "signature": "-l label --label= label", "description": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used."}, {"names": ["-n", "--no-clean"], "signature": "-n --no-clean", "description": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way."}, {"names": ["-N", "--no-sync"], "signature": "-N --no-sync", "description": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."}, {"names": ["-P", "--progress"], "signature": "-P --progress", "description": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL."}, {"names": ["-r rate", "--max-rate= rate"], "signature": "-r rate --max-rate= rate", "description": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch ."}, {"names": ["-S slotname", "--slot= slotname"], "signature": "-S slotname --slot= slotname", "description": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby. The specified replication slot has to exist unless the option -C is also used. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."}, {"names": ["--manifest-checksums= algorithm"], "signature": "--manifest-checksums= algorithm", "description": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C . If NONE is selected, the backup manifest will not contain any checksums. Otherwise, it will contain a checksum of each file in the backup using the specified algorithm. In addition, the manifest will always contain a SHA256 checksum of its own contents. The SHA algorithms are significantly more CPU-intensive than CRC32C , so selecting one of them may increase the time required to complete the backup. Using a SHA hash function provides a cryptographically secure digest of each file for users who wish to verify that the backup has not been tampered with, while the CRC32C algorithm provides a checksum that is much faster to calculate; it is good at catching errors due to accidental changes but is not resistant to malicious modifications. Note that, to be useful against an adversary who has access to the backup, the backup manifest would need to be stored securely elsewhere or otherwise verified not to have been modified since the backup was taken. pg_verifybackup can be used to check the integrity of a backup against the backup manifest."}, {"names": ["--manifest-force-encode"], "signature": "--manifest-force-encode", "description": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case."}, {"names": ["--no-estimate-size"], "signature": "--no-estimate-size", "description": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL . Without this option, the backup will start by enumerating the size of the entire database, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent. This option is useful to avoid such estimation time if it's too long. This option is not allowed when using --progress ."}, {"names": ["--no-manifest"], "signature": "--no-manifest", "description": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file."}, {"names": ["--no-slot"], "signature": "--no-slot", "description": "Prevents the creation of a temporary replication slot for the backup. By default, if log streaming is selected but no slot name is given with the -S option, then a temporary replication slot is created (if supported by the source server). The main purpose of this option is to allow taking a base backup when the server has no free replication slots. Using a replication slot is almost always preferred, because it prevents needed WAL from being removed by the server during the backup."}, {"names": ["--no-verify-checksums"], "signature": "--no-verify-checksums", "description": "Disables verification of checksums, if they are enabled on the server the base backup is taken from. By default, checksums are verified and checksum failures will result in a non-zero exit status. However, the base backup will not be removed in such a case, as if the --no-clean option had been used. Checksum verification failures will also be reported in the pg_stat_database view."}, {"names": ["-d connstr", "--dbname= connstr"], "signature": "-d connstr --dbname= connstr", "description": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. The option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, any database name in the connection string will be ignored."}, {"names": ["-h host", "--host= host"], "signature": "-h host --host= host", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-s interval", "--status-interval= interval"], "signature": "-s interval --status-interval= interval", "description": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Specifies the user name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Forces pg_basebackup to prompt for a password before connecting to the source server. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Prints the pg_basebackup version and exits."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Shows help about pg_basebackup command line arguments, and exits."}], "synopsis": ["pg_basebackup [ option ...]"], "environment": []}, "comparison_hash": "52a98f3fe5e39d56f4448675cf6e77682c6a4edec033f5c0a381ffb6f6081ad5", "manual_language": "zh"}, "16": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_basebackup"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "16.15"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "33"}], "tables": [{"key": "options", "rows": [{"summary": "\u8bbe\u7f6e\u5199\u5165\u8f93\u51fa\u7684\u76ee\u6807\u76ee\u5f55\u3002\u5982\u679c\u8be5\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c pg_basebackup \u4f1a\u521b\u5efa\u5b83\uff08\u4ee5\u53ca\u6240\u6709\u7f3a\u5931\u7684\u7236\u76ee\u5f55\uff09\u3002\u5982\u679c\u8be5\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-D directory --pgdata= directory"}}, {"summary": "\u9009\u62e9\u8f93\u51fa\u683c\u5f0f\u3002 format \u53ef\u4ee5\u662f\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-F format --format= format"}}, {"summary": "\u521b\u5efa standby.signal \u6587\u4ef6\uff0c\u5e76\u5c06\u8fde\u63a5\u8bbe\u7f6e\u8ffd\u52a0\u5230\u76ee\u6807\u76ee\u5f55\u4e2d\u7684 postgresql.auto.conf \u6587\u4ef6\u4e2d\uff08\u5982\u679c\u4f7f\u7528 tar \u683c\u5f0f\uff0c\u5219\u8ffd\u52a0\u5230\u57fa\u7840\u5f52\u6863\u6587\u4ef6\u5185\uff09\u3002\u8fd9\u6837\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u5229\u7528\u5907\u4efd\u7ed3\u679c\u642d\u5efa\u5907\u5e93\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-R --write-recovery-conf"}}, {"summary": "\u6307\u793a\u670d\u52a1\u5668\u5c06\u57fa\u7840\u5907\u4efd\u653e\u5230\u54ea\u91cc\u3002\u9ed8\u8ba4\u76ee\u6807\u662f client \uff0c\u8868\u793a\u5907\u4efd\u5e94\u53d1\u9001\u5230\u8fd0\u884c pg_basebackup \u7684\u90a3\u53f0\u673a\u5668\u3002\u5982\u679c\u76ee\u6807\u6539\u4e3a server:/some/path \uff0c\u5219\u5907\u4efd\u4f1a\u5b58\u50a8\u5728\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684 /some/path \u76ee\u5f55\u4e2d\u3002\u5c06\u5907\u4efd\u5b58\u50a8\u5728\u670d\u52a1\u5668\u4e0a\u9700\u8981\u8d85\u7ea7\u7528\u6237\u6743\u9650\uff0c\u6216\u62e5\u6709 pg_write_server_files \u89d2\u8272\u7684\u6743\u9650\u3002\u5982\u679c\u76ee\u6807\u8bbe\u7f6e\u4e3a blackhole \uff0c\u5219\u5185\u5bb9\u4f1a\u88ab\u4e22\u5f03\uff0c\u4e0d\u4f1a\u5b58\u50a8\u5230\u4efb\u4f55\u5730\u65b9\u3002\u8fd9\u53ea\u5e94\u7528\u4e8e\u6d4b\u8bd5\u76ee\u7684\uff0c\u56e0\u4e3a\u6700\u7ec8\u4e0d\u4f1a\u5f97\u5230\u5b9e\u9645\u5907\u4efd\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-t target --target= target"}}, {"summary": "\u5728\u5907\u4efd\u671f\u95f4\uff0c\u5c06\u76ee\u5f55 olddir \u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230 newdir \u3002\u8981\u4f7f\u6b64\u9009\u9879\u751f\u6548\uff0c olddir \u5fc5\u987b\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u5b9a\u4e49\u7684\u8be5\u8868\u7a7a\u95f4\u8def\u5f84\u5b8c\u5168\u4e00\u81f4\u3002\uff08\u4f46\u5982\u679c\u6e90\u670d\u52a1\u5668\u4e0a\u5728 olddir \u4e2d\u6ca1\u6709\u8868\u7a7a\u95f4\uff0c\u4e5f\u4e0d\u7b97\u9519\u8bef\u3002\uff09\u4e0e\u6b64\u540c\u65f6\uff0c newdir \u662f\u63a5\u6536\u4e3b\u673a\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u4e00\u4e2a\u76ee\u5f55\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c newdir \u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002 olddir \u548c newdir \u90fd\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u5982\u679c\u4efb\u4e00\u8def\u5f84\u4e2d\u9700\u8981\u5305\u542b\u7b49\u53f7\uff08 = \uff09\uff0c\u8bf7\u5728\u5176\u524d\u9762\u52a0\u4e0a\u53cd\u659c\u6760\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u4ee5\u5904\u7406\u591a\u4e2a\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-T olddir = newdir --tablespace-mapping= olddir = newdir"}}, {"summary": "\u8bbe\u7f6e\u5199\u5165 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cWAL \u6587\u4ef6\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u7684 pg_wal \u5b50\u76ee\u5f55\u4e2d\uff0c\u4f46\u6b64\u9009\u9879\u53ef\u7528\u4e8e\u5c06\u5176\u653e\u5728\u5176\u4ed6\u4f4d\u7f6e\u3002 waldir \u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c waldir \u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002\u53ea\u6709\u5f53\u5907\u4efd\u91c7\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u624d\u80fd\u6307\u5b9a\u6b64\u9009\u9879\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "--waldir= waldir"}}, {"summary": "\u5728\u5907\u4efd\u4e2d\u5305\u542b\u6240\u9700\u7684 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u3002\u8fd9\u5c06\u5305\u62ec\u5907\u4efd\u671f\u95f4\u751f\u6210\u7684\u6240\u6709\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u9664\u975e\u6307\u5b9a\u65b9\u6cd5 none \uff0c\u5426\u5219\u5c31\u53ef\u4ee5\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u542f\u52a8 postmaster\uff0c\u800c\u65e0\u9700\u67e5\u9605 WAL \u5f52\u6863\uff0c\u4ece\u800c\u4f7f\u8f93\u51fa\u6210\u4e3a\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u5907\u4efd\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-X method --wal-method= method"}}, {"summary": "\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u4f7f\u7528\u9ed8\u8ba4\u538b\u7f29\u7ea7\u522b\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0 .gz \u540e\u7f00\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-z --gzip"}}, {"summary": "\u8bf7\u6c42\u5bf9\u5907\u4efd\u8fdb\u884c\u538b\u7f29\u3002\u5982\u679c\u5305\u542b client \u6216 server \uff0c\u5219\u6307\u5b9a\u538b\u7f29\u6267\u884c\u7684\u4f4d\u7f6e\u3002\u5728\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4f1a\u51cf\u5c11\u4f20\u8f93\u5e26\u5bbd\u5360\u7528\uff0c\u4f46\u4f1a\u589e\u52a0\u670d\u52a1\u5668 CPU \u6d88\u8017\u3002\u9ed8\u8ba4\u503c\u662f client \uff0c\u4f46\u4f7f\u7528 --target \u65f6\u9664\u5916\uff1b\u6b64\u65f6\u5907\u4efd\u4e0d\u4f1a\u53d1\u9001\u5230\u5ba2\u6237\u7aef\uff0c\u56e0\u6b64\u53ea\u6709\u670d\u52a1\u5668\u7aef\u538b\u7f29\u624d\u6709\u610f\u4e49\u3002\u4f7f\u7528\u9ed8\u8ba4\u7684 -Xstream \u65f6\uff0c\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4e0d\u4f1a\u5e94\u7528\u4e8e WAL\u3002\u82e5\u8981\u538b\u7f29 WAL\uff0c\u8bf7\u4f7f\u7528\u5ba2\u6237\u7aef\u538b\u7f29\uff0c\u6216\u8005\u6307\u5b9a -Xfetch \u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]"}}, {"summary": "\u5c06\u68c0\u67e5\u70b9\u6a21\u5f0f\u8bbe\u7f6e\u4e3a fast\uff08\u7acb\u5373\uff09\u6216 spread\uff08\u9ed8\u8ba4\uff09\uff08\u89c1 \u7b2c 26.3.3 \u8282 \uff09\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-c {fast|spread} --checkpoint={fast|spread}"}}, {"summary": "\u6307\u5b9a\u5728\u5f00\u59cb\u5907\u4efd\u4e4b\u524d\uff0c\u5e94\u521b\u5efa\u7531 --slot \u9009\u9879\u6307\u5b9a\u540d\u79f0\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u8be5\u69fd\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u9519\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-C --create-slot"}}, {"summary": "\u8bbe\u7f6e\u5907\u4efd\u6807\u7b7e\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u503c \u201c pg_basebackup base backup \u201d \u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-l label --label= label"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53 pg_basebackup \u56e0\u9519\u8bef\u4e2d\u6b62\u65f6\uff0c\u5b83\u4f1a\u5220\u9664\u5728\u53d1\u73b0\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u76ee\u5f55\uff08\u4f8b\u5982\u76ee\u6807\u76ee\u5f55\u548c\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\uff09\u3002\u6b64\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u5f88\u6709\u5e2e\u52a9\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-n --no-clean"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_basebackup \u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u88ab\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f1a\u4f7f pg_basebackup \u4e0d\u7ecf\u7b49\u5f85\u5c31\u76f4\u63a5\u8fd4\u56de\uff0c\u56e0\u6b64\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u968f\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u57fa\u7840\u5907\u4efd\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u5408\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-N --no-sync"}}, {"summary": "\u542f\u7528\u8fdb\u5ea6\u62a5\u544a\u3002\u6253\u5f00\u6b64\u9009\u9879\u540e\uff0c\u4f1a\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u7ed9\u51fa\u4e00\u4e2a\u8fd1\u4f3c\u7684\u8fdb\u5ea6\u62a5\u544a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u53d1\u751f\u53d8\u5316\uff0c\u56e0\u6b64\u8fd9\u53ea\u662f\u8fd1\u4f3c\u503c\uff0c\u6700\u7ec8\u672a\u5fc5\u6070\u597d\u7ed3\u675f\u5728 100% \u3002\u7279\u522b\u662f\u5f53\u5907\u4efd\u4e2d\u5305\u542b WAL \u65f6\uff0c\u603b\u6570\u636e\u91cf\u65e0\u6cd5\u9884\u5148\u4f30\u8ba1\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u65e6\u8fdb\u5ea6\u8d85\u8fc7\u4e0d\u542b WAL \u65f6\u7684\u603b\u4f30\u8ba1\u503c\uff0c\u4f30\u8ba1\u76ee\u6807\u5927\u5c0f\u5c31\u4f1a\u7ee7\u7eed\u589e\u52a0\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-P --progress"}}, {"summary": "\u8bbe\u7f6e\u4ece\u6e90\u670d\u52a1\u5668\u6536\u96c6\u6570\u636e\u65f6\u5141\u8bb8\u7684\u6700\u5927\u4f20\u8f93\u901f\u7387\u3002\u8fd9\u6709\u52a9\u4e8e\u9650\u5236 pg_basebackup \u5bf9\u670d\u52a1\u5668\u7684\u5f71\u54cd\u3002\u53d6\u503c\u5355\u4f4d\u4e3a\u6bcf\u79d2\u5343\u5b57\u8282\u3002\u4f7f\u7528\u540e\u7f00 M \u8868\u793a\u6bcf\u79d2\u5146\u5b57\u8282\u3002\u4e5f\u63a5\u53d7\u540e\u7f00 k \uff0c\u4f46\u6ca1\u6709\u5b9e\u9645\u5f71\u54cd\u3002\u6709\u6548\u53d6\u503c\u8303\u56f4\u4e3a\u6bcf\u79d2 32 \u5343\u5b57\u8282\u5230\u6bcf\u79d2 1024 \u5146\u5b57\u8282\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-r rate --max-rate= rate"}}, {"summary": "\u6b64\u9009\u9879\u53ea\u80fd\u4e0e -X stream \u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u4f1a\u4f7f WAL \u6d41\u5f0f\u4f20\u8f93\u4f7f\u7528\u6307\u5b9a\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u6b64\u57fa\u7840\u5907\u4efd\u6253\u7b97\u7528\u4f5c\u4f7f\u7528\u590d\u5236\u69fd\u7684\u6d41\u590d\u5236\u5907\u5e93\uff0c\u90a3\u4e48\u8be5\u5907\u5e93\u5e94\u5c06\u540c\u4e00\u4e2a\u590d\u5236\u69fd\u540d\u79f0\u7528\u4f5c primary_slot_name \u7684\u503c\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u4e3b\u5e93\u5728\u57fa\u7840\u5907\u4efd\u7ed3\u675f\u4e0e\u65b0\u5907\u5e93\u5f00\u59cb\u6d41\u590d\u5236\u4e4b\u95f4\u7684\u8fd9\u6bb5\u65f6\u95f4\u5185\uff0c\u4e0d\u4f1a\u79fb\u9664\u4efb\u4f55\u5fc5\u9700\u7684 WAL \u6570\u636e\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-S slotname --slot= slotname"}}, {"summary": "\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\u3002\u5b83\u4f1a\u5728\u542f\u52a8\u548c\u5173\u95ed\u8fc7\u7a0b\u4e2d\u8f93\u51fa\u4e00\u4e9b\u989d\u5916\u6b65\u9aa4\uff1b\u5982\u679c\u540c\u65f6\u542f\u7528\u4e86\u8fdb\u5ea6\u62a5\u544a\uff0c\u8fd8\u4f1a\u663e\u793a\u5f53\u524d\u6b63\u5728\u5904\u7406\u7684\u786e\u5207\u6587\u4ef6\u540d\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-v --verbose"}}, {"summary": "\u6307\u5b9a\u5e94\u7528\u5230\u5907\u4efd\u6e05\u5355\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u7684\u6821\u9a8c\u548c\u7b97\u6cd5\u3002\u76ee\u524d\u53ef\u7528\u7684\u7b97\u6cd5\u6709 NONE \u3001 CRC32C \u3001 SHA224 \u3001 SHA256 \u3001 SHA384 \u548c SHA512 \u3002\u9ed8\u8ba4\u503c\u4e3a CRC32C \u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "--manifest-checksums= algorithm"}}, {"summary": "\u5f3a\u5236\u5c06\u5907\u4efd\u6e05\u5355\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u540d\u7f16\u7801\u4e3a\u5341\u516d\u8fdb\u5236\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u5bf9\u975e UTF8 \u6587\u4ef6\u540d\u8fdb\u884c\u5341\u516d\u8fdb\u5236\u7f16\u7801\u3002\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u8bfb\u53d6\u5907\u4efd\u6e05\u5355\u6587\u4ef6\u7684\u5de5\u5177\u662f\u5426\u80fd\u6b63\u786e\u5904\u7406\u8fd9\u79cd\u60c5\u51b5\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "--manifest-force-encode"}}, {"summary": "\u7981\u6b62\u670d\u52a1\u5668\u4f30\u7b97\u5c06\u8981\u6d41\u5f0f\u4f20\u8f93\u7684\u5907\u4efd\u6570\u636e\u603b\u91cf\uff0c\u56e0\u6b64 pg_stat_progress_basebackup \u89c6\u56fe\u4e2d\u7684 backup_total \u5217\u59cb\u7ec8\u4e3a NULL\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "--no-estimate-size"}}, {"summary": "\u7981\u6b62\u751f\u6210\u5907\u4efd\u6e05\u5355\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u670d\u52a1\u5668\u5c06\u751f\u6210\u5e76\u53d1\u9001\u4e00\u4e2a\u5907\u4efd\u6e05\u5355\uff0c\u53ef\u4f7f\u7528 pg_verifybackup \u8fdb\u884c\u9a8c\u8bc1\u3002\u8be5\u6e05\u5355\u5217\u51fa\u4e86\u5907\u4efd\u4e2d\u7684\u6bcf\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u4e0d\u5305\u62ec\u53ef\u80fd\u5305\u542b\u5728\u5176\u4e2d\u7684\u4efb\u4f55 WAL \u6587\u4ef6\u3002\u5b83\u8fd8\u4f1a\u4fdd\u5b58\u6bcf\u4e2a\u6587\u4ef6\u7684\u5927\u5c0f\u3001\u6700\u540e\u4fee\u6539\u65f6\u95f4\u4ee5\u53ca\u53ef\u9009\u7684\u6821\u9a8c\u548c\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "--no-manifest"}}, {"summary": "\u9632\u6b62\u4e3a\u5907\u4efd\u521b\u5efa\u4e34\u65f6\u590d\u5236\u69fd\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "--no-slot"}}, {"summary": "\u5982\u679c\u83b7\u53d6\u57fa\u7840\u5907\u4efd\u7684\u670d\u52a1\u5668\u542f\u7528\u4e86\u6821\u9a8c\u548c\uff0c\u5219\u7981\u7528\u5bf9\u8fd9\u4e9b\u6821\u9a8c\u548c\u7684\u9a8c\u8bc1\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "--no-verify-checksums"}}, {"summary": "\u4ee5 \u8fde\u63a5\u5b57\u7b26\u4e32 \u7684\u5f62\u5f0f\u6307\u5b9a\u7528\u4e8e\u8fde\u63a5\u670d\u52a1\u5668\u7684\u53c2\u6570\uff1b\u8fd9\u4e9b\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u76f8\u4e92\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-d connstr --dbname= connstr"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGHOST \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff1b\u5426\u5219\u4f1a\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-h host --host= host"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u6240\u4f7f\u7528\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u4e2d\u7684\u503c\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u786e\u5b9a\u7684\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-p port --port= port"}}, {"summary": "\u6307\u5b9a\u53d1\u9001\u56de\u6e90\u670d\u52a1\u5668\u7684\u72b6\u6001\u5305\u4e4b\u95f4\u76f8\u9694\u7684\u79d2\u6570\u3002\u8f83\u5c0f\u7684\u503c\u53ef\u4ee5\u8ba9\u670d\u52a1\u5668\u7aef\u5bf9\u5907\u4efd\u8fdb\u5ea6\u7684\u76d1\u63a7\u66f4\u7cbe\u786e\u3002\u503c\u4e3a\u96f6\u65f6\u4f1a\u5b8c\u5168\u7981\u7528\u5468\u671f\u6027\u72b6\u6001\u66f4\u65b0\uff0c\u4e0d\u8fc7\u5f53\u670d\u52a1\u5668\u8bf7\u6c42\u65f6\u4ecd\u4f1a\u53d1\u9001\u66f4\u65b0\uff0c\u4ee5\u907f\u514d\u56e0\u8d85\u65f6\u800c\u65ad\u5f00\u8fde\u63a5\u3002\u9ed8\u8ba4\u503c\u662f 10 \u79d2\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-s interval --status-interval= interval"}}, {"summary": "\u6307\u5b9a\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-U username --username= username"}}, {"summary": "\u7981\u6b62\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\uff08\u4f8b\u5982 .pgpass \u6587\u4ef6\uff09\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u6b64\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u79cd\u573a\u666f\u4e0b\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 pg_basebackup \u5728\u8fde\u63a5\u6e90\u670d\u52a1\u5668\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-W --password"}}, {"summary": "\u8f93\u51fa pg_basebackup \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-V --version"}}, {"summary": "\u663e\u793a pg_basebackup \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/16/app-pgbasebackup.html", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}], "options": [{"names": ["-D directory", "--pgdata= directory"], "summary": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty.", "signature": "-D directory --pgdata= directory", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty. When the backup is in tar format, the target directory may be specified as - (dash), causing the tar file to be written to stdout . This option is required."}, {"names": ["-F format", "--format= format"], "summary": "Selects the format for the output. format can be one of the following:", "signature": "-F format --format= format", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the source server's data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory's contents will be written to a file named base.tar , and each other tablespace will be written to a separate tar file named after that tablespace's OID. If the target directory is specified as - (dash), the tar contents will be written to standard output, suitable for piping to (for example) gzip . This is only allowed if the cluster has no additional tablespaces and WAL streaming is not used."}, {"names": ["-R", "--write-recovery-conf"], "summary": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup.", "signature": "-R --write-recovery-conf", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup. The postgresql.auto.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that streaming replication will use the same settings later on."}, {"names": ["-t target", "--target= target"], "summary": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup.", "signature": "-t target --target= target", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup. Since WAL streaming is implemented by pg_basebackup rather than by the server, this option cannot be used together with -Xstream . Since that is the default, when this option is specified, you must also specify either -Xfetch or -Xnone ."}, {"names": ["-T olddir = newdir", "--tablespace-mapping= olddir = newdir"], "summary": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces.", "signature": "-T olddir = newdir --tablespace-mapping= olddir = newdir", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected."}, {"names": ["--waldir= waldir"], "summary": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format.", "signature": "--waldir= waldir", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format."}, {"names": ["-X method", "--wal-method= method"], "summary": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup.", "signature": "-X method --wal-method= method", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup. The following method s for collecting the write-ahead logs are supported: n none Don't include write-ahead logs in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the source server's wal_keep_size parameter to be set high enough that the required log data is not removed before the end of the backup. If the required log data has been recycled before it's time to transfer it, the backup will fail and be unusable. When tar format is used, the write-ahead log files will be included in the base.tar file. s stream Stream write-ahead log data while the backup is being taken. This method will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will require two replication connections not just one. As long as the client can keep up with the write-ahead log data, using this method requires no extra write-ahead logs to be saved on the source server. When tar format is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default."}, {"names": ["-z", "--gzip"], "summary": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "signature": "-z --gzip", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-Z level", "-Z [{client|server}-] method [: detail ]", "--compress= level", "--compress=[{client|server}-] method [: detail ]"], "summary": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch .", "signature": "-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch . The compression method can be set to gzip , lz4 , zstd , none for no compression or an integer (no compression if 0, gzip if greater than 0). A compression detail string can optionally be specified. If the detail string is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form keyword or keyword=value . Currently, the supported keywords are level , long , and workers . The detail string cannot be used when the compression method is specified as a plain integer. If no compression level is specified, the default compression level will be used. If only a level is specified without mentioning an algorithm, gzip compression will be used if the level is greater than 0, and no compression will be used if the level is 0. When the tar format is used with gzip , lz4 , or zstd , the suffix .gz , .lz4 , or .zst , respectively, will be automatically added to all tar filenames. When the plain format is used, client-side compression may not be specified, but it is still possible to request server-side compression. If this is done, the server will compress the backup for transmission, and the client will decompress and extract it. When this option is used in combination with -Xstream , pg_wal.tar will be compressed using gzip if client-side gzip compression is selected, but will not be compressed if any other compression algorithm is selected, or if server-side compression is selected."}, {"names": ["-c {fast|spread}", "--checkpoint={fast|spread}"], "summary": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 26.3.3 ).", "signature": "-c {fast|spread} --checkpoint={fast|spread}", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 26.3.3 )."}, {"names": ["-C", "--create-slot"], "summary": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists.", "signature": "-C --create-slot", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists."}, {"names": ["-l label", "--label= label"], "summary": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used.", "signature": "-l label --label= label", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used."}, {"names": ["-n", "--no-clean"], "summary": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging.", "signature": "-n --no-clean", "source_url": "/docs/16/app-pgbasebackup.html", "description": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way."}, {"names": ["-N", "--no-sync"], "summary": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.", "signature": "-N --no-sync", "source_url": "/docs/16/app-pgbasebackup.html", "description": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."}, {"names": ["-P", "--progress"], "summary": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.", "signature": "-P --progress", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL."}, {"names": ["-r rate", "--max-rate= rate"], "summary": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second.", "signature": "-r rate --max-rate= rate", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch ."}, {"names": ["-S slotname", "--slot= slotname"], "summary": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby.", "signature": "-S slotname --slot= slotname", "source_url": "/docs/16/app-pgbasebackup.html", "description": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby. The specified replication slot has to exist unless the option -C is also used. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming."}, {"names": ["-v", "--verbose"], "summary": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.", "signature": "-v --verbose", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."}, {"names": ["--manifest-checksums= algorithm"], "summary": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C .", "signature": "--manifest-checksums= algorithm", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C . If NONE is selected, the backup manifest will not contain any checksums. Otherwise, it will contain a checksum of each file in the backup using the specified algorithm. In addition, the manifest will always contain a SHA256 checksum of its own contents. The SHA algorithms are significantly more CPU-intensive than CRC32C , so selecting one of them may increase the time required to complete the backup. Using a SHA hash function provides a cryptographically secure digest of each file for users who wish to verify that the backup has not been tampered with, while the CRC32C algorithm provides a checksum that is much faster to calculate; it is good at catching errors due to accidental changes but is not resistant to malicious modifications. Note that, to be useful against an adversary who has access to the backup, the backup manifest would need to be stored securely elsewhere or otherwise verified not to have been modified since the backup was taken. pg_verifybackup can be used to check the integrity of a backup against the backup manifest."}, {"names": ["--manifest-force-encode"], "summary": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case.", "signature": "--manifest-force-encode", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case."}, {"names": ["--no-estimate-size"], "summary": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL .", "signature": "--no-estimate-size", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL . Without this option, the backup will start by enumerating the size of the entire database, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent. This option is useful to avoid such estimation time if it's too long. This option is not allowed when using --progress ."}, {"names": ["--no-manifest"], "summary": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file.", "signature": "--no-manifest", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file."}, {"names": ["--no-slot"], "summary": "Prevents the creation of a temporary replication slot for the backup.", "signature": "--no-slot", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Prevents the creation of a temporary replication slot for the backup. By default, if log streaming is selected but no slot name is given with the -S option, then a temporary replication slot is created (if supported by the source server). The main purpose of this option is to allow taking a base backup when the server has no free replication slots. Using a replication slot is almost always preferred, because it prevents needed WAL from being removed by the server during the backup."}, {"names": ["--no-verify-checksums"], "summary": "Disables verification of checksums, if they are enabled on the server the base backup is taken from.", "signature": "--no-verify-checksums", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Disables verification of checksums, if they are enabled on the server the base backup is taken from. By default, checksums are verified and checksum failures will result in a non-zero exit status. However, the base backup will not be removed in such a case, as if the --no-clean option had been used. Checksum verification failures will also be reported in the pg_stat_database view."}, {"names": ["-d connstr", "--dbname= connstr"], "summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": "-d connstr --dbname= connstr", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. The option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, any database name in the connection string will be ignored."}, {"names": ["-h host", "--host= host"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "signature": "-h host --host= host", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "signature": "-p port --port= port", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-s interval", "--status-interval= interval"], "summary": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds.", "signature": "-s interval --status-interval= interval", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds."}, {"names": ["-U username", "--username= username"], "summary": "Specifies the user name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Specifies the user name to connect as."}, {"names": ["-w", "--no-password"], "summary": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "summary": "Forces pg_basebackup to prompt for a password before connecting to the source server.", "signature": "-W --password", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Forces pg_basebackup to prompt for a password before connecting to the source server. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["-V", "--version"], "summary": "Prints the pg_basebackup version and exits.", "signature": "-V --version", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Prints the pg_basebackup version and exits."}, {"names": ["-?", "--help"], "summary": "Shows help about pg_basebackup command line arguments, and exits.", "signature": "-? --help", "source_url": "/docs/16/app-pgbasebackup.html", "description": "Shows help about pg_basebackup command line arguments, and exits."}], "related": [{"url": "/wiki/conn/?v=16", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v16.15/postgresql-16.15.tar.bz2", "label": "16.15", "major": "16", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/16/postgresql-16-A4.pdf", "bytes": 15282337, "pages": 3055, "sha256": "4bb6c1f63deedac98736d8c4c7bc0fad0ac24e85b07e21ee10411872f06afd06", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/16/postgresql-16-US.pdf", "bytes": 15164148, "pages": 3220, "sha256": "5b6b6166c89991199e144bb0ae34c17a5f29826251dbf19db1abc0df3a3e771b", "built_at": "2026-09-26"}}, "tree": "16", "index": "index.html", "major": "16", "pages": 1169, "release": "16.15", "source_url": "https://ftp.postgresql.org/pub/source/v16.15/postgresql-16.15.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "c1575341fa7bd40f5274ea465b34390f4dc64cdd0770af327005caaeb9f6b7ed"}, "revision": "3c21e58b35318021716440e67bb8bafd392b6a2b965a244d90e9e33c99e0bdef", "evidence_kind": "English manual and source declarations", "source_sha256": "c1575341fa7bd40f5274ea465b34390f4dc64cdd0770af327005caaeb9f6b7ed"}, "sources": [{"url": "https://pg.center/docs/16/app-pgbasebackup.html", "file": "app-pgbasebackup.html", "label": "16.15 English manual \u00b7 app-pgbasebackup.html", "anchor": "", "sha256": "f0c6588fe61e7332b22709fdc10ff5adc191c06ddfc3cc620ccd57fcba3972a6", "language": "en", "original_url": "/docs/16/app-pgbasebackup.html"}, {"url": "https://pg.center/docs/16/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "a28c30c3c0f8783e16d56413a0b6fd39487e336da1683b29b60abf1c229cef26", "language": "en", "original_url": "/docs/16/reference-client.html"}], "sections": [], "synopsis": ["pg_basebackup [ option ...]"], "signature": "pg_basebackup [ option ...]", "description": ["pg_basebackup \u2014 \u83b7\u53d6 PostgreSQL \u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd"], "environment": [], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGBASEBACKUP\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_basebackup</span></span></h2>\n<p lang=\"zh\">pg_basebackup \u2014 \u83b7\u53d6<span class=\"productname\">PostgreSQL</span>\u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.10.4.1\"><code class=\"command\">pg_basebackup</code> [<em class=\"replaceable\"><code>option</code></em>...]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u7528\u4e8e\u83b7\u53d6\u6b63\u5728\u8fd0\u884c\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd\u3002\u5907\u4efd\u8fc7\u7a0b\u4e0d\u4f1a\u5f71\u54cd\u6570\u636e\u5e93\u7684\u5176\u4ed6\u5ba2\u6237\u7aef\uff0c\u5e76\u4e14\u8be5\u5907\u4efd\u65e2\u53ef\u7528\u4e8e\u65f6\u95f4\u70b9\u6062\u590d\uff08\u89c1<a class=\"xref\" href=\"/docs/16/continuous-archiving.html\" title=\"26.3.\u00a0\u6301\u7eed\u5f52\u6863\u548c\u65f6\u95f4\u70b9\u6062\u590d\uff08PITR\uff09\">\u7b2c\u00a026.3\u00a0\u8282</a>\uff09\uff0c\u4e5f\u53ef\u7528\u4f5c\u65e5\u5fd7\u4f20\u9001\u6216\u6d41\u590d\u5236\u5907\u5e93\u7684\u8d77\u70b9\uff08\u89c1<a class=\"xref\" href=\"/docs/16/warm-standby.html\" title=\"27.2.\u00a0\u65e5\u5fd7\u4f20\u9001\u5907\u5e93\">\u7b2c\u00a027.2\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u4f1a\u7cbe\u786e\u590d\u5236\u6570\u636e\u5e93\u96c6\u7c07\u7684\u6587\u4ef6\uff0c\u540c\u65f6\u786e\u4fdd\u670d\u52a1\u5668\u81ea\u52a8\u8fdb\u5165\u548c\u9000\u51fa\u5907\u4efd\u6a21\u5f0f\u3002\u5907\u4efd\u59cb\u7ec8\u9488\u5bf9\u6574\u4e2a\u6570\u636e\u5e93\u96c6\u7c07\uff1b\u4e0d\u53ef\u80fd\u53ea\u5907\u4efd\u5355\u4e2a\u6570\u636e\u5e93\u6216\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u5bf9\u4e8e\u9009\u62e9\u6027\u5907\u4efd\uff0c\u5fc5\u987b\u4f7f\u7528\u8bf8\u5982<a class=\"xref\" href=\"/docs/16/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>\u4e4b\u7c7b\u7684\u5176\u4ed6\u5de5\u5177\u3002</p>\n<p lang=\"zh\">\u5907\u4efd\u662f\u901a\u8fc7\u4e00\u4e2a\u4f7f\u7528\u590d\u5236\u534f\u8bae\u7684\u5e38\u89c4<span class=\"productname\">PostgreSQL</span>\u8fde\u63a5\u8fdb\u884c\u7684\u3002\u5efa\u7acb\u8be5\u8fde\u63a5\u6240\u4f7f\u7528\u7684\u7528\u6237 ID \u5fc5\u987b\u5177\u6709<code class=\"literal\">REPLICATION</code>\u6743\u9650\uff08\u89c1<a class=\"xref\" href=\"/docs/16/role-attributes.html\" title=\"22.2.\u00a0\u89d2\u8272\u5c5e\u6027\">\u7b2c\u00a022.2\u00a0\u8282</a>\uff09\uff0c\u6216\u8005\u662f\u8d85\u7ea7\u7528\u6237\uff0c\u5e76\u4e14<a class=\"link\" href=\"/docs/16/auth-pg-hba-conf.html\" title=\"21.1.\u00a0pg_hba.conf \u6587\u4ef6\"><code class=\"filename\">pg_hba.conf</code></a>\u5fc5\u987b\u5141\u8bb8\u8be5\u590d\u5236\u8fde\u63a5\u3002\u670d\u52a1\u5668\u8fd8\u5fc5\u987b\u5c06<a class=\"xref\" href=\"/docs/16/runtime-config-replication.html#GUC-MAX-WAL-SENDERS\">max_wal_senders</a>\u8bbe\u7f6e\u5f97\u8db3\u591f\u9ad8\uff0c\u4ee5\u4fbf\u81f3\u5c11\u63d0\u4f9b\u4e00\u4e2a\u7528\u4e8e\u5907\u4efd\u7684 WAL \u53d1\u9001\u8fdb\u7a0b\uff0c\u5e76\u5728\u4f7f\u7528 WAL \u6d41\u5f0f\u4f20\u8f93\u65f6\u518d\u63d0\u4f9b\u4e00\u4e2a WAL \u53d1\u9001\u8fdb\u7a0b\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u540c\u65f6\u8fd0\u884c\u591a\u4e2a<code class=\"command\">pg_basebackup</code>\uff0c\u4f46\u4ece\u6027\u80fd\u89d2\u5ea6\u6765\u770b\uff0c\u901a\u5e38\u6700\u597d\u53ea\u6267\u884c\u4e00\u6b21\u5907\u4efd\uff0c\u7136\u540e\u590d\u5236\u5176\u7ed3\u679c\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u4e0d\u4ec5\u53ef\u4ee5\u4ece\u4e3b\u5e93\u83b7\u53d6\u57fa\u7840\u5907\u4efd\uff0c\u4e5f\u53ef\u4ee5\u4ece\u5907\u5e93\u83b7\u53d6\u3002\u8981\u4ece\u5907\u5e93\u83b7\u53d6\u5907\u4efd\uff0c\u9700\u8981\u5c06\u5907\u5e93\u914d\u7f6e\u4e3a\u80fd\u591f\u63a5\u53d7\u590d\u5236\u8fde\u63a5\uff08\u5373\u8bbe\u7f6e<code class=\"varname\">max_wal_senders</code>\u548c<a class=\"xref\" href=\"/docs/16/runtime-config-replication.html#GUC-HOT-STANDBY\">hot_standby</a>\uff0c\u5e76\u9002\u5f53\u5730\u914d\u7f6e\u5176<code class=\"filename\">pg_hba.conf</code>\uff09\u3002\u8fd8\u9700\u8981\u5728\u4e3b\u5e93\u4e0a\u542f\u7528<a class=\"xref\" href=\"/docs/16/runtime-config-wal.html#GUC-FULL-PAGE-WRITES\">full_page_writes</a>\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u4ece\u5907\u5e93\u83b7\u53d6\u5907\u4efd\u5b58\u5728\u4e00\u4e9b\u9650\u5236\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5907\u4efd\u5386\u53f2\u6587\u4ef6\u4e0d\u4f1a\u5728\u88ab\u5907\u4efd\u7684\u6570\u636e\u5e93\u96c6\u7c07\u4e2d\u521b\u5efa\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">pg_basebackup</span>\u65e0\u6cd5\u5f3a\u5236\u5907\u5e93\u5728\u5907\u4efd\u7ed3\u675f\u65f6\u5207\u6362\u5230\u65b0\u7684 WAL \u6587\u4ef6\u3002\u5f53\u4f7f\u7528<code class=\"literal\">-X none</code>\u65f6\uff0c\u5982\u679c\u4e3b\u5e93\u4e0a\u7684\u5199\u5165\u6d3b\u52a8\u8f83\u5c11\uff0c<span class=\"application\">pg_basebackup</span>\u53ef\u80fd\u9700\u8981\u957f\u65f6\u95f4\u7b49\u5f85\uff0c\u76f4\u5230\u5907\u4efd\u6240\u9700\u7684\u6700\u540e\u4e00\u4e2a WAL \u6587\u4ef6\u88ab\u5207\u6362\u5e76\u5f52\u6863\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5728\u4e3b\u5e93\u4e0a\u8fd0\u884c<code class=\"function\">pg_switch_wal</code>\uff0c\u4ee5\u7acb\u5373\u89e6\u53d1 WAL \u6587\u4ef6\u5207\u6362\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5982\u679c\u5907\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u88ab\u63d0\u5347\u4e3a\u4e3b\u5e93\uff0c\u5219\u5907\u4efd\u4f1a\u5931\u8d25\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5907\u4efd\u6240\u9700\u7684\u6240\u6709 WAL \u8bb0\u5f55\u90fd\u5fc5\u987b\u5305\u542b\u8db3\u591f\u7684\u6574\u9875\u5199\u5165\uff0c\u56e0\u6b64\u5fc5\u987b\u5728\u4e3b\u5e93\u4e0a\u542f\u7528<code class=\"varname\">full_page_writes</code>\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u6bcf\u5f53<span class=\"application\">pg_basebackup</span>\u6267\u884c\u57fa\u7840\u5907\u4efd\u65f6\uff0c\u670d\u52a1\u5668\u7684<code class=\"structname\">pg_stat_progress_basebackup</code>\u89c6\u56fe\u90fd\u4f1a\u62a5\u544a\u5907\u4efd\u8fdb\u5ea6\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/16/progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING\" title=\"28.4.6.\u00a0\u57fa\u7840\u5907\u4efd\u8fdb\u5ea6\u62a5\u544a\">\u7b2c\u00a028.4.6\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u8f93\u51fa\u7684\u4f4d\u7f6e\u548c\u683c\u5f0f\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>directory</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u5199\u5165\u8f93\u51fa\u7684\u76ee\u6807\u76ee\u5f55\u3002\u5982\u679c\u8be5\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u521b\u5efa\u5b83\uff08\u4ee5\u53ca\u6240\u6709\u7f3a\u5931\u7684\u7236\u76ee\u5f55\uff09\u3002\u5982\u679c\u8be5\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002</p>\n<p lang=\"zh\">\u5f53\u5907\u4efd\u91c7\u7528 tar \u683c\u5f0f\u65f6\uff0c\u76ee\u6807\u76ee\u5f55\u53ef\u4ee5\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff08\u77ed\u6a2a\u7ebf\uff09\uff0c\u4ece\u800c\u5c06 tar \u6587\u4ef6\u5199\u5230<code class=\"literal\">stdout</code>\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u662f\u5fc5\u9700\u7684\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>format</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--format=<em class=\"replaceable\"><code>format</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u9009\u62e9\u8f93\u51fa\u683c\u5f0f\u3002<em class=\"replaceable\"><code>format</code></em>\u53ef\u4ee5\u662f\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">p</code><br/></span><span class=\"term\"><code class=\"literal\">plain</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u5199\u4e3a\u666e\u901a\u6587\u4ef6\uff0c\u5176\u5e03\u5c40\u4e0e\u6e90\u670d\u52a1\u5668\u7684\u6570\u636e\u76ee\u5f55\u548c\u8868\u7a7a\u95f4\u76f8\u540c\u3002\u5f53\u96c6\u7c07\u6ca1\u6709\u989d\u5916\u8868\u7a7a\u95f4\u65f6\uff0c\u6574\u4e2a\u6570\u636e\u5e93\u90fd\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u3002\u5982\u679c\u96c6\u7c07\u5305\u542b\u989d\u5916\u8868\u7a7a\u95f4\uff0c\u5219\u4e3b\u6570\u636e\u76ee\u5f55\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\uff0c\u800c\u5176\u4ed6\u6240\u6709\u8868\u7a7a\u95f4\u90fd\u4f1a\u653e\u5728\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u76f8\u540c\u7684\u7edd\u5bf9\u8def\u5f84\u4e2d\u3002\uff08\u5982\u9700\u6539\u53d8\u8fd9\u4e00\u70b9\uff0c\u89c1<code class=\"option\">--tablespace-mapping</code>\u3002\uff09</p>\n<p lang=\"zh\">\u8fd9\u662f\u9ed8\u8ba4\u683c\u5f0f\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">t</code><br/></span><span class=\"term\"><code class=\"literal\">tar</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u5199\u4e3a\u76ee\u6807\u76ee\u5f55\u4e2d\u7684 tar \u6587\u4ef6\u3002\u4e3b\u6570\u636e\u76ee\u5f55\u7684\u5185\u5bb9\u4f1a\u5199\u5165\u540d\u4e3a<code class=\"filename\">base.tar</code>\u7684\u6587\u4ef6\u4e2d\uff0c\u800c\u6bcf\u4e2a\u5176\u4ed6\u8868\u7a7a\u95f4\u90fd\u4f1a\u5199\u5165\u4e00\u4e2a\u4ee5\u8be5\u8868\u7a7a\u95f4 OID \u547d\u540d\u7684\u72ec\u7acb tar \u6587\u4ef6\u4e2d\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u76ee\u6807\u76ee\u5f55\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff08\u77ed\u6a2a\u7ebf\uff09\uff0ctar \u5185\u5bb9\u5c06\u5199\u5165\u6807\u51c6\u8f93\u51fa\uff0c\u9002\u5408\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u4f8b\u5982<span class=\"productname\">gzip</span>\u3002\u53ea\u6709\u5f53\u96c6\u7c07\u6ca1\u6709\u989d\u5916\u8868\u7a7a\u95f4\u4e14\u672a\u4f7f\u7528 WAL \u6d41\u5f0f\u4f20\u8f93\u65f6\uff0c\u624d\u5141\u8bb8\u8fd9\u6837\u505a\u3002</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code><br/></span><span class=\"term\"><code class=\"option\">--write-recovery-conf</code></span></dt>\n<dd>\n<p lang=\"zh\">\u521b\u5efa<a class=\"link\" href=\"/docs/16/warm-standby.html#FILE-STANDBY-SIGNAL\"><code class=\"filename\">standby.signal</code></a> <a class=\"indexterm\" id=\"id-1.9.4.10.6.2.1.3.3.1.2\" name=\"id-1.9.4.10.6.2.1.3.3.1.2\"></a>\u6587\u4ef6\uff0c\u5e76\u5c06\u8fde\u63a5\u8bbe\u7f6e\u8ffd\u52a0\u5230\u76ee\u6807\u76ee\u5f55\u4e2d\u7684<code class=\"filename\">postgresql.auto.conf</code>\u6587\u4ef6\u4e2d\uff08\u5982\u679c\u4f7f\u7528 tar \u683c\u5f0f\uff0c\u5219\u8ffd\u52a0\u5230\u57fa\u7840\u5f52\u6863\u6587\u4ef6\u5185\uff09\u3002\u8fd9\u6837\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u5229\u7528\u5907\u4efd\u7ed3\u679c\u642d\u5efa\u5907\u5e93\u3002</p>\n<p lang=\"zh\"><code class=\"filename\">postgresql.auto.conf</code>\u6587\u4ef6\u4f1a\u8bb0\u5f55<span class=\"application\">pg_basebackup</span>\u6240\u7528\u7684\u8fde\u63a5\u8bbe\u7f6e\uff0c\u4ee5\u53ca\u590d\u5236\u69fd\uff08\u5982\u679c\u6307\u5b9a\u4e86\uff09\uff0c\u4ee5\u4fbf\u6d41\u590d\u5236\u4ee5\u540e\u4f7f\u7528\u76f8\u540c\u7684\u8bbe\u7f6e\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t <em class=\"replaceable\"><code>target</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--target=<em class=\"replaceable\"><code>target</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u793a\u670d\u52a1\u5668\u5c06\u57fa\u7840\u5907\u4efd\u653e\u5230\u54ea\u91cc\u3002\u9ed8\u8ba4\u76ee\u6807\u662f<code class=\"literal\">client</code>\uff0c\u8868\u793a\u5907\u4efd\u5e94\u53d1\u9001\u5230\u8fd0\u884c<span class=\"application\">pg_basebackup</span>\u7684\u90a3\u53f0\u673a\u5668\u3002\u5982\u679c\u76ee\u6807\u6539\u4e3a<code class=\"literal\">server:/some/path</code>\uff0c\u5219\u5907\u4efd\u4f1a\u5b58\u50a8\u5728\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684<code class=\"literal\">/some/path</code>\u76ee\u5f55\u4e2d\u3002\u5c06\u5907\u4efd\u5b58\u50a8\u5728\u670d\u52a1\u5668\u4e0a\u9700\u8981\u8d85\u7ea7\u7528\u6237\u6743\u9650\uff0c\u6216\u62e5\u6709<code class=\"literal\">pg_write_server_files</code>\u89d2\u8272\u7684\u6743\u9650\u3002\u5982\u679c\u76ee\u6807\u8bbe\u7f6e\u4e3a<code class=\"literal\">blackhole</code>\uff0c\u5219\u5185\u5bb9\u4f1a\u88ab\u4e22\u5f03\uff0c\u4e0d\u4f1a\u5b58\u50a8\u5230\u4efb\u4f55\u5730\u65b9\u3002\u8fd9\u53ea\u5e94\u7528\u4e8e\u6d4b\u8bd5\u76ee\u7684\uff0c\u56e0\u4e3a\u6700\u7ec8\u4e0d\u4f1a\u5f97\u5230\u5b9e\u9645\u5907\u4efd\u3002</p>\n<p lang=\"zh\">\u7531\u4e8e WAL \u6d41\u5f0f\u4f20\u8f93\u662f\u7531<span class=\"application\">pg_basebackup</span>\u800c\u4e0d\u662f\u670d\u52a1\u5668\u5b9e\u73b0\u7684\uff0c\u56e0\u6b64\u6b64\u9009\u9879\u4e0d\u80fd\u4e0e<code class=\"literal\">-Xstream</code>\u4e00\u8d77\u4f7f\u7528\u3002\u7531\u4e8e\u540e\u8005\u662f\u9ed8\u8ba4\u503c\uff0c\u6240\u4ee5\u6307\u5b9a\u6b64\u9009\u9879\u65f6\uff0c\u8fd8\u5fc5\u987b\u540c\u65f6\u6307\u5b9a<code class=\"literal\">-Xfetch</code>\u6216<code class=\"literal\">-Xnone</code>\u4e4b\u4e00\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>olddir</code></em>=<em class=\"replaceable\"><code>newdir</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--tablespace-mapping=<em class=\"replaceable\"><code>olddir</code></em>=<em class=\"replaceable\"><code>newdir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u671f\u95f4\uff0c\u5c06\u76ee\u5f55<em class=\"replaceable\"><code>olddir</code></em>\u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230<em class=\"replaceable\"><code>newdir</code></em>\u3002\u8981\u4f7f\u6b64\u9009\u9879\u751f\u6548\uff0c<em class=\"replaceable\"><code>olddir</code></em>\u5fc5\u987b\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u5b9a\u4e49\u7684\u8be5\u8868\u7a7a\u95f4\u8def\u5f84\u5b8c\u5168\u4e00\u81f4\u3002\uff08\u4f46\u5982\u679c\u6e90\u670d\u52a1\u5668\u4e0a\u5728<em class=\"replaceable\"><code>olddir</code></em>\u4e2d\u6ca1\u6709\u8868\u7a7a\u95f4\uff0c\u4e5f\u4e0d\u7b97\u9519\u8bef\u3002\uff09\u4e0e\u6b64\u540c\u65f6\uff0c<em class=\"replaceable\"><code>newdir</code></em>\u662f\u63a5\u6536\u4e3b\u673a\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u4e00\u4e2a\u76ee\u5f55\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c<em class=\"replaceable\"><code>newdir</code></em>\u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002<em class=\"replaceable\"><code>olddir</code></em>\u548c<em class=\"replaceable\"><code>newdir</code></em>\u90fd\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u5982\u679c\u4efb\u4e00\u8def\u5f84\u4e2d\u9700\u8981\u5305\u542b\u7b49\u53f7\uff08<code class=\"literal\">=</code>\uff09\uff0c\u8bf7\u5728\u5176\u524d\u9762\u52a0\u4e0a\u53cd\u659c\u6760\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u4ee5\u5904\u7406\u591a\u4e2a\u8868\u7a7a\u95f4\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u91cd\u5b9a\u4f4d\u8868\u7a7a\u95f4\uff0c\u4e3b\u6570\u636e\u76ee\u5f55\u4e2d\u7684\u7b26\u53f7\u94fe\u63a5\u5c06\u88ab\u66f4\u65b0\u4e3a\u6307\u5411\u65b0\u4f4d\u7f6e\u3002\u56e0\u6b64\uff0c\u65b0\u6570\u636e\u76ee\u5f55\u5df2\u53ef\u76f4\u63a5\u7528\u4e8e\u542f\u52a8\u4e00\u4e2a\u6240\u6709\u8868\u7a7a\u95f4\u90fd\u4f4d\u4e8e\u66f4\u65b0\u540e\u4f4d\u7f6e\u7684\u65b0\u670d\u52a1\u5668\u5b9e\u4f8b\u3002</p>\n<p lang=\"zh\">\u76ee\u524d\uff0c\u6b64\u9009\u9879\u4ec5\u9002\u7528\u4e8e\u666e\u901a\u6587\u4ef6\u8f93\u51fa\u683c\u5f0f\uff1b\u5982\u679c\u9009\u62e9\u4e86 tar \u683c\u5f0f\uff0c\u5219\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--waldir=<em class=\"replaceable\"><code>waldir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5199\u5165 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cWAL \u6587\u4ef6\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u7684<code class=\"filename\">pg_wal</code>\u5b50\u76ee\u5f55\u4e2d\uff0c\u4f46\u6b64\u9009\u9879\u53ef\u7528\u4e8e\u5c06\u5176\u653e\u5728\u5176\u4ed6\u4f4d\u7f6e\u3002<em class=\"replaceable\"><code>waldir</code></em>\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c<em class=\"replaceable\"><code>waldir</code></em>\u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002\u53ea\u6709\u5f53\u5907\u4efd\u91c7\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u624d\u80fd\u6307\u5b9a\u6b64\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-X <em class=\"replaceable\"><code>method</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--wal-method=<em class=\"replaceable\"><code>method</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u4e2d\u5305\u542b\u6240\u9700\u7684 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u3002\u8fd9\u5c06\u5305\u62ec\u5907\u4efd\u671f\u95f4\u751f\u6210\u7684\u6240\u6709\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u9664\u975e\u6307\u5b9a\u65b9\u6cd5<code class=\"literal\">none</code>\uff0c\u5426\u5219\u5c31\u53ef\u4ee5\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u542f\u52a8 postmaster\uff0c\u800c\u65e0\u9700\u67e5\u9605 WAL \u5f52\u6863\uff0c\u4ece\u800c\u4f7f\u8f93\u51fa\u6210\u4e3a\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u5907\u4efd\u3002</p>\n<p lang=\"zh\">\u652f\u6301\u4ee5\u4e0b\u7528\u4e8e\u6536\u96c6\u9884\u5199\u5f0f\u65e5\u5fd7\u7684<em class=\"replaceable\"><code>method</code></em>\u503c\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">n</code><br/></span><span class=\"term\"><code class=\"literal\">none</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u5728\u5907\u4efd\u4e2d\u5305\u542b\u9884\u5199\u5f0f\u65e5\u5fd7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">f</code><br/></span><span class=\"term\"><code class=\"literal\">fetch</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u7ed3\u675f\u65f6\u6536\u96c6\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u3002\u56e0\u6b64\uff0c\u6e90\u670d\u52a1\u5668\u7684<a class=\"xref\" href=\"/docs/16/runtime-config-replication.html#GUC-WAL-KEEP-SIZE\">wal_keep_size</a>\u53c2\u6570\u5fc5\u987b\u8bbe\u7f6e\u5f97\u8db3\u591f\u9ad8\uff0c\u4ee5\u786e\u4fdd\u5728\u5907\u4efd\u7ed3\u675f\u524d\u4e0d\u4f1a\u79fb\u9664\u6240\u9700\u7684\u65e5\u5fd7\u6570\u636e\u3002\u5982\u679c\u5728\u4f20\u8f93\u8fd9\u4e9b\u6570\u636e\u4e4b\u524d\u5b83\u4eec\u5df2\u7ecf\u88ab\u56de\u6536\uff0c\u5219\u5907\u4efd\u4f1a\u5931\u8d25\u5e76\u4e14\u65e0\u6cd5\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u4f1a\u5305\u542b\u5728<code class=\"filename\">base.tar</code>\u6587\u4ef6\u4e2d\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">s</code><br/></span><span class=\"term\"><code class=\"literal\">stream</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u6267\u884c\u5907\u4efd\u7684\u540c\u65f6\u6d41\u5f0f\u4f20\u8f93\u9884\u5199\u5f0f\u65e5\u5fd7\u6570\u636e\u3002\u6b64\u65b9\u6cd5\u4f1a\u5411\u670d\u52a1\u5668\u6253\u5f00\u7b2c\u4e8c\u4e2a\u8fde\u63a5\uff0c\u5e76\u5728\u6267\u884c\u5907\u4efd\u65f6\u5e76\u884c\u5f00\u59cb\u6d41\u5f0f\u4f20\u8f93\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u56e0\u6b64\uff0c\u5b83\u9700\u8981\u4e24\u4e2a\u590d\u5236\u8fde\u63a5\uff0c\u800c\u4e0d\u53ea\u662f\u4e00\u4e2a\u3002\u53ea\u8981\u5ba2\u6237\u7aef\u80fd\u591f\u8ddf\u4e0a\u9884\u5199\u5f0f\u65e5\u5fd7\u6570\u636e\uff0c\u4f7f\u7528\u6b64\u65b9\u6cd5\u5c31\u4e0d\u9700\u8981\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u989d\u5916\u4fdd\u7559\u9884\u5199\u5f0f\u65e5\u5fd7\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u4f1a\u5199\u5165\u4e00\u4e2a\u540d\u4e3a<code class=\"filename\">pg_wal.tar</code>\u7684\u72ec\u7acb\u6587\u4ef6\u4e2d\uff08\u5982\u679c\u670d\u52a1\u5668\u7248\u672c\u65e9\u4e8e 10\uff0c\u5219\u6587\u4ef6\u540d\u4e3a<code class=\"filename\">pg_xlog.tar</code>\uff09\u3002</p>\n<p lang=\"zh\">\u8fd9\u662f\u9ed8\u8ba4\u503c\u3002</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-z</code><br/></span><span class=\"term\"><code class=\"option\">--gzip</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u4f7f\u7528\u9ed8\u8ba4\u538b\u7f29\u7ea7\u522b\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0<code class=\"filename\">.gz</code>\u540e\u7f00\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-Z <em class=\"replaceable\"><code>level</code></em></code><br/></span><span class=\"term\"><code class=\"option\">-Z [{client|server}-]<em class=\"replaceable\"><code>method</code></em>[:<em class=\"replaceable\"><code>detail</code></em>]</code><br/></span><span class=\"term\"><code class=\"option\">--compress=<em class=\"replaceable\"><code>level</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--compress=[{client|server}-]<em class=\"replaceable\"><code>method</code></em>[:<em class=\"replaceable\"><code>detail</code></em>]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bf7\u6c42\u5bf9\u5907\u4efd\u8fdb\u884c\u538b\u7f29\u3002\u5982\u679c\u5305\u542b<code class=\"literal\">client</code>\u6216<code class=\"literal\">server</code>\uff0c\u5219\u6307\u5b9a\u538b\u7f29\u6267\u884c\u7684\u4f4d\u7f6e\u3002\u5728\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4f1a\u51cf\u5c11\u4f20\u8f93\u5e26\u5bbd\u5360\u7528\uff0c\u4f46\u4f1a\u589e\u52a0\u670d\u52a1\u5668 CPU \u6d88\u8017\u3002\u9ed8\u8ba4\u503c\u662f<code class=\"literal\">client</code>\uff0c\u4f46\u4f7f\u7528<code class=\"literal\">--target</code>\u65f6\u9664\u5916\uff1b\u6b64\u65f6\u5907\u4efd\u4e0d\u4f1a\u53d1\u9001\u5230\u5ba2\u6237\u7aef\uff0c\u56e0\u6b64\u53ea\u6709\u670d\u52a1\u5668\u7aef\u538b\u7f29\u624d\u6709\u610f\u4e49\u3002\u4f7f\u7528\u9ed8\u8ba4\u7684<code class=\"literal\">-Xstream</code>\u65f6\uff0c\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4e0d\u4f1a\u5e94\u7528\u4e8e WAL\u3002\u82e5\u8981\u538b\u7f29 WAL\uff0c\u8bf7\u4f7f\u7528\u5ba2\u6237\u7aef\u538b\u7f29\uff0c\u6216\u8005\u6307\u5b9a<code class=\"literal\">-Xfetch</code>\u3002</p>\n<p lang=\"zh\">\u538b\u7f29\u65b9\u6cd5\u53ef\u4ee5\u8bbe\u7f6e\u4e3a<code class=\"literal\">gzip</code>\u3001<code class=\"literal\">lz4</code>\u3001<code class=\"literal\">zstd</code>\u3001<code class=\"literal\">none</code>\uff08\u4e0d\u538b\u7f29\uff09\uff0c\u4e5f\u53ef\u4ee5\u76f4\u63a5\u6307\u5b9a\u4e00\u4e2a\u6574\u6570\uff080 \u8868\u793a\u4e0d\u538b\u7f29\uff0c\u5927\u4e8e 0 \u8868\u793a<code class=\"literal\">gzip</code>\uff09\u3002\u8fd8\u53ef\u4ee5\u9009\u62e9\u6027\u5730\u6307\u5b9a\u538b\u7f29\u7ec6\u8282\u5b57\u7b26\u4e32\u3002\u5982\u679c\u7ec6\u8282\u5b57\u7b26\u4e32\u662f\u6574\u6570\uff0c\u5219\u8868\u793a\u538b\u7f29\u7ea7\u522b\uff1b\u5426\u5219\uff0c\u5b83\u5e94\u4e3a\u9017\u53f7\u5206\u9694\u7684\u9879\u76ee\u5217\u8868\uff0c\u6bcf\u9879\u7684\u5f62\u5f0f\u4e3a<code class=\"literal\">keyword</code>\u6216<code class=\"literal\">keyword=value</code>\u3002\u76ee\u524d\u652f\u6301\u7684\u5173\u952e\u5b57\u6709<code class=\"literal\">level</code>\u3001<code class=\"literal\">long</code>\u548c<code class=\"literal\">workers</code>\u3002\u5f53\u538b\u7f29\u65b9\u6cd5\u4ee5\u7eaf\u6574\u6570\u5f62\u5f0f\u6307\u5b9a\u65f6\uff0c\u4e0d\u80fd\u518d\u4f7f\u7528\u7ec6\u8282\u5b57\u7b26\u4e32\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u538b\u7f29\u7ea7\u522b\uff0c\u5c06\u4f7f\u7528\u9ed8\u8ba4\u7ea7\u522b\u3002\u5982\u679c\u53ea\u6307\u5b9a\u7ea7\u522b\u800c\u672a\u6307\u5b9a\u7b97\u6cd5\uff0c\u5219\u7ea7\u522b\u5927\u4e8e 0 \u65f6\u4f7f\u7528 gzip \u538b\u7f29\uff0c\u7ea7\u522b\u4e3a 0 \u65f6\u4e0d\u538b\u7f29\u3002</p>\n<p lang=\"zh\">\u5f53 tar \u683c\u5f0f\u914d\u5408<code class=\"literal\">gzip</code>\u3001<code class=\"literal\">lz4</code>\u6216<code class=\"literal\">zstd</code>\u4f7f\u7528\u65f6\uff0c\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u5206\u522b\u81ea\u52a8\u52a0\u4e0a<code class=\"filename\">.gz</code>\u3001<code class=\"filename\">.lz4</code>\u6216<code class=\"filename\">.zst</code>\u540e\u7f00\u3002\u4f7f\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u4e0d\u80fd\u6307\u5b9a\u5ba2\u6237\u7aef\u538b\u7f29\uff0c\u4f46\u4ecd\u53ef\u4ee5\u8bf7\u6c42\u670d\u52a1\u5668\u7aef\u538b\u7f29\u3002\u8fd9\u6837\u505a\u65f6\uff0c\u670d\u52a1\u5668\u4f1a\u5148\u538b\u7f29\u5907\u4efd\u518d\u4f20\u8f93\uff0c\u800c\u5ba2\u6237\u7aef\u4f1a\u5bf9\u5176\u8fdb\u884c\u89e3\u538b\u5e76\u63d0\u53d6\u3002</p>\n<p lang=\"zh\">\u5f53\u6b64\u9009\u9879\u4e0e<code class=\"literal\">-Xstream</code>\u7ec4\u5408\u4f7f\u7528\u65f6\uff0c\u5982\u679c\u9009\u62e9\u4e86\u5ba2\u6237\u7aef gzip \u538b\u7f29\uff0c\u5219<code class=\"literal\">pg_wal.tar</code>\u4f1a\u4f7f\u7528<code class=\"literal\">gzip</code>\u538b\u7f29\uff1b\u4f46\u5982\u679c\u9009\u62e9\u4e86\u5176\u4ed6\u538b\u7f29\u7b97\u6cd5\uff0c\u6216\u8005\u9009\u62e9\u4e86\u670d\u52a1\u5668\u7aef\u538b\u7f29\uff0c\u5219\u4e0d\u4f1a\u88ab\u538b\u7f29\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u5907\u4efd\u7684\u751f\u6210\u548c\u7a0b\u5e8f\u7684\u8c03\u7528\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-c {fast|spread}</code><br/></span><span class=\"term\"><code class=\"option\">--checkpoint={fast|spread}</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u68c0\u67e5\u70b9\u6a21\u5f0f\u8bbe\u7f6e\u4e3a fast\uff08\u7acb\u5373\uff09\u6216 spread\uff08\u9ed8\u8ba4\uff09\uff08\u89c1<a class=\"xref\" href=\"/docs/16/continuous-archiving.html#BACKUP-LOWLEVEL-BASE-BACKUP\" title=\"26.3.3.\u00a0\u4f7f\u7528\u4f4e\u7ea7 API \u8fdb\u884c\u57fa\u7840\u5907\u4efd\">\u7b2c\u00a026.3.3\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--create-slot</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728\u5f00\u59cb\u5907\u4efd\u4e4b\u524d\uff0c\u5e94\u521b\u5efa\u7531<code class=\"literal\">--slot</code>\u9009\u9879\u6307\u5b9a\u540d\u79f0\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u8be5\u69fd\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u9519\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>label</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--label=<em class=\"replaceable\"><code>label</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5907\u4efd\u6807\u7b7e\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u503c<span class=\"quote\">\u201c<span class=\"quote\"><code class=\"literal\">pg_basebackup base backup</code></span>\u201d</span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-clean</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53<code class=\"command\">pg_basebackup</code>\u56e0\u9519\u8bef\u4e2d\u6b62\u65f6\uff0c\u5b83\u4f1a\u5220\u9664\u5728\u53d1\u73b0\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u76ee\u5f55\uff08\u4f8b\u5982\u76ee\u6807\u76ee\u5f55\u548c\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\uff09\u3002\u6b64\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u5f88\u6709\u5e2e\u52a9\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u65e0\u8bba\u662f\u5426\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u8868\u7a7a\u95f4\u76ee\u5f55\u90fd\u4e0d\u4f1a\u88ab\u6e05\u7406\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N</code><br/></span><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">pg_basebackup</code>\u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u88ab\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f1a\u4f7f<code class=\"command\">pg_basebackup</code>\u4e0d\u7ecf\u7b49\u5f85\u5c31\u76f4\u63a5\u8fd4\u56de\uff0c\u56e0\u6b64\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u968f\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u57fa\u7840\u5907\u4efd\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u5408\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P</code><br/></span><span class=\"term\"><code class=\"option\">--progress</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528\u8fdb\u5ea6\u62a5\u544a\u3002\u6253\u5f00\u6b64\u9009\u9879\u540e\uff0c\u4f1a\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u7ed9\u51fa\u4e00\u4e2a\u8fd1\u4f3c\u7684\u8fdb\u5ea6\u62a5\u544a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u53d1\u751f\u53d8\u5316\uff0c\u56e0\u6b64\u8fd9\u53ea\u662f\u8fd1\u4f3c\u503c\uff0c\u6700\u7ec8\u672a\u5fc5\u6070\u597d\u7ed3\u675f\u5728<code class=\"literal\">100%</code>\u3002\u7279\u522b\u662f\u5f53\u5907\u4efd\u4e2d\u5305\u542b WAL \u65f6\uff0c\u603b\u6570\u636e\u91cf\u65e0\u6cd5\u9884\u5148\u4f30\u8ba1\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u65e6\u8fdb\u5ea6\u8d85\u8fc7\u4e0d\u542b WAL \u65f6\u7684\u603b\u4f30\u8ba1\u503c\uff0c\u4f30\u8ba1\u76ee\u6807\u5927\u5c0f\u5c31\u4f1a\u7ee7\u7eed\u589e\u52a0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r <em class=\"replaceable\"><code>rate</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--max-rate=<em class=\"replaceable\"><code>rate</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u4ece\u6e90\u670d\u52a1\u5668\u6536\u96c6\u6570\u636e\u65f6\u5141\u8bb8\u7684\u6700\u5927\u4f20\u8f93\u901f\u7387\u3002\u8fd9\u6709\u52a9\u4e8e\u9650\u5236<span class=\"application\">pg_basebackup</span>\u5bf9\u670d\u52a1\u5668\u7684\u5f71\u54cd\u3002\u53d6\u503c\u5355\u4f4d\u4e3a\u6bcf\u79d2\u5343\u5b57\u8282\u3002\u4f7f\u7528\u540e\u7f00<code class=\"literal\">M</code>\u8868\u793a\u6bcf\u79d2\u5146\u5b57\u8282\u3002\u4e5f\u63a5\u53d7\u540e\u7f00<code class=\"literal\">k</code>\uff0c\u4f46\u6ca1\u6709\u5b9e\u9645\u5f71\u54cd\u3002\u6709\u6548\u53d6\u503c\u8303\u56f4\u4e3a\u6bcf\u79d2 32 \u5343\u5b57\u8282\u5230\u6bcf\u79d2 1024 \u5146\u5b57\u8282\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u59cb\u7ec8\u5f71\u54cd\u6570\u636e\u76ee\u5f55\u7684\u4f20\u8f93\u3002\u53ea\u6709\u5f53\u6536\u96c6\u65b9\u6cd5\u4e3a<code class=\"literal\">fetch</code>\u65f6\uff0cWAL \u6587\u4ef6\u7684\u4f20\u8f93\u624d\u4f1a\u53d7\u5230\u5f71\u54cd\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>slotname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--slot=<em class=\"replaceable\"><code>slotname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u53ea\u80fd\u4e0e<code class=\"literal\">-X stream</code>\u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u4f1a\u4f7f WAL \u6d41\u5f0f\u4f20\u8f93\u4f7f\u7528\u6307\u5b9a\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u6b64\u57fa\u7840\u5907\u4efd\u6253\u7b97\u7528\u4f5c\u4f7f\u7528\u590d\u5236\u69fd\u7684\u6d41\u590d\u5236\u5907\u5e93\uff0c\u90a3\u4e48\u8be5\u5907\u5e93\u5e94\u5c06\u540c\u4e00\u4e2a\u590d\u5236\u69fd\u540d\u79f0\u7528\u4f5c<a class=\"xref\" href=\"/docs/16/runtime-config-replication.html#GUC-PRIMARY-SLOT-NAME\">primary_slot_name</a>\u7684\u503c\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u4e3b\u5e93\u5728\u57fa\u7840\u5907\u4efd\u7ed3\u675f\u4e0e\u65b0\u5907\u5e93\u5f00\u59cb\u6d41\u590d\u5236\u4e4b\u95f4\u7684\u8fd9\u6bb5\u65f6\u95f4\u5185\uff0c\u4e0d\u4f1a\u79fb\u9664\u4efb\u4f55\u5fc5\u9700\u7684 WAL \u6570\u636e\u3002</p>\n<p lang=\"zh\">\u6307\u5b9a\u7684\u590d\u5236\u69fd\u5fc5\u987b\u5df2\u7ecf\u5b58\u5728\uff0c\u9664\u975e\u8fd8\u540c\u65f6\u4f7f\u7528\u4e86<code class=\"option\">-C</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5e76\u4e14\u670d\u52a1\u5668\u652f\u6301\u4e34\u65f6\u590d\u5236\u69fd\uff0810 \u53ca\u4ee5\u4e0a\u7248\u672c\uff09\uff0c\u5219\u4f1a\u81ea\u52a8\u4f7f\u7528\u4e34\u65f6\u590d\u5236\u69fd\u8fdb\u884c WAL \u6d41\u5f0f\u4f20\u8f93\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\u3002\u5b83\u4f1a\u5728\u542f\u52a8\u548c\u5173\u95ed\u8fc7\u7a0b\u4e2d\u8f93\u51fa\u4e00\u4e9b\u989d\u5916\u6b65\u9aa4\uff1b\u5982\u679c\u540c\u65f6\u542f\u7528\u4e86\u8fdb\u5ea6\u62a5\u544a\uff0c\u8fd8\u4f1a\u663e\u793a\u5f53\u524d\u6b63\u5728\u5904\u7406\u7684\u786e\u5207\u6587\u4ef6\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--manifest-checksums=<em class=\"replaceable\"><code>algorithm</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u5e94\u7528\u5230\u5907\u4efd\u6e05\u5355\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u7684\u6821\u9a8c\u548c\u7b97\u6cd5\u3002\u76ee\u524d\u53ef\u7528\u7684\u7b97\u6cd5\u6709<code class=\"literal\">NONE</code>\u3001<code class=\"literal\">CRC32C</code>\u3001<code class=\"literal\">SHA224</code>\u3001<code class=\"literal\">SHA256</code>\u3001<code class=\"literal\">SHA384</code>\u548c<code class=\"literal\">SHA512</code>\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">CRC32C</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">NONE</code>\uff0c\u5907\u4efd\u6e05\u5355\u5c06\u4e0d\u5305\u542b\u4efb\u4f55\u6821\u9a8c\u548c\u3002\u5426\u5219\uff0c\u5b83\u5c06\u5305\u542b\u4f7f\u7528\u6307\u5b9a\u7b97\u6cd5\u4e3a\u5907\u4efd\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u8ba1\u7b97\u7684\u6821\u9a8c\u548c\u3002\u6b64\u5916\uff0c\u6e05\u5355\u59cb\u7ec8\u4f1a\u5305\u542b\u5176\u81ea\u8eab\u5185\u5bb9\u7684<code class=\"literal\">SHA256</code>\u6821\u9a8c\u548c\u3002<code class=\"literal\">SHA</code>\u7b97\u6cd5\u660e\u663e\u6bd4<code class=\"literal\">CRC32C</code>\u66f4\u8017\u8d39 CPU\uff0c\u56e0\u6b64\u9009\u62e9\u5176\u4e2d\u4e00\u79cd\u53ef\u80fd\u4f1a\u589e\u52a0\u5b8c\u6210\u5907\u4efd\u6240\u9700\u7684\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u5e0c\u671b\u9a8c\u8bc1\u5907\u4efd\u672a\u88ab\u7be1\u6539\u7684\u7528\u6237\uff0c\u4f7f\u7528 SHA hash \u51fd\u6570\u53ef\u4ee5\u4e3a\u6bcf\u4e2a\u6587\u4ef6\u63d0\u4f9b\u5177\u6709\u5bc6\u7801\u5b66\u5b89\u5168\u6027\u7684\u6458\u8981\uff1b\u800c CRC32C \u7b97\u6cd5\u63d0\u4f9b\u7684\u6821\u9a8c\u548c\u8ba1\u7b97\u901f\u5ea6\u8981\u5feb\u5f97\u591a\uff0c\u867d\u7136\u5b83\u5f88\u9002\u5408\u53d1\u73b0\u7531\u4e8e\u610f\u5916\u6539\u52a8\u9020\u6210\u7684\u9519\u8bef\uff0c\u4f46\u5e76\u4e0d\u80fd\u62b5\u5fa1\u6076\u610f\u4fee\u6539\u3002\u8bf7\u6ce8\u610f\uff0c\u8981\u60f3\u5bf9\u80fd\u591f\u8bbf\u95ee\u5907\u4efd\u7684\u653b\u51fb\u8005\u5f62\u6210\u9632\u62a4\uff0c\u5907\u4efd\u6e05\u5355\u5c31\u9700\u8981\u5b89\u5168\u5730\u4fdd\u5b58\u5728\u5176\u4ed6\u5730\u65b9\uff0c\u6216\u8005\u4ee5\u5176\u4ed6\u65b9\u5f0f\u786e\u8ba4\u81ea\u5907\u4efd\u5b8c\u6210\u540e\u672a\u88ab\u4fee\u6539\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528<a class=\"xref\" href=\"/docs/16/app-pgverifybackup.html\" title=\"pg_verifybackup\"><span class=\"refentrytitle\"><span class=\"application\">pg_verifybackup</span></span></a>\u6839\u636e\u5907\u4efd\u6e05\u5355\u68c0\u67e5\u5907\u4efd\u7684\u5b8c\u6574\u6027\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--manifest-force-encode</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f3a\u5236\u5c06\u5907\u4efd\u6e05\u5355\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u540d\u7f16\u7801\u4e3a\u5341\u516d\u8fdb\u5236\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u5bf9\u975e UTF8 \u6587\u4ef6\u540d\u8fdb\u884c\u5341\u516d\u8fdb\u5236\u7f16\u7801\u3002\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u8bfb\u53d6\u5907\u4efd\u6e05\u5355\u6587\u4ef6\u7684\u5de5\u5177\u662f\u5426\u80fd\u6b63\u786e\u5904\u7406\u8fd9\u79cd\u60c5\u51b5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-estimate-size</code></span></dt>\n<dd>\n<p lang=\"zh\">\u7981\u6b62\u670d\u52a1\u5668\u4f30\u7b97\u5c06\u8981\u6d41\u5f0f\u4f20\u8f93\u7684\u5907\u4efd\u6570\u636e\u603b\u91cf\uff0c\u56e0\u6b64 pg_stat_progress_basebackup \u89c6\u56fe\u4e2d\u7684 backup_total \u5217\u59cb\u7ec8\u4e3a NULL\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5907\u4efd\u4f1a\u5148\u679a\u4e3e\u6574\u4e2a\u6570\u636e\u5e93\u7684\u5927\u5c0f\uff0c\u7136\u540e\u518d\u56de\u8fc7\u5934\u6765\u53d1\u9001\u5b9e\u9645\u5185\u5bb9\u3002\u8fd9\u53ef\u80fd\u4f1a\u8ba9\u5907\u4efd\u8017\u65f6\u7565\u957f\uff0c\u7279\u522b\u662f\u5728\u53d1\u9001\u7b2c\u4e00\u6279\u6570\u636e\u4e4b\u524d\u6240\u9700\u65f6\u95f4\u4f1a\u66f4\u4e45\u3002\u5982\u679c\u8fd9\u79cd\u4f30\u7b97\u8017\u65f6\u8fc7\u957f\uff0c\u6b64\u9009\u9879\u5c31\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u5b83\u53ef\u4ee5\u907f\u514d\u8fd9\u6bb5\u4f30\u7b97\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--progress</code>\u65f6\uff0c\u4e0d\u5141\u8bb8\u4f7f\u7528\u6b64\u9009\u9879\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-manifest</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7981\u6b62\u751f\u6210\u5907\u4efd\u6e05\u5355\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u670d\u52a1\u5668\u5c06\u751f\u6210\u5e76\u53d1\u9001\u4e00\u4e2a\u5907\u4efd\u6e05\u5355\uff0c\u53ef\u4f7f\u7528<a class=\"xref\" href=\"/docs/16/app-pgverifybackup.html\" title=\"pg_verifybackup\"><span class=\"refentrytitle\"><span class=\"application\">pg_verifybackup</span></span></a>\u8fdb\u884c\u9a8c\u8bc1\u3002\u8be5\u6e05\u5355\u5217\u51fa\u4e86\u5907\u4efd\u4e2d\u7684\u6bcf\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u4e0d\u5305\u62ec\u53ef\u80fd\u5305\u542b\u5728\u5176\u4e2d\u7684\u4efb\u4f55 WAL \u6587\u4ef6\u3002\u5b83\u8fd8\u4f1a\u4fdd\u5b58\u6bcf\u4e2a\u6587\u4ef6\u7684\u5927\u5c0f\u3001\u6700\u540e\u4fee\u6539\u65f6\u95f4\u4ee5\u53ca\u53ef\u9009\u7684\u6821\u9a8c\u548c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-slot</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9632\u6b62\u4e3a\u5907\u4efd\u521b\u5efa\u4e34\u65f6\u590d\u5236\u69fd\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u9009\u62e9\u4e86 WAL \u6d41\u5f0f\u4f20\u8f93\uff0c\u4f46\u6ca1\u6709\u4f7f\u7528<code class=\"option\">-S</code>\u9009\u9879\u7ed9\u51fa\u69fd\u540d\uff0c\u90a3\u4e48\u4f1a\u521b\u5efa\u4e00\u4e2a\u4e34\u65f6\u590d\u5236\u69fd\uff08\u5982\u679c\u6e90\u670d\u52a1\u5668\u652f\u6301\uff09\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7684\u4e3b\u8981\u76ee\u7684\u662f\u5728\u670d\u52a1\u5668\u6ca1\u6709\u7a7a\u95f2\u590d\u5236\u69fd\u65f6\uff0c\u4ecd\u7136\u5141\u8bb8\u6267\u884c\u57fa\u7840\u5907\u4efd\u3002\u51e0\u4e4e\u603b\u662f\u9996\u9009\u4f7f\u7528\u590d\u5236\u69fd\uff0c\u56e0\u4e3a\u5b83\u80fd\u9632\u6b62\u670d\u52a1\u5668\u5728\u5907\u4efd\u671f\u95f4\u79fb\u9664\u6240\u9700\u7684 WAL\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-verify-checksums</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u83b7\u53d6\u57fa\u7840\u5907\u4efd\u7684\u670d\u52a1\u5668\u542f\u7528\u4e86\u6821\u9a8c\u548c\uff0c\u5219\u7981\u7528\u5bf9\u8fd9\u4e9b\u6821\u9a8c\u548c\u7684\u9a8c\u8bc1\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f1a\u9a8c\u8bc1\u6821\u9a8c\u548c\uff1b\u6821\u9a8c\u548c\u9a8c\u8bc1\u5931\u8d25\u5c06\u5bfc\u81f4\u975e\u96f6\u9000\u51fa\u72b6\u6001\u3002\u4e0d\u8fc7\uff0c\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u57fa\u7840\u5907\u4efd\u4e0d\u4f1a\u88ab\u5220\u9664\uff0c\u5c31\u50cf\u4f7f\u7528\u4e86<code class=\"option\">--no-clean</code>\u4e00\u6837\u3002\u6821\u9a8c\u548c\u9a8c\u8bc1\u5931\u8d25\u4e5f\u4f1a\u5728<a class=\"link\" href=\"/docs/16/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW\" title=\"28.2.16.\u00a0pg_stat_database\"><code class=\"structname\">pg_stat_database</code></a>\u89c6\u56fe\u4e2d\u62a5\u544a\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u5230\u6e90\u670d\u52a1\u5668\u7684\u8fde\u63a5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>connstr</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>connstr</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ee5<a class=\"link\" href=\"/docs/16/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"34.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u7684\u5f62\u5f0f\u6307\u5b9a\u7528\u4e8e\u8fde\u63a5\u670d\u52a1\u5668\u7684\u53c2\u6570\uff1b\u8fd9\u4e9b\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u76f8\u4e92\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u51fa\u4e8e\u4e0e\u5176\u4ed6\u5ba2\u6237\u7aef\u5e94\u7528\u4fdd\u6301\u4e00\u81f4\u7684\u8003\u8651\uff0c\u6b64\u9009\u9879\u540d\u4e3a<code class=\"literal\">--dbname</code>\uff1b\u4f46\u7531\u4e8e<span class=\"application\">pg_basebackup</span>\u5e76\u4e0d\u8fde\u63a5\u5230\u96c6\u7c07\u4e2d\u7684\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u4e2d\u7684\u4efb\u4f55\u6570\u636e\u5e93\u540d\u90fd\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea<code class=\"envar\">PGHOST</code>\u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff1b\u5426\u5219\u4f1a\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u6240\u4f7f\u7528\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u4f7f\u7528<code class=\"envar\">PGPORT</code>\u73af\u5883\u53d8\u91cf\u4e2d\u7684\u503c\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u786e\u5b9a\u7684\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s <em class=\"replaceable\"><code>interval</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--status-interval=<em class=\"replaceable\"><code>interval</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u53d1\u9001\u56de\u6e90\u670d\u52a1\u5668\u7684\u72b6\u6001\u5305\u4e4b\u95f4\u76f8\u9694\u7684\u79d2\u6570\u3002\u8f83\u5c0f\u7684\u503c\u53ef\u4ee5\u8ba9\u670d\u52a1\u5668\u7aef\u5bf9\u5907\u4efd\u8fdb\u5ea6\u7684\u76d1\u63a7\u66f4\u7cbe\u786e\u3002\u503c\u4e3a\u96f6\u65f6\u4f1a\u5b8c\u5168\u7981\u7528\u5468\u671f\u6027\u72b6\u6001\u66f4\u65b0\uff0c\u4e0d\u8fc7\u5f53\u670d\u52a1\u5668\u8bf7\u6c42\u65f6\u4ecd\u4f1a\u53d1\u9001\u66f4\u65b0\uff0c\u4ee5\u907f\u514d\u56e0\u8d85\u65f6\u800c\u65ad\u5f00\u8fde\u63a5\u3002\u9ed8\u8ba4\u503c\u662f 10 \u79d2\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7981\u6b62\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\uff08\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff09\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u6b64\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u79cd\u573a\u666f\u4e0b\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236<span class=\"application\">pg_basebackup</span>\u5728\u8fde\u63a5\u6e90\u670d\u52a1\u5668\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7edd\u975e\u5fc5\u9700\uff0c\u56e0\u4e3a\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u81ea\u52a8\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\u6765\u53d1\u73b0\u670d\u52a1\u5668\u9700\u8981\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u8f93\u5165<code class=\"option\">-W</code>\u4ee5\u907f\u514d\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u662f\u503c\u5f97\u7684\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5176\u4ed6\u9009\u9879\u4e5f\u53ef\u7528\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa<span class=\"application\">pg_basebackup</span>\u7684\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"application\">pg_basebackup</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6<span class=\"productname\">PostgreSQL</span>\u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528<span class=\"application\">libpq</span>\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/16/libpq-envars.html\" title=\"34.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a034.15\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\">\u73af\u5883\u53d8\u91cf<code class=\"envar\">PG_COLOR</code>\u6307\u5b9a\u662f\u5426\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a<code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c<code class=\"literal\">never</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u5728\u5907\u4efd\u5f00\u59cb\u65f6\uff0c\u9700\u8981\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u6267\u884c\u4e00\u6b21\u68c0\u67e5\u70b9\u3002\u8fd9\u53ef\u80fd\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\uff08\u5c24\u5176\u662f\u5728\u672a\u4f7f\u7528<code class=\"literal\">--checkpoint=fast</code>\u9009\u9879\u65f6\uff09\uff1b\u5728\u6b64\u671f\u95f4\uff0c<span class=\"application\">pg_basebackup</span>\u770b\u8d77\u6765\u4f1a\u5904\u4e8e\u7a7a\u95f2\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u5907\u4efd\u5c06\u5305\u62ec\u6570\u636e\u76ee\u5f55\u548c\u8868\u7a7a\u95f4\u4e2d\u7684\u6240\u6709\u6587\u4ef6\uff0c\u5305\u62ec\u914d\u7f6e\u6587\u4ef6\u4ee5\u53ca\u7b2c\u4e09\u65b9\u653e\u5728\u8fd9\u4e9b\u76ee\u5f55\u4e2d\u7684\u4efb\u4f55\u989d\u5916\u6587\u4ef6\uff0c\u4f46\u7531 PostgreSQL \u7ba1\u7406\u7684\u67d0\u4e9b\u4e34\u65f6\u6587\u4ef6\u548c\u64cd\u4f5c\u7cfb\u7edf\u6587\u4ef6\u9664\u5916\u3002\u4e0d\u8fc7\uff0c\u53ea\u6709\u666e\u901a\u6587\u4ef6\u548c\u76ee\u5f55\u4f1a\u88ab\u590d\u5236\uff0c\u4f46\u7528\u4e8e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u4f1a\u88ab\u4fdd\u7559\u3002\u6307\u5411 PostgreSQL \u5df2\u77e5\u7684\u67d0\u4e9b\u76ee\u5f55\u7684\u7b26\u53f7\u94fe\u63a5\u4f1a\u88ab\u590d\u5236\u4e3a\u7a7a\u76ee\u5f55\u3002\u5176\u4ed6\u7b26\u53f7\u94fe\u63a5\u548c\u7279\u6b8a\u8bbe\u5907\u6587\u4ef6\u5219\u4f1a\u88ab\u8df3\u8fc7\u3002\u5177\u4f53\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/16/protocol-replication.html\" title=\"55.4.\u00a0\u6d41\u590d\u5236\u534f\u8bae\">\u7b2c\u00a055.4\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5728\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u4e2d\uff0c\u9664\u975e\u4f7f\u7528\u4e86<code class=\"literal\">--tablespace-mapping</code>\u9009\u9879\uff0c\u5426\u5219\u8868\u7a7a\u95f4\u4f1a\u5907\u4efd\u5230\u5176\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u7684\u76f8\u540c\u8def\u5f84\u3002\u5982\u679c\u4e0d\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u90a3\u4e48\u5f53\u8868\u7a7a\u95f4\u6b63\u5728\u4f7f\u7528\u65f6\uff0c\u5c31\u65e0\u6cd5\u5728\u4e0e\u670d\u52a1\u5668\u76f8\u540c\u7684\u4e3b\u673a\u4e0a\u6267\u884c\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u7684\u57fa\u7840\u5907\u4efd\uff0c\u56e0\u4e3a\u5907\u4efd\u5c06\u4e0d\u5f97\u4e0d\u5199\u5165\u4e0e\u539f\u59cb\u8868\u7a7a\u95f4\u76f8\u540c\u7684\u76ee\u5f55\u4f4d\u7f6e\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u7528\u6237\u9700\u8981\u5728\u542f\u52a8\u4f7f\u7528\u8fd9\u4e9b\u6570\u636e\u7684 PostgreSQL \u670d\u52a1\u5668\u4e4b\u524d\uff0c\u81ea\u884c\u89e3\u5f00\u6bcf\u4e2a tar \u6587\u4ef6\u3002\u5982\u679c\u5b58\u5728\u989d\u5916\u7684\u8868\u7a7a\u95f4\uff0c\u5fc5\u987b\u5c06\u5bf9\u5e94\u7684 tar \u6587\u4ef6\u89e3\u538b\u5230\u6b63\u786e\u4f4d\u7f6e\u3002\u6b64\u65f6\uff0c\u670d\u52a1\u5668\u4f1a\u6839\u636e base.tar \u4e2d tablespace_map \u6587\u4ef6\u7684\u5185\u5bb9\uff0c\u4e3a\u8fd9\u4e9b\u8868\u7a7a\u95f4\u521b\u5efa\u7b26\u53f7\u94fe\u63a5\u3002</p>\n<p lang=\"zh\">pg_basebackup \u53ef\u4e0e\u76f8\u540c\u6216\u66f4\u65e9\u4e3b\u8981\u7248\u672c\u7684\u670d\u52a1\u5668\u914d\u5408\u4f7f\u7528\uff0c\u6700\u4f4e\u652f\u6301 9.1\u3002\u4e0d\u8fc7\uff0cWAL \u6d41\u5f0f\u4f20\u8f93\u6a21\u5f0f\uff08-X stream\uff09\u53ea\u9002\u7528\u4e8e 9.3 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\uff0ctar \u683c\u5f0f\uff08--format=tar\uff09\u53ea\u9002\u7528\u4e8e 9.5 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6e90\u96c6\u7c07\u542f\u7528\u4e86\u6570\u636e\u6587\u4ef6\u7684\u7ec4\u6743\u9650\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u4fdd\u7559\u8fd9\u4e9b\u7ec4\u6743\u9650\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.9\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u8981\u4e3a\u670d\u52a1\u5668<code class=\"literal\">mydbserver</code>\u521b\u5efa\u4e00\u4e2a\u57fa\u7840\u5907\u4efd\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5230\u672c\u5730\u76ee\u5f55<code class=\"filename\">/usr/local/pgsql/data</code>\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -h mydbserver -D /usr/local/pgsql/data</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u672c\u5730\u670d\u52a1\u5668\u521b\u5efa\u4e00\u4e2a\u5907\u4efd\uff0c\u4e3a\u6bcf\u4e2a\u8868\u7a7a\u95f4\u5404\u751f\u6210\u4e00\u4e2a\u538b\u7f29\u7684 tar \u6587\u4ef6\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5728\u76ee\u5f55<code class=\"filename\">backup</code>\u4e2d\uff0c\u540c\u65f6\u5728\u8fd0\u884c\u671f\u95f4\u663e\u793a\u8fdb\u5ea6\u62a5\u544a\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup -Ft -z -P</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u4e00\u4e2a\u4ec5\u5305\u542b\u5355\u4e2a\u8868\u7a7a\u95f4\u7684\u672c\u5730\u6570\u636e\u5e93\u521b\u5efa\u5907\u4efd\uff0c\u5e76\u4f7f\u7528<span class=\"productname\">bzip2</span>\u8fdb\u884c\u538b\u7f29\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D - -Ft -X fetch | bzip2 &gt; backup.tar.bz2</code></strong>\n</pre>\n<p lang=\"zh\">\uff08\u5982\u679c\u8be5\u6570\u636e\u5e93\u4e2d\u6709\u591a\u4e2a\u8868\u7a7a\u95f4\uff0c\u6b64\u547d\u4ee4\u5c06\u5931\u8d25\u3002\uff09</p>\n<p lang=\"zh\">\u8981\u521b\u5efa\u4e00\u4e2a\u672c\u5730\u6570\u636e\u5e93\u7684\u5907\u4efd\uff0c\u5e76\u5c06\u4f4d\u4e8e<code class=\"filename\">/opt/ts</code>\u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230<code class=\"filename\">./backup/ts</code>\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup/data -T /opt/ts=$(pwd)/backup/ts</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u672c\u5730\u670d\u52a1\u5668\u521b\u5efa\u4e00\u4e2a\u5907\u4efd\uff0c\u4e3a\u6bcf\u4e2a\u8868\u7a7a\u95f4\u751f\u6210\u4e00\u4e2a tar \u6587\u4ef6\uff0c\u5e76\u4f7f\u7528<span class=\"application\">gzip</span>\u4ee5 9 \u7ea7\u538b\u7f29\u540e\u5b58\u50a8\u5230\u76ee\u5f55<code class=\"filename\">backup</code>\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup -Ft --compress=gzip:9</code></strong>\n</pre>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.10\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/16/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/16/progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING\" title=\"28.4.6.\u00a0Base Backup Progress Reporting\">Section\u00a028.4.6</a></span>\n</div>\n</div></div>", "manual_path": "app-pgbasebackup.html", "localization": {"status": "complete", "sources": [{"url": "/docs/16/app-pgbasebackup.html", "method": "same-major semantic node", "sha256": "d56c9a3cb09b8ced8d742a6f08a1ab83d0d9edf8d4a01dcc24cec845db90c63d", "language": "zh", "matched_nodes": ["#APP-PGBASEBACKUP/div[2]/p[1]", "#APP-PGBASEBACKUP/div[3]/h2[0]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[0]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[1]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[2]", "#APP-PGBASEBACKUP/div[4]/div[7]/ul[0]/li[3]", "#APP-PGBASEBACKUP/div[4]/p[1]", "#APP-PGBASEBACKUP/div[4]/p[2]", "#APP-PGBASEBACKUP/div[4]/p[3]", "#APP-PGBASEBACKUP/div[4]/p[4]", "#APP-PGBASEBACKUP/div[4]/p[5]", "#APP-PGBASEBACKUP/div[4]/p[6]", "#APP-PGBASEBACKUP/div[4]/p[8]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/div[2]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/div[2]/dl[0]/dd[3]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/div[2]/dl[0]/dd[5]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/div[2]/dl[0]/dd[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/div[2]/dl[0]/dd[5]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[17]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[17]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[17]/p[3]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[17]/p[4]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[3]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[5]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[7]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[7]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[17]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[19]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[19]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[19]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[19]/p[3]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[21]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[23]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[23]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[25]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[27]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[27]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[27]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[29]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[29]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[7]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[7]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[7]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[8]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[8]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/p[3]", "#APP-PGBASEBACKUP/div[5]/p[5]", "#APP-PGBASEBACKUP/div[5]/p[7]", "#APP-PGBASEBACKUP/div[6]/h2[0]", "#APP-PGBASEBACKUP/div[6]/p[1]", "#APP-PGBASEBACKUP/div[6]/p[2]", "#APP-PGBASEBACKUP/div[7]/h2[0]", "#APP-PGBASEBACKUP/div[7]/p[1]", "#APP-PGBASEBACKUP/div[7]/p[2]", "#APP-PGBASEBACKUP/div[7]/p[3]", "#APP-PGBASEBACKUP/div[7]/p[6]", "#APP-PGBASEBACKUP/div[8]/h2[0]", "#APP-PGBASEBACKUP/div[8]/p[10]", "#APP-PGBASEBACKUP/div[8]/p[1]", "#APP-PGBASEBACKUP/div[8]/p[3]", "#APP-PGBASEBACKUP/div[8]/p[5]", "#APP-PGBASEBACKUP/div[8]/p[7]", "#APP-PGBASEBACKUP/div[8]/p[8]", "#APP-PGBASEBACKUP/div[9]/h2[0]"]}], "language": "zh", "original_text": {"/versions/16/description/0": "pg_basebackup \u2014 take a base backup of a PostgreSQL cluster", "/versions/16/facts/0/label": "Documented executable", "/versions/16/facts/1/label": "Executable version", "/versions/16/facts/2/label": "Reference inventory", "/versions/16/facts/2/value": "Client applications", "/versions/16/facts/3/label": "Option definition groups", "/versions/16/tables/0/title": "Documented options", "/versions/16/related/0/label": "libpq connection parameters", "/versions/16/tables/0/rows/0/summary": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty.", "/versions/16/tables/0/rows/1/summary": "Selects the format for the output. format can be one of the following:", "/versions/16/tables/0/rows/2/summary": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup.", "/versions/16/tables/0/rows/3/summary": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup.", "/versions/16/tables/0/rows/4/summary": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces.", "/versions/16/tables/0/rows/5/summary": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format.", "/versions/16/tables/0/rows/6/summary": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup.", "/versions/16/tables/0/rows/7/summary": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "/versions/16/tables/0/rows/8/summary": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch .", "/versions/16/tables/0/rows/9/summary": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 26.3.3 ).", "/versions/16/tables/0/columns/0/label": "Option and arguments", "/versions/16/tables/0/columns/1/label": "Description", "/versions/16/tables/0/rows/10/summary": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists.", "/versions/16/tables/0/rows/11/summary": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used.", "/versions/16/tables/0/rows/12/summary": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging.", "/versions/16/tables/0/rows/13/summary": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.", "/versions/16/tables/0/rows/14/summary": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.", "/versions/16/tables/0/rows/15/summary": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second.", "/versions/16/tables/0/rows/16/summary": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby.", "/versions/16/tables/0/rows/17/summary": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.", "/versions/16/tables/0/rows/18/summary": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C .", "/versions/16/tables/0/rows/19/summary": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case.", "/versions/16/tables/0/rows/20/summary": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL .", "/versions/16/tables/0/rows/21/summary": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file.", "/versions/16/tables/0/rows/22/summary": "Prevents the creation of a temporary replication slot for the backup.", "/versions/16/tables/0/rows/23/summary": "Disables verification of checksums, if they are enabled on the server the base backup is taken from.", "/versions/16/tables/0/rows/24/summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "/versions/16/tables/0/rows/25/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "/versions/16/tables/0/rows/26/summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "/versions/16/tables/0/rows/27/summary": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds.", "/versions/16/tables/0/rows/28/summary": "Specifies the user name to connect as.", "/versions/16/tables/0/rows/29/summary": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/16/tables/0/rows/30/summary": "Forces pg_basebackup to prompt for a password before connecting to the source server.", "/versions/16/tables/0/rows/31/summary": "Prints the pg_basebackup version and exits.", "/versions/16/tables/0/rows/32/summary": "Shows help about pg_basebackup command line arguments, and exits."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "7b33e16646f4b9b83b527036a3198dc35c5c66485931e1061dfb1e2e70859c1d"}, "comparison_data": {"options": [{"names": ["-D directory", "--pgdata= directory"], "signature": "-D directory --pgdata= directory", "description": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty. When the backup is in tar format, the target directory may be specified as - (dash), causing the tar file to be written to stdout . This option is required."}, {"names": ["-F format", "--format= format"], "signature": "-F format --format= format", "description": "Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the source server's data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory's contents will be written to a file named base.tar , and each other tablespace will be written to a separate tar file named after that tablespace's OID. If the target directory is specified as - (dash), the tar contents will be written to standard output, suitable for piping to (for example) gzip . This is only allowed if the cluster has no additional tablespaces and WAL streaming is not used."}, {"names": ["-R", "--write-recovery-conf"], "signature": "-R --write-recovery-conf", "description": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup. The postgresql.auto.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that streaming replication will use the same settings later on."}, {"names": ["-t target", "--target= target"], "signature": "-t target --target= target", "description": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup. Since WAL streaming is implemented by pg_basebackup rather than by the server, this option cannot be used together with -Xstream . Since that is the default, when this option is specified, you must also specify either -Xfetch or -Xnone ."}, {"names": ["-T olddir = newdir", "--tablespace-mapping= olddir = newdir"], "signature": "-T olddir = newdir --tablespace-mapping= olddir = newdir", "description": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected."}, {"names": ["--waldir= waldir"], "signature": "--waldir= waldir", "description": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format."}, {"names": ["-X method", "--wal-method= method"], "signature": "-X method --wal-method= method", "description": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup. The following method s for collecting the write-ahead logs are supported: n none Don't include write-ahead logs in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the source server's wal_keep_size parameter to be set high enough that the required log data is not removed before the end of the backup. If the required log data has been recycled before it's time to transfer it, the backup will fail and be unusable. When tar format is used, the write-ahead log files will be included in the base.tar file. s stream Stream write-ahead log data while the backup is being taken. This method will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will require two replication connections not just one. As long as the client can keep up with the write-ahead log data, using this method requires no extra write-ahead logs to be saved on the source server. When tar format is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default."}, {"names": ["-z", "--gzip"], "signature": "-z --gzip", "description": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-Z level", "-Z [{client|server}-] method [: detail ]", "--compress= level", "--compress=[{client|server}-] method [: detail ]"], "signature": "-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]", "description": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch . The compression method can be set to gzip , lz4 , zstd , none for no compression or an integer (no compression if 0, gzip if greater than 0). A compression detail string can optionally be specified. If the detail string is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form keyword or keyword=value . Currently, the supported keywords are level , long , and workers . The detail string cannot be used when the compression method is specified as a plain integer. If no compression level is specified, the default compression level will be used. If only a level is specified without mentioning an algorithm, gzip compression will be used if the level is greater than 0, and no compression will be used if the level is 0. When the tar format is used with gzip , lz4 , or zstd , the suffix .gz , .lz4 , or .zst , respectively, will be automatically added to all tar filenames. When the plain format is used, client-side compression may not be specified, but it is still possible to request server-side compression. If this is done, the server will compress the backup for transmission, and the client will decompress and extract it. When this option is used in combination with -Xstream , pg_wal.tar will be compressed using gzip if client-side gzip compression is selected, but will not be compressed if any other compression algorithm is selected, or if server-side compression is selected."}, {"names": ["-c {fast|spread}", "--checkpoint={fast|spread}"], "signature": "-c {fast|spread} --checkpoint={fast|spread}", "description": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 26.3.3 )."}, {"names": ["-C", "--create-slot"], "signature": "-C --create-slot", "description": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists."}, {"names": ["-l label", "--label= label"], "signature": "-l label --label= label", "description": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used."}, {"names": ["-n", "--no-clean"], "signature": "-n --no-clean", "description": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way."}, {"names": ["-N", "--no-sync"], "signature": "-N --no-sync", "description": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."}, {"names": ["-P", "--progress"], "signature": "-P --progress", "description": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL."}, {"names": ["-r rate", "--max-rate= rate"], "signature": "-r rate --max-rate= rate", "description": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch ."}, {"names": ["-S slotname", "--slot= slotname"], "signature": "-S slotname --slot= slotname", "description": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby. The specified replication slot has to exist unless the option -C is also used. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."}, {"names": ["--manifest-checksums= algorithm"], "signature": "--manifest-checksums= algorithm", "description": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C . If NONE is selected, the backup manifest will not contain any checksums. Otherwise, it will contain a checksum of each file in the backup using the specified algorithm. In addition, the manifest will always contain a SHA256 checksum of its own contents. The SHA algorithms are significantly more CPU-intensive than CRC32C , so selecting one of them may increase the time required to complete the backup. Using a SHA hash function provides a cryptographically secure digest of each file for users who wish to verify that the backup has not been tampered with, while the CRC32C algorithm provides a checksum that is much faster to calculate; it is good at catching errors due to accidental changes but is not resistant to malicious modifications. Note that, to be useful against an adversary who has access to the backup, the backup manifest would need to be stored securely elsewhere or otherwise verified not to have been modified since the backup was taken. pg_verifybackup can be used to check the integrity of a backup against the backup manifest."}, {"names": ["--manifest-force-encode"], "signature": "--manifest-force-encode", "description": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case."}, {"names": ["--no-estimate-size"], "signature": "--no-estimate-size", "description": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL . Without this option, the backup will start by enumerating the size of the entire database, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent. This option is useful to avoid such estimation time if it's too long. This option is not allowed when using --progress ."}, {"names": ["--no-manifest"], "signature": "--no-manifest", "description": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file."}, {"names": ["--no-slot"], "signature": "--no-slot", "description": "Prevents the creation of a temporary replication slot for the backup. By default, if log streaming is selected but no slot name is given with the -S option, then a temporary replication slot is created (if supported by the source server). The main purpose of this option is to allow taking a base backup when the server has no free replication slots. Using a replication slot is almost always preferred, because it prevents needed WAL from being removed by the server during the backup."}, {"names": ["--no-verify-checksums"], "signature": "--no-verify-checksums", "description": "Disables verification of checksums, if they are enabled on the server the base backup is taken from. By default, checksums are verified and checksum failures will result in a non-zero exit status. However, the base backup will not be removed in such a case, as if the --no-clean option had been used. Checksum verification failures will also be reported in the pg_stat_database view."}, {"names": ["-d connstr", "--dbname= connstr"], "signature": "-d connstr --dbname= connstr", "description": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. The option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, any database name in the connection string will be ignored."}, {"names": ["-h host", "--host= host"], "signature": "-h host --host= host", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-s interval", "--status-interval= interval"], "signature": "-s interval --status-interval= interval", "description": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Specifies the user name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Forces pg_basebackup to prompt for a password before connecting to the source server. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Prints the pg_basebackup version and exits."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Shows help about pg_basebackup command line arguments, and exits."}], "synopsis": ["pg_basebackup [ option ...]"], "environment": []}, "comparison_hash": "4c8ffc9b3c2690b878daa7b25f98eacb3779e8aef24f602543e86f43fa4fb027", "manual_language": "zh"}, "17": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_basebackup"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "17.11"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "35"}], "tables": [{"key": "options", "rows": [{"summary": "\u8bbe\u7f6e\u5199\u5165\u8f93\u51fa\u7684\u76ee\u6807\u76ee\u5f55\u3002\u5982\u679c\u8be5\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c pg_basebackup \u4f1a\u521b\u5efa\u5b83\uff08\u4ee5\u53ca\u6240\u6709\u7f3a\u5931\u7684\u7236\u76ee\u5f55\uff09\u3002\u5982\u679c\u8be5\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-D directory --pgdata= directory"}}, {"summary": "\u9009\u62e9\u8f93\u51fa\u683c\u5f0f\u3002 format \u53ef\u4ee5\u662f\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-F format --format= format"}}, {"summary": "\u6267\u884c \u589e\u91cf\u5907\u4efd \u3002\u5fc5\u987b\u63d0\u4f9b\u53c2\u8003\u5907\u4efd\u7684\u5907\u4efd\u6e05\u5355\uff1b\u8be5\u6587\u4ef6\u5c06\u88ab\u4e0a\u4f20\u5230\u670d\u52a1\u5668\uff0c\u968f\u540e\u670d\u52a1\u5668\u4f1a\u8fd4\u56de\u6240\u8bf7\u6c42\u7684\u589e\u91cf\u5907\u4efd\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-i old_manifest_file --incremental= old_manifest_file"}}, {"summary": "\u521b\u5efa standby.signal \u6587\u4ef6\uff0c\u5e76\u5c06\u8fde\u63a5\u8bbe\u7f6e\u8ffd\u52a0\u5230\u76ee\u6807\u76ee\u5f55\u4e2d\u7684 postgresql.auto.conf \u6587\u4ef6\u4e2d\uff08\u5982\u679c\u4f7f\u7528 tar \u683c\u5f0f\uff0c\u5219\u8ffd\u52a0\u5230\u57fa\u7840\u5f52\u6863\u6587\u4ef6\u5185\uff09\u3002\u8fd9\u6837\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u5229\u7528\u5907\u4efd\u7ed3\u679c\u642d\u5efa\u5907\u5e93\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-R --write-recovery-conf"}}, {"summary": "\u6307\u793a\u670d\u52a1\u5668\u5c06\u57fa\u7840\u5907\u4efd\u653e\u5230\u54ea\u91cc\u3002\u9ed8\u8ba4\u76ee\u6807\u662f client \uff0c\u8868\u793a\u5907\u4efd\u5e94\u53d1\u9001\u5230\u8fd0\u884c pg_basebackup \u7684\u90a3\u53f0\u673a\u5668\u3002\u5982\u679c\u76ee\u6807\u6539\u4e3a server:/some/path \uff0c\u5219\u5907\u4efd\u4f1a\u5b58\u50a8\u5728\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684 /some/path \u76ee\u5f55\u4e2d\u3002\u5c06\u5907\u4efd\u5b58\u50a8\u5728\u670d\u52a1\u5668\u4e0a\u9700\u8981\u8d85\u7ea7\u7528\u6237\u6743\u9650\uff0c\u6216\u62e5\u6709 pg_write_server_files \u89d2\u8272\u7684\u6743\u9650\u3002\u5982\u679c\u76ee\u6807\u8bbe\u7f6e\u4e3a blackhole \uff0c\u5219\u5185\u5bb9\u4f1a\u88ab\u4e22\u5f03\uff0c\u4e0d\u4f1a\u5b58\u50a8\u5230\u4efb\u4f55\u5730\u65b9\u3002\u8fd9\u53ea\u5e94\u7528\u4e8e\u6d4b\u8bd5\u76ee\u7684\uff0c\u56e0\u4e3a\u6700\u7ec8\u4e0d\u4f1a\u5f97\u5230\u5b9e\u9645\u5907\u4efd\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-t target --target= target"}}, {"summary": "\u5728\u5907\u4efd\u671f\u95f4\uff0c\u5c06\u76ee\u5f55 olddir \u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230 newdir \u3002\u8981\u4f7f\u6b64\u9009\u9879\u751f\u6548\uff0c olddir \u5fc5\u987b\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u5b9a\u4e49\u7684\u8be5\u8868\u7a7a\u95f4\u8def\u5f84\u5b8c\u5168\u4e00\u81f4\u3002\uff08\u4f46\u5982\u679c\u6e90\u670d\u52a1\u5668\u4e0a\u5728 olddir \u4e2d\u6ca1\u6709\u8868\u7a7a\u95f4\uff0c\u4e5f\u4e0d\u7b97\u9519\u8bef\u3002\uff09\u4e0e\u6b64\u540c\u65f6\uff0c newdir \u662f\u63a5\u6536\u4e3b\u673a\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u4e00\u4e2a\u76ee\u5f55\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c newdir \u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002 olddir \u548c newdir \u90fd\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u5982\u679c\u4efb\u4e00\u8def\u5f84\u4e2d\u9700\u8981\u5305\u542b\u7b49\u53f7\uff08 = \uff09\uff0c\u8bf7\u5728\u5176\u524d\u9762\u52a0\u4e0a\u53cd\u659c\u6760\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u4ee5\u5904\u7406\u591a\u4e2a\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-T olddir = newdir --tablespace-mapping= olddir = newdir"}}, {"summary": "\u8bbe\u7f6e\u5199\u5165 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cWAL \u6587\u4ef6\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u7684 pg_wal \u5b50\u76ee\u5f55\u4e2d\uff0c\u4f46\u6b64\u9009\u9879\u53ef\u7528\u4e8e\u5c06\u5176\u653e\u5728\u5176\u4ed6\u4f4d\u7f6e\u3002 waldir \u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c waldir \u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002\u53ea\u6709\u5f53\u5907\u4efd\u91c7\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u624d\u80fd\u6307\u5b9a\u6b64\u9009\u9879\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "--waldir= waldir"}}, {"summary": "\u5728\u5907\u4efd\u4e2d\u5305\u542b\u6240\u9700\u7684 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u3002\u8fd9\u5c06\u5305\u62ec\u5907\u4efd\u671f\u95f4\u751f\u6210\u7684\u6240\u6709\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u9664\u975e\u6307\u5b9a\u65b9\u6cd5 none \uff0c\u5426\u5219\u5c31\u53ef\u4ee5\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u542f\u52a8 postmaster\uff0c\u800c\u65e0\u9700\u67e5\u9605 WAL \u5f52\u6863\uff0c\u4ece\u800c\u4f7f\u8f93\u51fa\u6210\u4e3a\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u5907\u4efd\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-X method --wal-method= method"}}, {"summary": "\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u4f7f\u7528\u9ed8\u8ba4\u538b\u7f29\u7ea7\u522b\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0 .gz \u540e\u7f00\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-z --gzip"}}, {"summary": "\u8bf7\u6c42\u5bf9\u5907\u4efd\u8fdb\u884c\u538b\u7f29\u3002\u5982\u679c\u5305\u542b client \u6216 server \uff0c\u5219\u6307\u5b9a\u538b\u7f29\u6267\u884c\u7684\u4f4d\u7f6e\u3002\u5728\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4f1a\u51cf\u5c11\u4f20\u8f93\u5e26\u5bbd\u5360\u7528\uff0c\u4f46\u4f1a\u589e\u52a0\u670d\u52a1\u5668 CPU \u6d88\u8017\u3002\u9ed8\u8ba4\u503c\u662f client \uff0c\u4f46\u4f7f\u7528 --target \u65f6\u9664\u5916\uff1b\u6b64\u65f6\u5907\u4efd\u4e0d\u4f1a\u53d1\u9001\u5230\u5ba2\u6237\u7aef\uff0c\u56e0\u6b64\u53ea\u6709\u670d\u52a1\u5668\u7aef\u538b\u7f29\u624d\u6709\u610f\u4e49\u3002\u4f7f\u7528\u9ed8\u8ba4\u7684 -Xstream \u65f6\uff0c\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4e0d\u4f1a\u5e94\u7528\u4e8e WAL\u3002\u82e5\u8981\u538b\u7f29 WAL\uff0c\u8bf7\u4f7f\u7528\u5ba2\u6237\u7aef\u538b\u7f29\uff0c\u6216\u8005\u6307\u5b9a -Xfetch \u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]"}}, {"summary": "\u5c06\u68c0\u67e5\u70b9\u6a21\u5f0f\u8bbe\u7f6e\u4e3a fast\uff08\u7acb\u5373\uff09\u6216 spread\uff08\u9ed8\u8ba4\uff09\uff08\u89c1 \u7b2c 25.3.4 \u8282 \uff09\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-c {fast|spread} --checkpoint={fast|spread}"}}, {"summary": "\u6307\u5b9a\u5728\u5f00\u59cb\u5907\u4efd\u4e4b\u524d\uff0c\u5e94\u521b\u5efa\u7531 --slot \u9009\u9879\u6307\u5b9a\u540d\u79f0\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u8be5\u69fd\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u9519\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-C --create-slot"}}, {"summary": "\u8bbe\u7f6e\u5907\u4efd\u6807\u7b7e\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u503c \u201c pg_basebackup base backup \u201d \u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-l label --label= label"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53 pg_basebackup \u56e0\u9519\u8bef\u4e2d\u6b62\u65f6\uff0c\u5b83\u4f1a\u5220\u9664\u5728\u53d1\u73b0\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u76ee\u5f55\uff08\u4f8b\u5982\u76ee\u6807\u76ee\u5f55\u548c\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\uff09\u3002\u6b64\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u5f88\u6709\u5e2e\u52a9\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-n --no-clean"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_basebackup \u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u88ab\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f1a\u4f7f pg_basebackup \u4e0d\u7ecf\u7b49\u5f85\u5c31\u76f4\u63a5\u8fd4\u56de\uff0c\u56e0\u6b64\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u968f\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u57fa\u7840\u5907\u4efd\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u5408\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-N --no-sync"}}, {"summary": "\u542f\u7528\u8fdb\u5ea6\u62a5\u544a\u3002\u6253\u5f00\u6b64\u9009\u9879\u540e\uff0c\u4f1a\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u7ed9\u51fa\u4e00\u4e2a\u8fd1\u4f3c\u7684\u8fdb\u5ea6\u62a5\u544a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u53d1\u751f\u53d8\u5316\uff0c\u56e0\u6b64\u8fd9\u53ea\u662f\u8fd1\u4f3c\u503c\uff0c\u6700\u7ec8\u672a\u5fc5\u6070\u597d\u7ed3\u675f\u5728 100% \u3002\u7279\u522b\u662f\u5f53\u5907\u4efd\u4e2d\u5305\u542b WAL \u65f6\uff0c\u603b\u6570\u636e\u91cf\u65e0\u6cd5\u9884\u5148\u4f30\u8ba1\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u65e6\u8fdb\u5ea6\u8d85\u8fc7\u4e0d\u542b WAL \u65f6\u7684\u603b\u4f30\u8ba1\u503c\uff0c\u4f30\u8ba1\u76ee\u6807\u5927\u5c0f\u5c31\u4f1a\u7ee7\u7eed\u589e\u52a0\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-P --progress"}}, {"summary": "\u8bbe\u7f6e\u4ece\u6e90\u670d\u52a1\u5668\u6536\u96c6\u6570\u636e\u65f6\u5141\u8bb8\u7684\u6700\u5927\u4f20\u8f93\u901f\u7387\u3002\u8fd9\u6709\u52a9\u4e8e\u9650\u5236 pg_basebackup \u5bf9\u670d\u52a1\u5668\u7684\u5f71\u54cd\u3002\u53d6\u503c\u5355\u4f4d\u4e3a\u6bcf\u79d2\u5343\u5b57\u8282\u3002\u4f7f\u7528\u540e\u7f00 M \u8868\u793a\u6bcf\u79d2\u5146\u5b57\u8282\u3002\u4e5f\u63a5\u53d7\u540e\u7f00 k \uff0c\u4f46\u6ca1\u6709\u5b9e\u9645\u5f71\u54cd\u3002\u6709\u6548\u53d6\u503c\u8303\u56f4\u4e3a\u6bcf\u79d2 32 \u5343\u5b57\u8282\u5230\u6bcf\u79d2 1024 \u5146\u5b57\u8282\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-r rate --max-rate= rate"}}, {"summary": "\u6b64\u9009\u9879\u53ea\u80fd\u4e0e -X stream \u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u4f1a\u4f7f WAL \u6d41\u5f0f\u4f20\u8f93\u4f7f\u7528\u6307\u5b9a\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u6b64\u57fa\u7840\u5907\u4efd\u6253\u7b97\u7528\u4f5c\u4f7f\u7528\u590d\u5236\u69fd\u7684\u6d41\u590d\u5236\u5907\u5e93\uff0c\u90a3\u4e48\u8be5\u5907\u5e93\u5e94\u5c06\u540c\u4e00\u4e2a\u590d\u5236\u69fd\u540d\u79f0\u7528\u4f5c primary_slot_name \u7684\u503c\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u4e3b\u5e93\u5728\u57fa\u7840\u5907\u4efd\u7ed3\u675f\u4e0e\u65b0\u5907\u5e93\u5f00\u59cb\u6d41\u590d\u5236\u4e4b\u95f4\u7684\u8fd9\u6bb5\u65f6\u95f4\u5185\uff0c\u4e0d\u4f1a\u79fb\u9664\u4efb\u4f55\u5fc5\u9700\u7684 WAL \u6570\u636e\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-S slotname --slot= slotname"}}, {"summary": "\u8bbe\u7f6e\u4e3a fsync \uff08\u9ed8\u8ba4\uff09\u65f6\uff0c pg_basebackup \u4f1a\u9012\u5f52\u6253\u5f00\u5e76\u540c\u6b65\u5907\u4efd\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3002\u4f7f\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u67e5\u627e\u6587\u4ef6\u4f1a\u8ddf\u968f WAL \u76ee\u5f55\u548c\u5404\u5df2\u914d\u7f6e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "--sync-method= method"}}, {"summary": "\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\u3002\u5b83\u4f1a\u5728\u542f\u52a8\u548c\u5173\u95ed\u8fc7\u7a0b\u4e2d\u8f93\u51fa\u4e00\u4e9b\u989d\u5916\u6b65\u9aa4\uff1b\u5982\u679c\u540c\u65f6\u542f\u7528\u4e86\u8fdb\u5ea6\u62a5\u544a\uff0c\u8fd8\u4f1a\u663e\u793a\u5f53\u524d\u6b63\u5728\u5904\u7406\u7684\u786e\u5207\u6587\u4ef6\u540d\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-v --verbose"}}, {"summary": "\u6307\u5b9a\u5e94\u7528\u5230\u5907\u4efd\u6e05\u5355\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u7684\u6821\u9a8c\u548c\u7b97\u6cd5\u3002\u76ee\u524d\u53ef\u7528\u7684\u7b97\u6cd5\u6709 NONE \u3001 CRC32C \u3001 SHA224 \u3001 SHA256 \u3001 SHA384 \u548c SHA512 \u3002\u9ed8\u8ba4\u503c\u4e3a CRC32C \u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "--manifest-checksums= algorithm"}}, {"summary": "\u5f3a\u5236\u5c06\u5907\u4efd\u6e05\u5355\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u540d\u7f16\u7801\u4e3a\u5341\u516d\u8fdb\u5236\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u5bf9\u975e UTF8 \u6587\u4ef6\u540d\u8fdb\u884c\u5341\u516d\u8fdb\u5236\u7f16\u7801\u3002\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u8bfb\u53d6\u5907\u4efd\u6e05\u5355\u6587\u4ef6\u7684\u5de5\u5177\u662f\u5426\u80fd\u6b63\u786e\u5904\u7406\u8fd9\u79cd\u60c5\u51b5\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "--manifest-force-encode"}}, {"summary": "\u7981\u6b62\u670d\u52a1\u5668\u4f30\u7b97\u5c06\u8981\u6d41\u5f0f\u4f20\u8f93\u7684\u5907\u4efd\u6570\u636e\u603b\u91cf\uff0c\u56e0\u6b64 pg_stat_progress_basebackup \u89c6\u56fe\u4e2d\u7684 backup_total \u5217\u59cb\u7ec8\u4e3a NULL\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "--no-estimate-size"}}, {"summary": "\u7981\u6b62\u751f\u6210\u5907\u4efd\u6e05\u5355\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u670d\u52a1\u5668\u5c06\u751f\u6210\u5e76\u53d1\u9001\u4e00\u4e2a\u5907\u4efd\u6e05\u5355\uff0c\u53ef\u4f7f\u7528 pg_verifybackup \u8fdb\u884c\u9a8c\u8bc1\u3002\u8be5\u6e05\u5355\u5217\u51fa\u4e86\u5907\u4efd\u4e2d\u7684\u6bcf\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u4e0d\u5305\u62ec\u53ef\u80fd\u5305\u542b\u5728\u5176\u4e2d\u7684\u4efb\u4f55 WAL \u6587\u4ef6\u3002\u5b83\u8fd8\u4f1a\u4fdd\u5b58\u6bcf\u4e2a\u6587\u4ef6\u7684\u5927\u5c0f\u3001\u6700\u540e\u4fee\u6539\u65f6\u95f4\u4ee5\u53ca\u53ef\u9009\u7684\u6821\u9a8c\u548c\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "--no-manifest"}}, {"summary": "\u9632\u6b62\u4e3a\u5907\u4efd\u521b\u5efa\u4e34\u65f6\u590d\u5236\u69fd\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "--no-slot"}}, {"summary": "\u5982\u679c\u83b7\u53d6\u57fa\u7840\u5907\u4efd\u7684\u670d\u52a1\u5668\u542f\u7528\u4e86\u6821\u9a8c\u548c\uff0c\u5219\u7981\u7528\u5bf9\u8fd9\u4e9b\u6821\u9a8c\u548c\u7684\u9a8c\u8bc1\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "--no-verify-checksums"}}, {"summary": "\u4ee5 \u8fde\u63a5\u5b57\u7b26\u4e32 \u7684\u5f62\u5f0f\u6307\u5b9a\u7528\u4e8e\u8fde\u63a5\u670d\u52a1\u5668\u7684\u53c2\u6570\uff1b\u8fd9\u4e9b\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u76f8\u4e92\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-d connstr --dbname= connstr"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGHOST \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff1b\u5426\u5219\u4f1a\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-h host --host= host"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u6240\u4f7f\u7528\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u4e2d\u7684\u503c\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u786e\u5b9a\u7684\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-p port --port= port"}}, {"summary": "\u6307\u5b9a\u53d1\u9001\u56de\u6e90\u670d\u52a1\u5668\u7684\u72b6\u6001\u5305\u4e4b\u95f4\u76f8\u9694\u7684\u79d2\u6570\u3002\u8f83\u5c0f\u7684\u503c\u53ef\u4ee5\u8ba9\u670d\u52a1\u5668\u7aef\u5bf9\u5907\u4efd\u8fdb\u5ea6\u7684\u76d1\u63a7\u66f4\u7cbe\u786e\u3002\u503c\u4e3a\u96f6\u65f6\u4f1a\u5b8c\u5168\u7981\u7528\u5468\u671f\u6027\u72b6\u6001\u66f4\u65b0\uff0c\u4e0d\u8fc7\u5f53\u670d\u52a1\u5668\u8bf7\u6c42\u65f6\u4ecd\u4f1a\u53d1\u9001\u66f4\u65b0\uff0c\u4ee5\u907f\u514d\u56e0\u8d85\u65f6\u800c\u65ad\u5f00\u8fde\u63a5\u3002\u9ed8\u8ba4\u503c\u662f 10 \u79d2\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-s interval --status-interval= interval"}}, {"summary": "\u6307\u5b9a\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-U username --username= username"}}, {"summary": "\u7981\u6b62\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\uff08\u4f8b\u5982 .pgpass \u6587\u4ef6\uff09\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u6b64\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u79cd\u573a\u666f\u4e0b\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 pg_basebackup \u5728\u8fde\u63a5\u6e90\u670d\u52a1\u5668\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-W --password"}}, {"summary": "\u8f93\u51fa pg_basebackup \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-V --version"}}, {"summary": "\u663e\u793a pg_basebackup \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/17/app-pgbasebackup.html", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}], "options": [{"names": ["-D directory", "--pgdata= directory"], "summary": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty.", "signature": "-D directory --pgdata= directory", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty. When the backup is in tar format, the target directory may be specified as - (dash), causing the tar file to be written to stdout . This option is required."}, {"names": ["-F format", "--format= format"], "summary": "Selects the format for the output. format can be one of the following:", "signature": "-F format --format= format", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the source server's data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory's contents will be written to a file named base.tar , and each other tablespace will be written to a separate tar file named after that tablespace's OID. If the target directory is specified as - (dash), the tar contents will be written to standard output, suitable for piping to (for example) gzip . This is only allowed if the cluster has no additional tablespaces and WAL streaming is not used."}, {"names": ["-i old_manifest_file", "--incremental= old_manifest_file"], "summary": "Performs an incremental backup . The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup.", "signature": "-i old_manifest_file --incremental= old_manifest_file", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Performs an incremental backup . The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup."}, {"names": ["-R", "--write-recovery-conf"], "summary": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup.", "signature": "-R --write-recovery-conf", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup. The postgresql.auto.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that streaming replication and logical replication slot synchronization will use the same settings later on. The dbname will be recorded only if the dbname was specified explicitly in the connection string or environment variable ."}, {"names": ["-t target", "--target= target"], "summary": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup.", "signature": "-t target --target= target", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup. Since WAL streaming is implemented by pg_basebackup rather than by the server, this option cannot be used together with -Xstream . Since that is the default, when this option is specified, you must also specify either -Xfetch or -Xnone ."}, {"names": ["-T olddir = newdir", "--tablespace-mapping= olddir = newdir"], "summary": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces.", "signature": "-T olddir = newdir --tablespace-mapping= olddir = newdir", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected."}, {"names": ["--waldir= waldir"], "summary": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format.", "signature": "--waldir= waldir", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format."}, {"names": ["-X method", "--wal-method= method"], "summary": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup.", "signature": "-X method --wal-method= method", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup. The following method s for collecting the write-ahead logs are supported: n none Don't include write-ahead logs in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the source server's wal_keep_size parameter to be set high enough that the required log data is not removed before the end of the backup. If the required log data has been recycled before it's time to transfer it, the backup will fail and be unusable. When tar format is used, the write-ahead log files will be included in the base.tar file. s stream Stream write-ahead log data while the backup is being taken. This method will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will require two replication connections not just one. As long as the client can keep up with the write-ahead log data, using this method requires no extra write-ahead logs to be saved on the source server. When tar format is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default."}, {"names": ["-z", "--gzip"], "summary": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "signature": "-z --gzip", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-Z level", "-Z [{client|server}-] method [: detail ]", "--compress= level", "--compress=[{client|server}-] method [: detail ]"], "summary": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch .", "signature": "-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch . The compression method can be set to gzip , lz4 , zstd , none for no compression or an integer (no compression if 0, gzip if greater than 0). A compression detail string can optionally be specified. If the detail string is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form keyword or keyword=value . Currently, the supported keywords are level , long , and workers . The detail string cannot be used when the compression method is specified as a plain integer. If no compression level is specified, the default compression level will be used. If only a level is specified without mentioning an algorithm, gzip compression will be used if the level is greater than 0, and no compression will be used if the level is 0. When the tar format is used with gzip , lz4 , or zstd , the suffix .gz , .lz4 , or .zst , respectively, will be automatically added to all tar filenames. When the plain format is used, client-side compression may not be specified, but it is still possible to request server-side compression. If this is done, the server will compress the backup for transmission, and the client will decompress and extract it. When this option is used in combination with -Xstream , pg_wal.tar will be compressed using gzip if client-side gzip compression is selected, but will not be compressed if any other compression algorithm is selected, or if server-side compression is selected."}, {"names": ["-c {fast|spread}", "--checkpoint={fast|spread}"], "summary": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 25.3.4 ).", "signature": "-c {fast|spread} --checkpoint={fast|spread}", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 25.3.4 )."}, {"names": ["-C", "--create-slot"], "summary": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists.", "signature": "-C --create-slot", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists."}, {"names": ["-l label", "--label= label"], "summary": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used.", "signature": "-l label --label= label", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used."}, {"names": ["-n", "--no-clean"], "summary": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging.", "signature": "-n --no-clean", "source_url": "/docs/17/app-pgbasebackup.html", "description": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way."}, {"names": ["-N", "--no-sync"], "summary": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.", "signature": "-N --no-sync", "source_url": "/docs/17/app-pgbasebackup.html", "description": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."}, {"names": ["-P", "--progress"], "summary": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.", "signature": "-P --progress", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL."}, {"names": ["-r rate", "--max-rate= rate"], "summary": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second.", "signature": "-r rate --max-rate= rate", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch ."}, {"names": ["-S slotname", "--slot= slotname"], "summary": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby.", "signature": "-S slotname --slot= slotname", "source_url": "/docs/17/app-pgbasebackup.html", "description": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby. The specified replication slot has to exist unless the option -C is also used. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming."}, {"names": ["--sync-method= method"], "summary": "When set to fsync , which is the default, pg_basebackup will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace.", "signature": "--sync-method= method", "source_url": "/docs/17/app-pgbasebackup.html", "description": "When set to fsync , which is the default, pg_basebackup will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace. On Linux, syncfs may be used instead to ask the operating system to synchronize the whole file system that contains the backup directory. When the plain format is used, pg_basebackup will also synchronize the file systems that contain the WAL files and each tablespace. See recovery_init_sync_method for information about the caveats to be aware of when using syncfs . This option has no effect when --no-sync is used."}, {"names": ["-v", "--verbose"], "summary": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.", "signature": "-v --verbose", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."}, {"names": ["--manifest-checksums= algorithm"], "summary": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C .", "signature": "--manifest-checksums= algorithm", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C . If NONE is selected, the backup manifest will not contain any checksums. Otherwise, it will contain a checksum of each file in the backup using the specified algorithm. In addition, the manifest will always contain a SHA256 checksum of its own contents. The SHA algorithms are significantly more CPU-intensive than CRC32C , so selecting one of them may increase the time required to complete the backup. Using a SHA hash function provides a cryptographically secure digest of each file for users who wish to verify that the backup has not been tampered with, while the CRC32C algorithm provides a checksum that is much faster to calculate; it is good at catching errors due to accidental changes but is not resistant to malicious modifications. Note that, to be useful against an adversary who has access to the backup, the backup manifest would need to be stored securely elsewhere or otherwise verified not to have been modified since the backup was taken. pg_verifybackup can be used to check the integrity of a backup against the backup manifest."}, {"names": ["--manifest-force-encode"], "summary": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case.", "signature": "--manifest-force-encode", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case."}, {"names": ["--no-estimate-size"], "summary": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL .", "signature": "--no-estimate-size", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL . Without this option, the backup will start by enumerating the size of the entire database, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent. This option is useful to avoid such estimation time if it's too long. This option is not allowed when using --progress ."}, {"names": ["--no-manifest"], "summary": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file.", "signature": "--no-manifest", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file."}, {"names": ["--no-slot"], "summary": "Prevents the creation of a temporary replication slot for the backup.", "signature": "--no-slot", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Prevents the creation of a temporary replication slot for the backup. By default, if log streaming is selected but no slot name is given with the -S option, then a temporary replication slot is created (if supported by the source server). The main purpose of this option is to allow taking a base backup when the server has no free replication slots. Using a replication slot is almost always preferred, because it prevents needed WAL from being removed by the server during the backup."}, {"names": ["--no-verify-checksums"], "summary": "Disables verification of checksums, if they are enabled on the server the base backup is taken from.", "signature": "--no-verify-checksums", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Disables verification of checksums, if they are enabled on the server the base backup is taken from. By default, checksums are verified and checksum failures will result in a non-zero exit status. However, the base backup will not be removed in such a case, as if the --no-clean option had been used. Checksum verification failures will also be reported in the pg_stat_database view."}, {"names": ["-d connstr", "--dbname= connstr"], "summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": "-d connstr --dbname= connstr", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. This option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, any database name included in the connection string will be ignored by the server. However, a database name supplied that way overrides the default database name ( replication ) for purposes of looking up the replication connection's password in ~/.pgpass . Similarly, middleware or proxies used in connecting to PostgreSQL might utilize the name for purposes such as connection routing. The database name can also be used by logical replication slot synchronization ."}, {"names": ["-h host", "--host= host"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "signature": "-h host --host= host", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "signature": "-p port --port= port", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-s interval", "--status-interval= interval"], "summary": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds.", "signature": "-s interval --status-interval= interval", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds."}, {"names": ["-U username", "--username= username"], "summary": "Specifies the user name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Specifies the user name to connect as."}, {"names": ["-w", "--no-password"], "summary": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "summary": "Forces pg_basebackup to prompt for a password before connecting to the source server.", "signature": "-W --password", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Forces pg_basebackup to prompt for a password before connecting to the source server. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["-V", "--version"], "summary": "Prints the pg_basebackup version and exits.", "signature": "-V --version", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Prints the pg_basebackup version and exits."}, {"names": ["-?", "--help"], "summary": "Shows help about pg_basebackup command line arguments, and exits.", "signature": "-? --help", "source_url": "/docs/17/app-pgbasebackup.html", "description": "Shows help about pg_basebackup command line arguments, and exits."}], "related": [{"url": "/wiki/conn/?v=17", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v17.11/postgresql-17.11.tar.bz2", "label": "17.11", "major": "17", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/17/postgresql-17-A4.pdf", "bytes": 15521293, "pages": 3099, "sha256": "1991354df0dc89e70ec39328c28988ef8b19c6a93671dab3893650b63e9f4e36", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/17/postgresql-17-US.pdf", "bytes": 15398150, "pages": 3270, "sha256": "07696c8f38abf31babf22d2db337093936e7c472d2af36d050b000c49bbcf52c", "built_at": "2026-09-26"}}, "tree": "17", "index": "index.html", "major": "17", "pages": 1143, "release": "17.11", "source_url": "https://ftp.postgresql.org/pub/source/v17.11/postgresql-17.11.tar.bz2", "svg_assets": 3, "source_mode": "en SGML built with pinned official archive", "source_sha256": "dd27f2b3c59e73ed14aa3324901242bf69a032a6347805f274e6260322d42979"}, "revision": "58419c9b0dd42cb34c8d53695bb025a7e582edf55ccd4c5bcb1c2c7c71a37487", "evidence_kind": "English manual and source declarations", "source_sha256": "dd27f2b3c59e73ed14aa3324901242bf69a032a6347805f274e6260322d42979"}, "sources": [{"url": "https://pg.center/docs/17/app-pgbasebackup.html", "file": "app-pgbasebackup.html", "label": "17.11 English manual \u00b7 app-pgbasebackup.html", "anchor": "", "sha256": "1b224ac91af880c3a70def02a70217c438c95be576b5a92648f6de9cbce5f1c2", "language": "en", "original_url": "/docs/17/app-pgbasebackup.html"}, {"url": "https://pg.center/docs/17/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "3194fc72ddad8e2fcba55f8e007f83413cb352146cb65aaa9457a18d0314ee1b", "language": "en", "original_url": "/docs/17/reference-client.html"}], "sections": [], "synopsis": ["pg_basebackup [ option ...]"], "signature": "pg_basebackup [ option ...]", "description": ["pg_basebackup \u2014 \u83b7\u53d6 PostgreSQL \u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd"], "environment": [], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGBASEBACKUP\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_basebackup</span></span></h2>\n<p lang=\"zh\">pg_basebackup \u2014 \u83b7\u53d6<span class=\"productname\">PostgreSQL</span>\u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.10.4.1\"><code class=\"command\">pg_basebackup</code> [<em class=\"replaceable\"><code>option</code></em>...]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u7528\u4e8e\u83b7\u53d6\u6b63\u5728\u8fd0\u884c\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd\u3002\u5907\u4efd\u8fc7\u7a0b\u4e0d\u4f1a\u5f71\u54cd\u6570\u636e\u5e93\u7684\u5176\u4ed6\u5ba2\u6237\u7aef\uff0c\u5e76\u4e14\u8be5\u5907\u4efd\u65e2\u53ef\u7528\u4e8e\u65f6\u95f4\u70b9\u6062\u590d\uff08\u89c1<a class=\"xref\" href=\"/docs/17/continuous-archiving.html\" title=\"25.3.\u00a0\u6301\u7eed\u5f52\u6863\u548c\u65f6\u95f4\u70b9\u6062\u590d\uff08PITR\uff09\">\u7b2c\u00a025.3\u00a0\u8282</a>\uff09\uff0c\u4e5f\u53ef\u7528\u4f5c\u65e5\u5fd7\u4f20\u9001\u6216\u6d41\u590d\u5236\u5907\u5e93\u7684\u8d77\u70b9\uff08\u89c1<a class=\"xref\" href=\"/docs/17/warm-standby.html\" title=\"26.2.\u00a0\u65e5\u5fd7\u4f20\u9001\u5907\u5e93\">\u7b2c\u00a026.2\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u65e2\u53ef\u4ee5\u6267\u884c\u5b8c\u6574\u57fa\u7840\u5907\u4efd\uff0c\u4e5f\u53ef\u4ee5\u6267\u884c\u589e\u91cf\u57fa\u7840\u5907\u4efd\u3002\u6267\u884c\u5b8c\u6574\u5907\u4efd\u65f6\uff0c\u5b83\u4f1a\u7cbe\u786e\u590d\u5236\u6570\u636e\u5e93\u96c6\u7c07\u7684\u6587\u4ef6\u3002\u6267\u884c\u589e\u91cf\u5907\u4efd\u65f6\uff0c\u539f\u672c\u4f1a\u5305\u542b\u5728\u5b8c\u6574\u5907\u4efd\u4e2d\u7684\u67d0\u4e9b\u6587\u4ef6\uff0c\u53ef\u80fd\u4f1a\u88ab\u8fd9\u4e9b\u6587\u4ef6\u7684\u589e\u91cf\u7248\u672c\u66ff\u4ee3\uff0c\u5176\u4e2d\u4ec5\u5305\u542b\u81ea\u53c2\u8003\u5907\u4efd\u4ee5\u6765\u88ab\u4fee\u6539\u8fc7\u7684\u5757\u3002\u589e\u91cf\u5907\u4efd\u4e0d\u80fd\u76f4\u63a5\u4f7f\u7528\uff1b\u5fc5\u987b\u5148\u4f7f\u7528<a class=\"xref\" href=\"/docs/17/app-pgcombinebackup.html\" title=\"pg_combinebackup\"><span class=\"refentrytitle\"><span class=\"application\">pg_combinebackup</span></span></a>\u5c06\u5176\u4e0e\u5b83\u6240\u4f9d\u8d56\u7684\u5148\u524d\u5907\u4efd\u5408\u5e76\u3002\u5173\u4e8e\u589e\u91cf\u5907\u4efd\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u89c1<a class=\"xref\" href=\"/docs/17/continuous-archiving.html#BACKUP-INCREMENTAL-BACKUP\" title=\"25.3.3.\u00a0\u8fdb\u884c\u589e\u91cf\u5907\u4efd\">\u7b2c\u00a025.3.3\u00a0\u8282</a>\uff1b\u5173\u4e8e\u4ece\u5907\u4efd\u6062\u590d\u7684\u6b65\u9aa4\uff0c\u89c1<a class=\"xref\" href=\"/docs/17/continuous-archiving.html#BACKUP-PITR-RECOVERY\" title=\"25.3.5.\u00a0\u4f7f\u7528\u6301\u7eed\u5f52\u6863\u5907\u4efd\u8fdb\u884c\u6062\u590d\">\u7b2c\u00a025.3.5\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5728\u4efb\u4f55\u6a21\u5f0f\u4e0b\uff0c<span class=\"application\">pg_basebackup</span>\u90fd\u4f1a\u786e\u4fdd\u670d\u52a1\u5668\u81ea\u52a8\u8fdb\u5165\u548c\u9000\u51fa\u5907\u4efd\u6a21\u5f0f\u3002\u5907\u4efd\u59cb\u7ec8\u9488\u5bf9\u6574\u4e2a\u6570\u636e\u5e93\u96c6\u7c07\uff1b\u4e0d\u53ef\u80fd\u53ea\u5907\u4efd\u5355\u4e2a\u6570\u636e\u5e93\u6216\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u5bf9\u4e8e\u9009\u62e9\u6027\u5907\u4efd\uff0c\u5fc5\u987b\u4f7f\u7528\u8bf8\u5982<a class=\"xref\" href=\"/docs/17/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>\u4e4b\u7c7b\u7684\u5176\u4ed6\u5de5\u5177\u3002</p>\n<p lang=\"zh\">\u5907\u4efd\u662f\u901a\u8fc7\u4e00\u4e2a\u4f7f\u7528\u590d\u5236\u534f\u8bae\u7684\u5e38\u89c4<span class=\"productname\">PostgreSQL</span>\u8fde\u63a5\u8fdb\u884c\u7684\u3002\u5efa\u7acb\u8be5\u8fde\u63a5\u6240\u4f7f\u7528\u7684\u7528\u6237 ID \u5fc5\u987b\u5177\u6709<code class=\"literal\">REPLICATION</code>\u6743\u9650\uff08\u89c1<a class=\"xref\" href=\"/docs/17/role-attributes.html\" title=\"21.2.\u00a0\u89d2\u8272\u5c5e\u6027\">\u7b2c\u00a021.2\u00a0\u8282</a>\uff09\uff0c\u6216\u8005\u662f\u8d85\u7ea7\u7528\u6237\uff0c\u5e76\u4e14<a class=\"link\" href=\"/docs/17/auth-pg-hba-conf.html\" title=\"20.1.\u00a0pg_hba.conf \u6587\u4ef6\"><code class=\"filename\">pg_hba.conf</code></a>\u5fc5\u987b\u5141\u8bb8\u8be5\u590d\u5236\u8fde\u63a5\u3002\u670d\u52a1\u5668\u8fd8\u5fc5\u987b\u5c06<a class=\"xref\" href=\"/docs/17/runtime-config-replication.html#GUC-MAX-WAL-SENDERS\">max_wal_senders</a>\u8bbe\u7f6e\u5f97\u8db3\u591f\u9ad8\uff0c\u4ee5\u4fbf\u81f3\u5c11\u63d0\u4f9b\u4e00\u4e2a\u7528\u4e8e\u5907\u4efd\u7684 WAL \u53d1\u9001\u8fdb\u7a0b\uff0c\u5e76\u5728\u4f7f\u7528 WAL \u6d41\u5f0f\u4f20\u8f93\u65f6\u518d\u63d0\u4f9b\u4e00\u4e2a WAL \u53d1\u9001\u8fdb\u7a0b\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u540c\u65f6\u8fd0\u884c\u591a\u4e2a<code class=\"command\">pg_basebackup</code>\uff0c\u4f46\u4ece\u6027\u80fd\u89d2\u5ea6\u6765\u770b\uff0c\u901a\u5e38\u6700\u597d\u53ea\u6267\u884c\u4e00\u6b21\u5907\u4efd\uff0c\u7136\u540e\u590d\u5236\u5176\u7ed3\u679c\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u4e0d\u4ec5\u53ef\u4ee5\u4ece\u4e3b\u5e93\u83b7\u53d6\u57fa\u7840\u5907\u4efd\uff0c\u4e5f\u53ef\u4ee5\u4ece\u5907\u5e93\u83b7\u53d6\u3002\u8981\u4ece\u5907\u5e93\u83b7\u53d6\u5907\u4efd\uff0c\u9700\u8981\u5c06\u5907\u5e93\u914d\u7f6e\u4e3a\u80fd\u591f\u63a5\u53d7\u590d\u5236\u8fde\u63a5\uff08\u5373\u8bbe\u7f6e<code class=\"varname\">max_wal_senders</code>\u548c<a class=\"xref\" href=\"/docs/17/runtime-config-replication.html#GUC-HOT-STANDBY\">hot_standby</a>\uff0c\u5e76\u9002\u5f53\u5730\u914d\u7f6e\u5176<code class=\"filename\">pg_hba.conf</code>\uff09\u3002\u8fd8\u9700\u8981\u5728\u4e3b\u5e93\u4e0a\u542f\u7528<a class=\"xref\" href=\"/docs/17/runtime-config-wal.html#GUC-FULL-PAGE-WRITES\">full_page_writes</a>\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u4ece\u5907\u5e93\u83b7\u53d6\u5907\u4efd\u5b58\u5728\u4e00\u4e9b\u9650\u5236\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5907\u4efd\u5386\u53f2\u6587\u4ef6\u4e0d\u4f1a\u5728\u88ab\u5907\u4efd\u7684\u6570\u636e\u5e93\u96c6\u7c07\u4e2d\u521b\u5efa\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">pg_basebackup</span>\u65e0\u6cd5\u5f3a\u5236\u5907\u5e93\u5728\u5907\u4efd\u7ed3\u675f\u65f6\u5207\u6362\u5230\u65b0\u7684 WAL \u6587\u4ef6\u3002\u5f53\u4f7f\u7528<code class=\"literal\">-X none</code>\u65f6\uff0c\u5982\u679c\u4e3b\u5e93\u4e0a\u7684\u5199\u5165\u6d3b\u52a8\u8f83\u5c11\uff0c<span class=\"application\">pg_basebackup</span>\u53ef\u80fd\u9700\u8981\u957f\u65f6\u95f4\u7b49\u5f85\uff0c\u76f4\u5230\u5907\u4efd\u6240\u9700\u7684\u6700\u540e\u4e00\u4e2a WAL \u6587\u4ef6\u88ab\u5207\u6362\u5e76\u5f52\u6863\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5728\u4e3b\u5e93\u4e0a\u8fd0\u884c<code class=\"function\">pg_switch_wal</code>\uff0c\u4ee5\u7acb\u5373\u89e6\u53d1 WAL \u6587\u4ef6\u5207\u6362\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5982\u679c\u5907\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u88ab\u63d0\u5347\u4e3a\u4e3b\u5e93\uff0c\u5219\u5907\u4efd\u4f1a\u5931\u8d25\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5907\u4efd\u6240\u9700\u7684\u6240\u6709 WAL \u8bb0\u5f55\u90fd\u5fc5\u987b\u5305\u542b\u8db3\u591f\u7684\u6574\u9875\u5199\u5165\uff0c\u56e0\u6b64\u5fc5\u987b\u5728\u4e3b\u5e93\u4e0a\u542f\u7528<code class=\"varname\">full_page_writes</code>\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u6bcf\u5f53<span class=\"application\">pg_basebackup</span>\u6267\u884c\u57fa\u7840\u5907\u4efd\u65f6\uff0c\u670d\u52a1\u5668\u7684<code class=\"structname\">pg_stat_progress_basebackup</code>\u89c6\u56fe\u90fd\u4f1a\u62a5\u544a\u5907\u4efd\u8fdb\u5ea6\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/17/progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING\" title=\"27.4.6.\u00a0\u57fa\u7840\u5907\u4efd\u8fdb\u5ea6\u62a5\u544a\">\u7b2c\u00a027.4.6\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u8f93\u51fa\u7684\u4f4d\u7f6e\u548c\u683c\u5f0f\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>directory</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u5199\u5165\u8f93\u51fa\u7684\u76ee\u6807\u76ee\u5f55\u3002\u5982\u679c\u8be5\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u521b\u5efa\u5b83\uff08\u4ee5\u53ca\u6240\u6709\u7f3a\u5931\u7684\u7236\u76ee\u5f55\uff09\u3002\u5982\u679c\u8be5\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002</p>\n<p lang=\"zh\">\u5f53\u5907\u4efd\u91c7\u7528 tar \u683c\u5f0f\u65f6\uff0c\u76ee\u6807\u76ee\u5f55\u53ef\u4ee5\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff08\u77ed\u6a2a\u7ebf\uff09\uff0c\u4ece\u800c\u5c06 tar \u6587\u4ef6\u5199\u5230<code class=\"literal\">stdout</code>\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u662f\u5fc5\u9700\u7684\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>format</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--format=<em class=\"replaceable\"><code>format</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u9009\u62e9\u8f93\u51fa\u683c\u5f0f\u3002<em class=\"replaceable\"><code>format</code></em>\u53ef\u4ee5\u662f\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">p</code><br/></span><span class=\"term\"><code class=\"literal\">plain</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u5199\u4e3a\u666e\u901a\u6587\u4ef6\uff0c\u5176\u5e03\u5c40\u4e0e\u6e90\u670d\u52a1\u5668\u7684\u6570\u636e\u76ee\u5f55\u548c\u8868\u7a7a\u95f4\u76f8\u540c\u3002\u5f53\u96c6\u7c07\u6ca1\u6709\u989d\u5916\u8868\u7a7a\u95f4\u65f6\uff0c\u6574\u4e2a\u6570\u636e\u5e93\u90fd\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u3002\u5982\u679c\u96c6\u7c07\u5305\u542b\u989d\u5916\u8868\u7a7a\u95f4\uff0c\u5219\u4e3b\u6570\u636e\u76ee\u5f55\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\uff0c\u800c\u5176\u4ed6\u6240\u6709\u8868\u7a7a\u95f4\u90fd\u4f1a\u653e\u5728\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u76f8\u540c\u7684\u7edd\u5bf9\u8def\u5f84\u4e2d\u3002\uff08\u5982\u9700\u6539\u53d8\u8fd9\u4e00\u70b9\uff0c\u89c1<code class=\"option\">--tablespace-mapping</code>\u3002\uff09</p>\n<p lang=\"zh\">\u8fd9\u662f\u9ed8\u8ba4\u683c\u5f0f\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">t</code><br/></span><span class=\"term\"><code class=\"literal\">tar</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u5199\u4e3a\u76ee\u6807\u76ee\u5f55\u4e2d\u7684 tar \u6587\u4ef6\u3002\u4e3b\u6570\u636e\u76ee\u5f55\u7684\u5185\u5bb9\u4f1a\u5199\u5165\u540d\u4e3a<code class=\"filename\">base.tar</code>\u7684\u6587\u4ef6\u4e2d\uff0c\u800c\u6bcf\u4e2a\u5176\u4ed6\u8868\u7a7a\u95f4\u90fd\u4f1a\u5199\u5165\u4e00\u4e2a\u4ee5\u8be5\u8868\u7a7a\u95f4 OID \u547d\u540d\u7684\u72ec\u7acb tar \u6587\u4ef6\u4e2d\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u76ee\u6807\u76ee\u5f55\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff08\u77ed\u6a2a\u7ebf\uff09\uff0ctar \u5185\u5bb9\u5c06\u5199\u5165\u6807\u51c6\u8f93\u51fa\uff0c\u9002\u5408\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u4f8b\u5982<span class=\"productname\">gzip</span>\u3002\u53ea\u6709\u5f53\u96c6\u7c07\u6ca1\u6709\u989d\u5916\u8868\u7a7a\u95f4\u4e14\u672a\u4f7f\u7528 WAL \u6d41\u5f0f\u4f20\u8f93\u65f6\uff0c\u624d\u5141\u8bb8\u8fd9\u6837\u505a\u3002</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-i <em class=\"replaceable\"><code>old_manifest_file</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--incremental=<em class=\"replaceable\"><code>old_manifest_file</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6267\u884c<a class=\"link\" href=\"/docs/17/continuous-archiving.html#BACKUP-INCREMENTAL-BACKUP\" title=\"25.3.3.\u00a0\u8fdb\u884c\u589e\u91cf\u5907\u4efd\">\u589e\u91cf\u5907\u4efd</a>\u3002\u5fc5\u987b\u63d0\u4f9b\u53c2\u8003\u5907\u4efd\u7684\u5907\u4efd\u6e05\u5355\uff1b\u8be5\u6587\u4ef6\u5c06\u88ab\u4e0a\u4f20\u5230\u670d\u52a1\u5668\uff0c\u968f\u540e\u670d\u52a1\u5668\u4f1a\u8fd4\u56de\u6240\u8bf7\u6c42\u7684\u589e\u91cf\u5907\u4efd\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code><br/></span><span class=\"term\"><code class=\"option\">--write-recovery-conf</code></span></dt>\n<dd>\n<p lang=\"zh\">\u521b\u5efa<a class=\"link\" href=\"/docs/17/warm-standby.html#FILE-STANDBY-SIGNAL\"><code class=\"filename\">standby.signal</code></a> <a class=\"indexterm\" id=\"id-1.9.4.10.6.2.1.4.3.1.2\" name=\"id-1.9.4.10.6.2.1.4.3.1.2\"></a>\u6587\u4ef6\uff0c\u5e76\u5c06\u8fde\u63a5\u8bbe\u7f6e\u8ffd\u52a0\u5230\u76ee\u6807\u76ee\u5f55\u4e2d\u7684<code class=\"filename\">postgresql.auto.conf</code>\u6587\u4ef6\u4e2d\uff08\u5982\u679c\u4f7f\u7528 tar \u683c\u5f0f\uff0c\u5219\u8ffd\u52a0\u5230\u57fa\u7840\u5f52\u6863\u6587\u4ef6\u5185\uff09\u3002\u8fd9\u6837\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u5229\u7528\u5907\u4efd\u7ed3\u679c\u642d\u5efa\u5907\u5e93\u3002</p>\n<p lang=\"zh\"><code class=\"filename\">postgresql.auto.conf</code>\u6587\u4ef6\u5c06\u8bb0\u5f55\u8fde\u63a5\u8bbe\u7f6e\uff0c\u4ee5\u53ca\uff08\u5982\u679c\u6307\u5b9a\uff09<span class=\"application\">pg_basebackup</span>\u6b63\u5728\u4f7f\u7528\u7684\u590d\u5236\u69fd\uff0c\u4ee5\u4fbf\u540e\u7eed\u7684\u6d41\u590d\u5236\u548c<a class=\"link\" href=\"/docs/17/logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS-SYNCHRONIZATION\" title=\"47.2.3.\u00a0\u590d\u5236\u69fd\u540c\u6b65\">\u903b\u8f91\u590d\u5236\u69fd\u540c\u6b65</a>\u4f7f\u7528\u76f8\u540c\u7684\u8bbe\u7f6e\u3002\u53ea\u6709\u5f53 dbname \u5728\u8fde\u63a5\u5b57\u7b26\u4e32\u6216<a class=\"link\" href=\"/docs/17/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u73af\u5883\u53d8\u91cf</a>\u4e2d\u88ab\u663e\u5f0f\u6307\u5b9a\u65f6\uff0c\u624d\u4f1a\u8bb0\u5f55 dbname\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t <em class=\"replaceable\"><code>target</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--target=<em class=\"replaceable\"><code>target</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u793a\u670d\u52a1\u5668\u5c06\u57fa\u7840\u5907\u4efd\u653e\u5230\u54ea\u91cc\u3002\u9ed8\u8ba4\u76ee\u6807\u662f<code class=\"literal\">client</code>\uff0c\u8868\u793a\u5907\u4efd\u5e94\u53d1\u9001\u5230\u8fd0\u884c<span class=\"application\">pg_basebackup</span>\u7684\u90a3\u53f0\u673a\u5668\u3002\u5982\u679c\u76ee\u6807\u6539\u4e3a<code class=\"literal\">server:/some/path</code>\uff0c\u5219\u5907\u4efd\u4f1a\u5b58\u50a8\u5728\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684<code class=\"literal\">/some/path</code>\u76ee\u5f55\u4e2d\u3002\u5c06\u5907\u4efd\u5b58\u50a8\u5728\u670d\u52a1\u5668\u4e0a\u9700\u8981\u8d85\u7ea7\u7528\u6237\u6743\u9650\uff0c\u6216\u62e5\u6709<code class=\"literal\">pg_write_server_files</code>\u89d2\u8272\u7684\u6743\u9650\u3002\u5982\u679c\u76ee\u6807\u8bbe\u7f6e\u4e3a<code class=\"literal\">blackhole</code>\uff0c\u5219\u5185\u5bb9\u4f1a\u88ab\u4e22\u5f03\uff0c\u4e0d\u4f1a\u5b58\u50a8\u5230\u4efb\u4f55\u5730\u65b9\u3002\u8fd9\u53ea\u5e94\u7528\u4e8e\u6d4b\u8bd5\u76ee\u7684\uff0c\u56e0\u4e3a\u6700\u7ec8\u4e0d\u4f1a\u5f97\u5230\u5b9e\u9645\u5907\u4efd\u3002</p>\n<p lang=\"zh\">\u7531\u4e8e WAL \u6d41\u5f0f\u4f20\u8f93\u662f\u7531<span class=\"application\">pg_basebackup</span>\u800c\u4e0d\u662f\u670d\u52a1\u5668\u5b9e\u73b0\u7684\uff0c\u56e0\u6b64\u6b64\u9009\u9879\u4e0d\u80fd\u4e0e<code class=\"literal\">-Xstream</code>\u4e00\u8d77\u4f7f\u7528\u3002\u7531\u4e8e\u540e\u8005\u662f\u9ed8\u8ba4\u503c\uff0c\u6240\u4ee5\u6307\u5b9a\u6b64\u9009\u9879\u65f6\uff0c\u8fd8\u5fc5\u987b\u540c\u65f6\u6307\u5b9a<code class=\"literal\">-Xfetch</code>\u6216<code class=\"literal\">-Xnone</code>\u4e4b\u4e00\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>olddir</code></em>=<em class=\"replaceable\"><code>newdir</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--tablespace-mapping=<em class=\"replaceable\"><code>olddir</code></em>=<em class=\"replaceable\"><code>newdir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u671f\u95f4\uff0c\u5c06\u76ee\u5f55<em class=\"replaceable\"><code>olddir</code></em>\u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230<em class=\"replaceable\"><code>newdir</code></em>\u3002\u8981\u4f7f\u6b64\u9009\u9879\u751f\u6548\uff0c<em class=\"replaceable\"><code>olddir</code></em>\u5fc5\u987b\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u5b9a\u4e49\u7684\u8be5\u8868\u7a7a\u95f4\u8def\u5f84\u5b8c\u5168\u4e00\u81f4\u3002\uff08\u4f46\u5982\u679c\u6e90\u670d\u52a1\u5668\u4e0a\u5728<em class=\"replaceable\"><code>olddir</code></em>\u4e2d\u6ca1\u6709\u8868\u7a7a\u95f4\uff0c\u4e5f\u4e0d\u7b97\u9519\u8bef\u3002\uff09\u4e0e\u6b64\u540c\u65f6\uff0c<em class=\"replaceable\"><code>newdir</code></em>\u662f\u63a5\u6536\u4e3b\u673a\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u4e00\u4e2a\u76ee\u5f55\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c<em class=\"replaceable\"><code>newdir</code></em>\u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002<em class=\"replaceable\"><code>olddir</code></em>\u548c<em class=\"replaceable\"><code>newdir</code></em>\u90fd\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u5982\u679c\u4efb\u4e00\u8def\u5f84\u4e2d\u9700\u8981\u5305\u542b\u7b49\u53f7\uff08<code class=\"literal\">=</code>\uff09\uff0c\u8bf7\u5728\u5176\u524d\u9762\u52a0\u4e0a\u53cd\u659c\u6760\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u4ee5\u5904\u7406\u591a\u4e2a\u8868\u7a7a\u95f4\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u91cd\u5b9a\u4f4d\u8868\u7a7a\u95f4\uff0c\u4e3b\u6570\u636e\u76ee\u5f55\u4e2d\u7684\u7b26\u53f7\u94fe\u63a5\u5c06\u88ab\u66f4\u65b0\u4e3a\u6307\u5411\u65b0\u4f4d\u7f6e\u3002\u56e0\u6b64\uff0c\u65b0\u6570\u636e\u76ee\u5f55\u5df2\u53ef\u76f4\u63a5\u7528\u4e8e\u542f\u52a8\u4e00\u4e2a\u6240\u6709\u8868\u7a7a\u95f4\u90fd\u4f4d\u4e8e\u66f4\u65b0\u540e\u4f4d\u7f6e\u7684\u65b0\u670d\u52a1\u5668\u5b9e\u4f8b\u3002</p>\n<p lang=\"zh\">\u76ee\u524d\uff0c\u6b64\u9009\u9879\u4ec5\u9002\u7528\u4e8e\u666e\u901a\u6587\u4ef6\u8f93\u51fa\u683c\u5f0f\uff1b\u5982\u679c\u9009\u62e9\u4e86 tar \u683c\u5f0f\uff0c\u5219\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--waldir=<em class=\"replaceable\"><code>waldir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5199\u5165 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cWAL \u6587\u4ef6\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u7684<code class=\"filename\">pg_wal</code>\u5b50\u76ee\u5f55\u4e2d\uff0c\u4f46\u6b64\u9009\u9879\u53ef\u7528\u4e8e\u5c06\u5176\u653e\u5728\u5176\u4ed6\u4f4d\u7f6e\u3002<em class=\"replaceable\"><code>waldir</code></em>\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c<em class=\"replaceable\"><code>waldir</code></em>\u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002\u53ea\u6709\u5f53\u5907\u4efd\u91c7\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u624d\u80fd\u6307\u5b9a\u6b64\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-X <em class=\"replaceable\"><code>method</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--wal-method=<em class=\"replaceable\"><code>method</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u4e2d\u5305\u542b\u6240\u9700\u7684 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u3002\u8fd9\u5c06\u5305\u62ec\u5907\u4efd\u671f\u95f4\u751f\u6210\u7684\u6240\u6709\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u9664\u975e\u6307\u5b9a\u65b9\u6cd5<code class=\"literal\">none</code>\uff0c\u5426\u5219\u5c31\u53ef\u4ee5\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u542f\u52a8 postmaster\uff0c\u800c\u65e0\u9700\u67e5\u9605 WAL \u5f52\u6863\uff0c\u4ece\u800c\u4f7f\u8f93\u51fa\u6210\u4e3a\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u5907\u4efd\u3002</p>\n<p lang=\"zh\">\u652f\u6301\u4ee5\u4e0b\u7528\u4e8e\u6536\u96c6\u9884\u5199\u5f0f\u65e5\u5fd7\u7684<em class=\"replaceable\"><code>method</code></em>\u503c\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">n</code><br/></span><span class=\"term\"><code class=\"literal\">none</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u5728\u5907\u4efd\u4e2d\u5305\u542b\u9884\u5199\u5f0f\u65e5\u5fd7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">f</code><br/></span><span class=\"term\"><code class=\"literal\">fetch</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u7ed3\u675f\u65f6\u6536\u96c6\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u3002\u56e0\u6b64\uff0c\u6e90\u670d\u52a1\u5668\u7684<a class=\"xref\" href=\"/docs/17/runtime-config-replication.html#GUC-WAL-KEEP-SIZE\">wal_keep_size</a>\u53c2\u6570\u5fc5\u987b\u8bbe\u7f6e\u5f97\u8db3\u591f\u9ad8\uff0c\u4ee5\u786e\u4fdd\u5728\u5907\u4efd\u7ed3\u675f\u524d\u4e0d\u4f1a\u79fb\u9664\u6240\u9700\u7684\u65e5\u5fd7\u6570\u636e\u3002\u5982\u679c\u5728\u4f20\u8f93\u8fd9\u4e9b\u6570\u636e\u4e4b\u524d\u5b83\u4eec\u5df2\u7ecf\u88ab\u56de\u6536\uff0c\u5219\u5907\u4efd\u4f1a\u5931\u8d25\u5e76\u4e14\u65e0\u6cd5\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u4f1a\u5305\u542b\u5728<code class=\"filename\">base.tar</code>\u6587\u4ef6\u4e2d\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">s</code><br/></span><span class=\"term\"><code class=\"literal\">stream</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u6267\u884c\u5907\u4efd\u7684\u540c\u65f6\u6d41\u5f0f\u4f20\u8f93\u9884\u5199\u5f0f\u65e5\u5fd7\u6570\u636e\u3002\u6b64\u65b9\u6cd5\u4f1a\u5411\u670d\u52a1\u5668\u6253\u5f00\u7b2c\u4e8c\u4e2a\u8fde\u63a5\uff0c\u5e76\u5728\u6267\u884c\u5907\u4efd\u65f6\u5e76\u884c\u5f00\u59cb\u6d41\u5f0f\u4f20\u8f93\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u56e0\u6b64\uff0c\u5b83\u9700\u8981\u4e24\u4e2a\u590d\u5236\u8fde\u63a5\uff0c\u800c\u4e0d\u53ea\u662f\u4e00\u4e2a\u3002\u53ea\u8981\u5ba2\u6237\u7aef\u80fd\u591f\u8ddf\u4e0a\u9884\u5199\u5f0f\u65e5\u5fd7\u6570\u636e\uff0c\u4f7f\u7528\u6b64\u65b9\u6cd5\u5c31\u4e0d\u9700\u8981\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u989d\u5916\u4fdd\u7559\u9884\u5199\u5f0f\u65e5\u5fd7\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u4f1a\u5199\u5165\u4e00\u4e2a\u540d\u4e3a<code class=\"filename\">pg_wal.tar</code>\u7684\u72ec\u7acb\u6587\u4ef6\u4e2d\uff08\u5982\u679c\u670d\u52a1\u5668\u7248\u672c\u65e9\u4e8e 10\uff0c\u5219\u6587\u4ef6\u540d\u4e3a<code class=\"filename\">pg_xlog.tar</code>\uff09\u3002</p>\n<p lang=\"zh\">\u8fd9\u662f\u9ed8\u8ba4\u503c\u3002</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-z</code><br/></span><span class=\"term\"><code class=\"option\">--gzip</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u4f7f\u7528\u9ed8\u8ba4\u538b\u7f29\u7ea7\u522b\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0<code class=\"filename\">.gz</code>\u540e\u7f00\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-Z <em class=\"replaceable\"><code>level</code></em></code><br/></span><span class=\"term\"><code class=\"option\">-Z [{client|server}-]<em class=\"replaceable\"><code>method</code></em>[:<em class=\"replaceable\"><code>detail</code></em>]</code><br/></span><span class=\"term\"><code class=\"option\">--compress=<em class=\"replaceable\"><code>level</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--compress=[{client|server}-]<em class=\"replaceable\"><code>method</code></em>[:<em class=\"replaceable\"><code>detail</code></em>]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bf7\u6c42\u5bf9\u5907\u4efd\u8fdb\u884c\u538b\u7f29\u3002\u5982\u679c\u5305\u542b<code class=\"literal\">client</code>\u6216<code class=\"literal\">server</code>\uff0c\u5219\u6307\u5b9a\u538b\u7f29\u6267\u884c\u7684\u4f4d\u7f6e\u3002\u5728\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4f1a\u51cf\u5c11\u4f20\u8f93\u5e26\u5bbd\u5360\u7528\uff0c\u4f46\u4f1a\u589e\u52a0\u670d\u52a1\u5668 CPU \u6d88\u8017\u3002\u9ed8\u8ba4\u503c\u662f<code class=\"literal\">client</code>\uff0c\u4f46\u4f7f\u7528<code class=\"literal\">--target</code>\u65f6\u9664\u5916\uff1b\u6b64\u65f6\u5907\u4efd\u4e0d\u4f1a\u53d1\u9001\u5230\u5ba2\u6237\u7aef\uff0c\u56e0\u6b64\u53ea\u6709\u670d\u52a1\u5668\u7aef\u538b\u7f29\u624d\u6709\u610f\u4e49\u3002\u4f7f\u7528\u9ed8\u8ba4\u7684<code class=\"literal\">-Xstream</code>\u65f6\uff0c\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4e0d\u4f1a\u5e94\u7528\u4e8e WAL\u3002\u82e5\u8981\u538b\u7f29 WAL\uff0c\u8bf7\u4f7f\u7528\u5ba2\u6237\u7aef\u538b\u7f29\uff0c\u6216\u8005\u6307\u5b9a<code class=\"literal\">-Xfetch</code>\u3002</p>\n<p lang=\"zh\">\u538b\u7f29\u65b9\u6cd5\u53ef\u4ee5\u8bbe\u7f6e\u4e3a<code class=\"literal\">gzip</code>\u3001<code class=\"literal\">lz4</code>\u3001<code class=\"literal\">zstd</code>\u3001<code class=\"literal\">none</code>\uff08\u4e0d\u538b\u7f29\uff09\uff0c\u4e5f\u53ef\u4ee5\u76f4\u63a5\u6307\u5b9a\u4e00\u4e2a\u6574\u6570\uff080 \u8868\u793a\u4e0d\u538b\u7f29\uff0c\u5927\u4e8e 0 \u8868\u793a<code class=\"literal\">gzip</code>\uff09\u3002\u8fd8\u53ef\u4ee5\u9009\u62e9\u6027\u5730\u6307\u5b9a\u538b\u7f29\u7ec6\u8282\u5b57\u7b26\u4e32\u3002\u5982\u679c\u7ec6\u8282\u5b57\u7b26\u4e32\u662f\u6574\u6570\uff0c\u5219\u8868\u793a\u538b\u7f29\u7ea7\u522b\uff1b\u5426\u5219\uff0c\u5b83\u5e94\u4e3a\u9017\u53f7\u5206\u9694\u7684\u9879\u76ee\u5217\u8868\uff0c\u6bcf\u9879\u7684\u5f62\u5f0f\u4e3a<em class=\"replaceable\"><code>keyword</code></em>\u6216<em class=\"replaceable\"><code>keyword=value</code></em>\u3002\u76ee\u524d\u652f\u6301\u7684\u5173\u952e\u5b57\u6709<code class=\"literal\">level</code>\u3001<code class=\"literal\">long</code>\u548c<code class=\"literal\">workers</code>\u3002\u5f53\u538b\u7f29\u65b9\u6cd5\u4ee5\u7eaf\u6574\u6570\u5f62\u5f0f\u6307\u5b9a\u65f6\uff0c\u4e0d\u80fd\u518d\u4f7f\u7528\u7ec6\u8282\u5b57\u7b26\u4e32\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u538b\u7f29\u7ea7\u522b\uff0c\u5c06\u4f7f\u7528\u9ed8\u8ba4\u7ea7\u522b\u3002\u5982\u679c\u53ea\u6307\u5b9a\u7ea7\u522b\u800c\u672a\u6307\u5b9a\u7b97\u6cd5\uff0c\u5219\u7ea7\u522b\u5927\u4e8e 0 \u65f6\u4f7f\u7528 gzip \u538b\u7f29\uff0c\u7ea7\u522b\u4e3a 0 \u65f6\u4e0d\u538b\u7f29\u3002</p>\n<p lang=\"zh\">\u5f53 tar \u683c\u5f0f\u914d\u5408<code class=\"literal\">gzip</code>\u3001<code class=\"literal\">lz4</code>\u6216<code class=\"literal\">zstd</code>\u4f7f\u7528\u65f6\uff0c\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u5206\u522b\u81ea\u52a8\u52a0\u4e0a<code class=\"filename\">.gz</code>\u3001<code class=\"filename\">.lz4</code>\u6216<code class=\"filename\">.zst</code>\u540e\u7f00\u3002\u4f7f\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u4e0d\u80fd\u6307\u5b9a\u5ba2\u6237\u7aef\u538b\u7f29\uff0c\u4f46\u4ecd\u53ef\u4ee5\u8bf7\u6c42\u670d\u52a1\u5668\u7aef\u538b\u7f29\u3002\u8fd9\u6837\u505a\u65f6\uff0c\u670d\u52a1\u5668\u4f1a\u5148\u538b\u7f29\u5907\u4efd\u518d\u4f20\u8f93\uff0c\u800c\u5ba2\u6237\u7aef\u4f1a\u5bf9\u5176\u8fdb\u884c\u89e3\u538b\u5e76\u63d0\u53d6\u3002</p>\n<p lang=\"zh\">\u5f53\u6b64\u9009\u9879\u4e0e<code class=\"literal\">-Xstream</code>\u7ec4\u5408\u4f7f\u7528\u65f6\uff0c\u5982\u679c\u9009\u62e9\u4e86\u5ba2\u6237\u7aef gzip \u538b\u7f29\uff0c\u5219<code class=\"literal\">pg_wal.tar</code>\u4f1a\u4f7f\u7528<code class=\"literal\">gzip</code>\u538b\u7f29\uff1b\u4f46\u5982\u679c\u9009\u62e9\u4e86\u5176\u4ed6\u538b\u7f29\u7b97\u6cd5\uff0c\u6216\u8005\u9009\u62e9\u4e86\u670d\u52a1\u5668\u7aef\u538b\u7f29\uff0c\u5219\u4e0d\u4f1a\u88ab\u538b\u7f29\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u5907\u4efd\u7684\u751f\u6210\u548c\u7a0b\u5e8f\u7684\u8c03\u7528\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-c {fast|spread}</code><br/></span><span class=\"term\"><code class=\"option\">--checkpoint={fast|spread}</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u68c0\u67e5\u70b9\u6a21\u5f0f\u8bbe\u7f6e\u4e3a fast\uff08\u7acb\u5373\uff09\u6216 spread\uff08\u9ed8\u8ba4\uff09\uff08\u89c1<a class=\"xref\" href=\"/docs/17/continuous-archiving.html#BACKUP-LOWLEVEL-BASE-BACKUP\" title=\"25.3.4.\u00a0\u4f7f\u7528\u4f4e\u7ea7 API \u8fdb\u884c\u57fa\u7840\u5907\u4efd\">\u7b2c\u00a025.3.4\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--create-slot</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728\u5f00\u59cb\u5907\u4efd\u4e4b\u524d\uff0c\u5e94\u521b\u5efa\u7531<code class=\"literal\">--slot</code>\u9009\u9879\u6307\u5b9a\u540d\u79f0\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u8be5\u69fd\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u9519\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>label</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--label=<em class=\"replaceable\"><code>label</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5907\u4efd\u6807\u7b7e\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u503c<span class=\"quote\">\u201c<span class=\"quote\"><code class=\"literal\">pg_basebackup base backup</code></span>\u201d</span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-clean</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53<code class=\"command\">pg_basebackup</code>\u56e0\u9519\u8bef\u4e2d\u6b62\u65f6\uff0c\u5b83\u4f1a\u5220\u9664\u5728\u53d1\u73b0\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u76ee\u5f55\uff08\u4f8b\u5982\u76ee\u6807\u76ee\u5f55\u548c\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\uff09\u3002\u6b64\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u5f88\u6709\u5e2e\u52a9\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u65e0\u8bba\u662f\u5426\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u8868\u7a7a\u95f4\u76ee\u5f55\u90fd\u4e0d\u4f1a\u88ab\u6e05\u7406\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N</code><br/></span><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">pg_basebackup</code>\u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u88ab\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f1a\u4f7f<code class=\"command\">pg_basebackup</code>\u4e0d\u7ecf\u7b49\u5f85\u5c31\u76f4\u63a5\u8fd4\u56de\uff0c\u56e0\u6b64\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u968f\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u57fa\u7840\u5907\u4efd\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u5408\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P</code><br/></span><span class=\"term\"><code class=\"option\">--progress</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528\u8fdb\u5ea6\u62a5\u544a\u3002\u6253\u5f00\u6b64\u9009\u9879\u540e\uff0c\u4f1a\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u7ed9\u51fa\u4e00\u4e2a\u8fd1\u4f3c\u7684\u8fdb\u5ea6\u62a5\u544a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u53d1\u751f\u53d8\u5316\uff0c\u56e0\u6b64\u8fd9\u53ea\u662f\u8fd1\u4f3c\u503c\uff0c\u6700\u7ec8\u672a\u5fc5\u6070\u597d\u7ed3\u675f\u5728<code class=\"literal\">100%</code>\u3002\u7279\u522b\u662f\u5f53\u5907\u4efd\u4e2d\u5305\u542b WAL \u65f6\uff0c\u603b\u6570\u636e\u91cf\u65e0\u6cd5\u9884\u5148\u4f30\u8ba1\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u65e6\u8fdb\u5ea6\u8d85\u8fc7\u4e0d\u542b WAL \u65f6\u7684\u603b\u4f30\u8ba1\u503c\uff0c\u4f30\u8ba1\u76ee\u6807\u5927\u5c0f\u5c31\u4f1a\u7ee7\u7eed\u589e\u52a0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r <em class=\"replaceable\"><code>rate</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--max-rate=<em class=\"replaceable\"><code>rate</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u4ece\u6e90\u670d\u52a1\u5668\u6536\u96c6\u6570\u636e\u65f6\u5141\u8bb8\u7684\u6700\u5927\u4f20\u8f93\u901f\u7387\u3002\u8fd9\u6709\u52a9\u4e8e\u9650\u5236<span class=\"application\">pg_basebackup</span>\u5bf9\u670d\u52a1\u5668\u7684\u5f71\u54cd\u3002\u53d6\u503c\u5355\u4f4d\u4e3a\u6bcf\u79d2\u5343\u5b57\u8282\u3002\u4f7f\u7528\u540e\u7f00<code class=\"literal\">M</code>\u8868\u793a\u6bcf\u79d2\u5146\u5b57\u8282\u3002\u4e5f\u63a5\u53d7\u540e\u7f00<code class=\"literal\">k</code>\uff0c\u4f46\u6ca1\u6709\u5b9e\u9645\u5f71\u54cd\u3002\u6709\u6548\u53d6\u503c\u8303\u56f4\u4e3a\u6bcf\u79d2 32 \u5343\u5b57\u8282\u5230\u6bcf\u79d2 1024 \u5146\u5b57\u8282\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u59cb\u7ec8\u5f71\u54cd\u6570\u636e\u76ee\u5f55\u7684\u4f20\u8f93\u3002\u53ea\u6709\u5f53\u6536\u96c6\u65b9\u6cd5\u4e3a<code class=\"literal\">fetch</code>\u65f6\uff0cWAL \u6587\u4ef6\u7684\u4f20\u8f93\u624d\u4f1a\u53d7\u5230\u5f71\u54cd\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>slotname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--slot=<em class=\"replaceable\"><code>slotname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u53ea\u80fd\u4e0e<code class=\"literal\">-X stream</code>\u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u4f1a\u4f7f WAL \u6d41\u5f0f\u4f20\u8f93\u4f7f\u7528\u6307\u5b9a\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u6b64\u57fa\u7840\u5907\u4efd\u6253\u7b97\u7528\u4f5c\u4f7f\u7528\u590d\u5236\u69fd\u7684\u6d41\u590d\u5236\u5907\u5e93\uff0c\u90a3\u4e48\u8be5\u5907\u5e93\u5e94\u5c06\u540c\u4e00\u4e2a\u590d\u5236\u69fd\u540d\u79f0\u7528\u4f5c<a class=\"xref\" href=\"/docs/17/runtime-config-replication.html#GUC-PRIMARY-SLOT-NAME\">primary_slot_name</a>\u7684\u503c\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u4e3b\u5e93\u5728\u57fa\u7840\u5907\u4efd\u7ed3\u675f\u4e0e\u65b0\u5907\u5e93\u5f00\u59cb\u6d41\u590d\u5236\u4e4b\u95f4\u7684\u8fd9\u6bb5\u65f6\u95f4\u5185\uff0c\u4e0d\u4f1a\u79fb\u9664\u4efb\u4f55\u5fc5\u9700\u7684 WAL \u6570\u636e\u3002</p>\n<p lang=\"zh\">\u6307\u5b9a\u7684\u590d\u5236\u69fd\u5fc5\u987b\u5df2\u7ecf\u5b58\u5728\uff0c\u9664\u975e\u8fd8\u540c\u65f6\u4f7f\u7528\u4e86<code class=\"option\">-C</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5e76\u4e14\u670d\u52a1\u5668\u652f\u6301\u4e34\u65f6\u590d\u5236\u69fd\uff0810 \u53ca\u4ee5\u4e0a\u7248\u672c\uff09\uff0c\u5219\u4f1a\u81ea\u52a8\u4f7f\u7528\u4e34\u65f6\u590d\u5236\u69fd\u8fdb\u884c WAL \u6d41\u5f0f\u4f20\u8f93\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--sync-method=<em class=\"replaceable\"><code>method</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u4e3a<code class=\"literal\">fsync</code>\uff08\u9ed8\u8ba4\uff09\u65f6\uff0c<code class=\"command\">pg_basebackup</code>\u4f1a\u9012\u5f52\u6253\u5f00\u5e76\u540c\u6b65\u5907\u4efd\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3002\u4f7f\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u67e5\u627e\u6587\u4ef6\u4f1a\u8ddf\u968f WAL \u76ee\u5f55\u548c\u5404\u5df2\u914d\u7f6e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u3002</p>\n<p lang=\"zh\">\u5728 Linux \u4e0a\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528<code class=\"literal\">syncfs</code>\uff0c\u8ba9\u64cd\u4f5c\u7cfb\u7edf\u540c\u6b65\u5305\u542b\u5907\u4efd\u76ee\u5f55\u7684\u6574\u4e2a\u6587\u4ef6\u7cfb\u7edf\u3002\u4f7f\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c<code class=\"command\">pg_basebackup</code>\u8fd8\u4f1a\u540c\u6b65\u5305\u542b WAL \u6587\u4ef6\u548c\u5404\u8868\u7a7a\u95f4\u7684\u6587\u4ef6\u7cfb\u7edf\u3002\u5173\u4e8e\u4f7f\u7528<code class=\"literal\">syncfs</code>\u65f6\u9700\u8981\u6ce8\u610f\u7684\u4e8b\u9879\uff0c\u89c1<a class=\"xref\" href=\"/docs/17/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\">recovery_init_sync_method</a>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--no-sync</code>\u65f6\uff0c\u6b64\u9009\u9879\u65e0\u6548\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\u3002\u5b83\u4f1a\u5728\u542f\u52a8\u548c\u5173\u95ed\u8fc7\u7a0b\u4e2d\u8f93\u51fa\u4e00\u4e9b\u989d\u5916\u6b65\u9aa4\uff1b\u5982\u679c\u540c\u65f6\u542f\u7528\u4e86\u8fdb\u5ea6\u62a5\u544a\uff0c\u8fd8\u4f1a\u663e\u793a\u5f53\u524d\u6b63\u5728\u5904\u7406\u7684\u786e\u5207\u6587\u4ef6\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--manifest-checksums=<em class=\"replaceable\"><code>algorithm</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u5e94\u7528\u5230\u5907\u4efd\u6e05\u5355\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u7684\u6821\u9a8c\u548c\u7b97\u6cd5\u3002\u76ee\u524d\u53ef\u7528\u7684\u7b97\u6cd5\u6709<code class=\"literal\">NONE</code>\u3001<code class=\"literal\">CRC32C</code>\u3001<code class=\"literal\">SHA224</code>\u3001<code class=\"literal\">SHA256</code>\u3001<code class=\"literal\">SHA384</code>\u548c<code class=\"literal\">SHA512</code>\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">CRC32C</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">NONE</code>\uff0c\u5907\u4efd\u6e05\u5355\u5c06\u4e0d\u5305\u542b\u4efb\u4f55\u6821\u9a8c\u548c\u3002\u5426\u5219\uff0c\u5b83\u5c06\u5305\u542b\u4f7f\u7528\u6307\u5b9a\u7b97\u6cd5\u4e3a\u5907\u4efd\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u8ba1\u7b97\u7684\u6821\u9a8c\u548c\u3002\u6b64\u5916\uff0c\u6e05\u5355\u59cb\u7ec8\u4f1a\u5305\u542b\u5176\u81ea\u8eab\u5185\u5bb9\u7684<code class=\"literal\">SHA256</code>\u6821\u9a8c\u548c\u3002<code class=\"literal\">SHA</code>\u7b97\u6cd5\u660e\u663e\u6bd4<code class=\"literal\">CRC32C</code>\u66f4\u8017\u8d39 CPU\uff0c\u56e0\u6b64\u9009\u62e9\u5176\u4e2d\u4e00\u79cd\u53ef\u80fd\u4f1a\u589e\u52a0\u5b8c\u6210\u5907\u4efd\u6240\u9700\u7684\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u5e0c\u671b\u9a8c\u8bc1\u5907\u4efd\u672a\u88ab\u7be1\u6539\u7684\u7528\u6237\uff0c\u4f7f\u7528 SHA hash \u51fd\u6570\u53ef\u4ee5\u4e3a\u6bcf\u4e2a\u6587\u4ef6\u63d0\u4f9b\u5177\u6709\u5bc6\u7801\u5b66\u5b89\u5168\u6027\u7684\u6458\u8981\uff1b\u800c CRC32C \u7b97\u6cd5\u63d0\u4f9b\u7684\u6821\u9a8c\u548c\u8ba1\u7b97\u901f\u5ea6\u8981\u5feb\u5f97\u591a\uff0c\u867d\u7136\u5b83\u5f88\u9002\u5408\u53d1\u73b0\u7531\u4e8e\u610f\u5916\u6539\u52a8\u9020\u6210\u7684\u9519\u8bef\uff0c\u4f46\u5e76\u4e0d\u80fd\u62b5\u5fa1\u6076\u610f\u4fee\u6539\u3002\u8bf7\u6ce8\u610f\uff0c\u8981\u60f3\u5bf9\u80fd\u591f\u8bbf\u95ee\u5907\u4efd\u7684\u653b\u51fb\u8005\u5f62\u6210\u9632\u62a4\uff0c\u5907\u4efd\u6e05\u5355\u5c31\u9700\u8981\u5b89\u5168\u5730\u4fdd\u5b58\u5728\u5176\u4ed6\u5730\u65b9\uff0c\u6216\u8005\u4ee5\u5176\u4ed6\u65b9\u5f0f\u786e\u8ba4\u81ea\u5907\u4efd\u5b8c\u6210\u540e\u672a\u88ab\u4fee\u6539\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528<a class=\"xref\" href=\"/docs/17/app-pgverifybackup.html\" title=\"pg_verifybackup\"><span class=\"refentrytitle\"><span class=\"application\">pg_verifybackup</span></span></a>\u6839\u636e\u5907\u4efd\u6e05\u5355\u68c0\u67e5\u5907\u4efd\u7684\u5b8c\u6574\u6027\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--manifest-force-encode</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f3a\u5236\u5c06\u5907\u4efd\u6e05\u5355\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u540d\u7f16\u7801\u4e3a\u5341\u516d\u8fdb\u5236\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u5bf9\u975e UTF8 \u6587\u4ef6\u540d\u8fdb\u884c\u5341\u516d\u8fdb\u5236\u7f16\u7801\u3002\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u8bfb\u53d6\u5907\u4efd\u6e05\u5355\u6587\u4ef6\u7684\u5de5\u5177\u662f\u5426\u80fd\u6b63\u786e\u5904\u7406\u8fd9\u79cd\u60c5\u51b5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-estimate-size</code></span></dt>\n<dd>\n<p lang=\"zh\">\u7981\u6b62\u670d\u52a1\u5668\u4f30\u7b97\u5c06\u8981\u6d41\u5f0f\u4f20\u8f93\u7684\u5907\u4efd\u6570\u636e\u603b\u91cf\uff0c\u56e0\u6b64 pg_stat_progress_basebackup \u89c6\u56fe\u4e2d\u7684 backup_total \u5217\u59cb\u7ec8\u4e3a NULL\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5907\u4efd\u4f1a\u5148\u679a\u4e3e\u6574\u4e2a\u6570\u636e\u5e93\u7684\u5927\u5c0f\uff0c\u7136\u540e\u518d\u56de\u8fc7\u5934\u6765\u53d1\u9001\u5b9e\u9645\u5185\u5bb9\u3002\u8fd9\u53ef\u80fd\u4f1a\u8ba9\u5907\u4efd\u8017\u65f6\u7565\u957f\uff0c\u7279\u522b\u662f\u5728\u53d1\u9001\u7b2c\u4e00\u6279\u6570\u636e\u4e4b\u524d\u6240\u9700\u65f6\u95f4\u4f1a\u66f4\u4e45\u3002\u5982\u679c\u8fd9\u79cd\u4f30\u7b97\u8017\u65f6\u8fc7\u957f\uff0c\u6b64\u9009\u9879\u5c31\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u5b83\u53ef\u4ee5\u907f\u514d\u8fd9\u6bb5\u4f30\u7b97\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--progress</code>\u65f6\uff0c\u4e0d\u5141\u8bb8\u4f7f\u7528\u6b64\u9009\u9879\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-manifest</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7981\u6b62\u751f\u6210\u5907\u4efd\u6e05\u5355\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u670d\u52a1\u5668\u5c06\u751f\u6210\u5e76\u53d1\u9001\u4e00\u4e2a\u5907\u4efd\u6e05\u5355\uff0c\u53ef\u4f7f\u7528<a class=\"xref\" href=\"/docs/17/app-pgverifybackup.html\" title=\"pg_verifybackup\"><span class=\"refentrytitle\"><span class=\"application\">pg_verifybackup</span></span></a>\u8fdb\u884c\u9a8c\u8bc1\u3002\u8be5\u6e05\u5355\u5217\u51fa\u4e86\u5907\u4efd\u4e2d\u7684\u6bcf\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u4e0d\u5305\u62ec\u53ef\u80fd\u5305\u542b\u5728\u5176\u4e2d\u7684\u4efb\u4f55 WAL \u6587\u4ef6\u3002\u5b83\u8fd8\u4f1a\u4fdd\u5b58\u6bcf\u4e2a\u6587\u4ef6\u7684\u5927\u5c0f\u3001\u6700\u540e\u4fee\u6539\u65f6\u95f4\u4ee5\u53ca\u53ef\u9009\u7684\u6821\u9a8c\u548c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-slot</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9632\u6b62\u4e3a\u5907\u4efd\u521b\u5efa\u4e34\u65f6\u590d\u5236\u69fd\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u9009\u62e9\u4e86 WAL \u6d41\u5f0f\u4f20\u8f93\uff0c\u4f46\u6ca1\u6709\u4f7f\u7528<code class=\"option\">-S</code>\u9009\u9879\u7ed9\u51fa\u69fd\u540d\uff0c\u90a3\u4e48\u4f1a\u521b\u5efa\u4e00\u4e2a\u4e34\u65f6\u590d\u5236\u69fd\uff08\u5982\u679c\u6e90\u670d\u52a1\u5668\u652f\u6301\uff09\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7684\u4e3b\u8981\u76ee\u7684\u662f\u5728\u670d\u52a1\u5668\u6ca1\u6709\u7a7a\u95f2\u590d\u5236\u69fd\u65f6\uff0c\u4ecd\u7136\u5141\u8bb8\u6267\u884c\u57fa\u7840\u5907\u4efd\u3002\u51e0\u4e4e\u603b\u662f\u9996\u9009\u4f7f\u7528\u590d\u5236\u69fd\uff0c\u56e0\u4e3a\u5b83\u80fd\u9632\u6b62\u670d\u52a1\u5668\u5728\u5907\u4efd\u671f\u95f4\u79fb\u9664\u6240\u9700\u7684 WAL\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-verify-checksums</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u83b7\u53d6\u57fa\u7840\u5907\u4efd\u7684\u670d\u52a1\u5668\u542f\u7528\u4e86\u6821\u9a8c\u548c\uff0c\u5219\u7981\u7528\u5bf9\u8fd9\u4e9b\u6821\u9a8c\u548c\u7684\u9a8c\u8bc1\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f1a\u9a8c\u8bc1\u6821\u9a8c\u548c\uff1b\u6821\u9a8c\u548c\u9a8c\u8bc1\u5931\u8d25\u5c06\u5bfc\u81f4\u975e\u96f6\u9000\u51fa\u72b6\u6001\u3002\u4e0d\u8fc7\uff0c\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u57fa\u7840\u5907\u4efd\u4e0d\u4f1a\u88ab\u5220\u9664\uff0c\u5c31\u50cf\u4f7f\u7528\u4e86<code class=\"option\">--no-clean</code>\u4e00\u6837\u3002\u6821\u9a8c\u548c\u9a8c\u8bc1\u5931\u8d25\u4e5f\u4f1a\u5728<a class=\"link\" href=\"/docs/17/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW\" title=\"27.2.17.\u00a0pg_stat_database\"><code class=\"structname\">pg_stat_database</code></a>\u89c6\u56fe\u4e2d\u62a5\u544a\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u5230\u6e90\u670d\u52a1\u5668\u7684\u8fde\u63a5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>connstr</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>connstr</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ee5<a class=\"link\" href=\"/docs/17/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u7684\u5f62\u5f0f\u6307\u5b9a\u7528\u4e8e\u8fde\u63a5\u670d\u52a1\u5668\u7684\u53c2\u6570\uff1b\u8fd9\u4e9b\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u76f8\u4e92\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u51fa\u4e8e\u4e0e\u5176\u4ed6\u5ba2\u6237\u7aef\u5e94\u7528\u4fdd\u6301\u4e00\u81f4\u7684\u8003\u8651\uff0c\u6b64\u9009\u9879\u540d\u4e3a<code class=\"literal\">--dbname</code>\uff1b\u4f46\u7531\u4e8e<span class=\"application\">pg_basebackup</span>\u5e76\u4e0d\u8fde\u63a5\u5230\u96c6\u7c07\u4e2d\u7684\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u7684\u6570\u636e\u5e93\u540d\u4f1a\u88ab\u670d\u52a1\u5668\u5ffd\u7565\u3002\u4e0d\u8fc7\uff0c\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u63d0\u4f9b\u7684\u6570\u636e\u5e93\u540d\u4f1a\u8986\u76d6\u9ed8\u8ba4\u6570\u636e\u5e93\u540d\uff08<code class=\"literal\">replication</code>\uff09\uff0c\u4ece\u800c\u7528\u4e8e\u5728<code class=\"filename\">~/.pgpass</code>\u4e2d\u67e5\u627e\u590d\u5236\u8fde\u63a5\u7684\u5bc6\u7801\u3002\u7c7b\u4f3c\u5730\uff0c\u8fde\u63a5<span class=\"productname\">PostgreSQL</span>\u65f6\u4f7f\u7528\u7684\u4e2d\u95f4\u4ef6\u6216\u4ee3\u7406\uff0c\u4e5f\u53ef\u80fd\u51fa\u4e8e\u8fde\u63a5\u8def\u7531\u7b49\u76ee\u7684\u4f7f\u7528\u8be5\u540d\u79f0\u3002\u8be5\u6570\u636e\u5e93\u540d\u4e5f\u53ef\u4f9b<a class=\"link\" href=\"/docs/17/logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS-SYNCHRONIZATION\" title=\"47.2.3.\u00a0\u590d\u5236\u69fd\u540c\u6b65\">\u903b\u8f91\u590d\u5236\u69fd\u540c\u6b65</a>\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea<code class=\"envar\">PGHOST</code>\u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff1b\u5426\u5219\u4f1a\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u6240\u4f7f\u7528\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u4f7f\u7528<code class=\"envar\">PGPORT</code>\u73af\u5883\u53d8\u91cf\u4e2d\u7684\u503c\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u786e\u5b9a\u7684\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s <em class=\"replaceable\"><code>interval</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--status-interval=<em class=\"replaceable\"><code>interval</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u53d1\u9001\u56de\u6e90\u670d\u52a1\u5668\u7684\u72b6\u6001\u5305\u4e4b\u95f4\u76f8\u9694\u7684\u79d2\u6570\u3002\u8f83\u5c0f\u7684\u503c\u53ef\u4ee5\u8ba9\u670d\u52a1\u5668\u7aef\u5bf9\u5907\u4efd\u8fdb\u5ea6\u7684\u76d1\u63a7\u66f4\u7cbe\u786e\u3002\u503c\u4e3a\u96f6\u65f6\u4f1a\u5b8c\u5168\u7981\u7528\u5468\u671f\u6027\u72b6\u6001\u66f4\u65b0\uff0c\u4e0d\u8fc7\u5f53\u670d\u52a1\u5668\u8bf7\u6c42\u65f6\u4ecd\u4f1a\u53d1\u9001\u66f4\u65b0\uff0c\u4ee5\u907f\u514d\u56e0\u8d85\u65f6\u800c\u65ad\u5f00\u8fde\u63a5\u3002\u9ed8\u8ba4\u503c\u662f 10 \u79d2\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7981\u6b62\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\uff08\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff09\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u6b64\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u79cd\u573a\u666f\u4e0b\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236<span class=\"application\">pg_basebackup</span>\u5728\u8fde\u63a5\u6e90\u670d\u52a1\u5668\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7edd\u975e\u5fc5\u9700\uff0c\u56e0\u4e3a\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u81ea\u52a8\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\u6765\u53d1\u73b0\u670d\u52a1\u5668\u9700\u8981\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u8f93\u5165<code class=\"option\">-W</code>\u4ee5\u907f\u514d\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u662f\u503c\u5f97\u7684\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5176\u4ed6\u9009\u9879\u4e5f\u53ef\u7528\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa<span class=\"application\">pg_basebackup</span>\u7684\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"application\">pg_basebackup</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6<span class=\"productname\">PostgreSQL</span>\u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528<span class=\"application\">libpq</span>\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/17/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.15\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\">\u73af\u5883\u53d8\u91cf<code class=\"envar\">PG_COLOR</code>\u6307\u5b9a\u662f\u5426\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a<code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c<code class=\"literal\">never</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u5728\u5907\u4efd\u5f00\u59cb\u65f6\uff0c\u9700\u8981\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u6267\u884c\u4e00\u6b21\u68c0\u67e5\u70b9\u3002\u8fd9\u53ef\u80fd\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\uff08\u5c24\u5176\u662f\u5728\u672a\u4f7f\u7528<code class=\"literal\">--checkpoint=fast</code>\u9009\u9879\u65f6\uff09\uff1b\u5728\u6b64\u671f\u95f4\uff0c<span class=\"application\">pg_basebackup</span>\u770b\u8d77\u6765\u4f1a\u5904\u4e8e\u7a7a\u95f2\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u5907\u4efd\u5c06\u5305\u62ec\u6570\u636e\u76ee\u5f55\u548c\u8868\u7a7a\u95f4\u4e2d\u7684\u6240\u6709\u6587\u4ef6\uff0c\u5305\u62ec\u914d\u7f6e\u6587\u4ef6\u4ee5\u53ca\u7b2c\u4e09\u65b9\u653e\u5728\u8fd9\u4e9b\u76ee\u5f55\u4e2d\u7684\u4efb\u4f55\u989d\u5916\u6587\u4ef6\uff0c\u4f46\u7531 PostgreSQL \u7ba1\u7406\u7684\u67d0\u4e9b\u4e34\u65f6\u6587\u4ef6\u548c\u64cd\u4f5c\u7cfb\u7edf\u6587\u4ef6\u9664\u5916\u3002\u4e0d\u8fc7\uff0c\u53ea\u6709\u666e\u901a\u6587\u4ef6\u548c\u76ee\u5f55\u4f1a\u88ab\u590d\u5236\uff0c\u4f46\u7528\u4e8e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u4f1a\u88ab\u4fdd\u7559\u3002\u6307\u5411 PostgreSQL \u5df2\u77e5\u7684\u67d0\u4e9b\u76ee\u5f55\u7684\u7b26\u53f7\u94fe\u63a5\u4f1a\u88ab\u590d\u5236\u4e3a\u7a7a\u76ee\u5f55\u3002\u5176\u4ed6\u7b26\u53f7\u94fe\u63a5\u548c\u7279\u6b8a\u8bbe\u5907\u6587\u4ef6\u5219\u4f1a\u88ab\u8df3\u8fc7\u3002\u5177\u4f53\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/17/protocol-replication.html\" title=\"53.4.\u00a0\u6d41\u590d\u5236\u534f\u8bae\">\u7b2c\u00a053.4\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5728\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u4e2d\uff0c\u9664\u975e\u4f7f\u7528\u4e86<code class=\"literal\">--tablespace-mapping</code>\u9009\u9879\uff0c\u5426\u5219\u8868\u7a7a\u95f4\u4f1a\u5907\u4efd\u5230\u5176\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u7684\u76f8\u540c\u8def\u5f84\u3002\u5982\u679c\u4e0d\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u90a3\u4e48\u5f53\u8868\u7a7a\u95f4\u6b63\u5728\u4f7f\u7528\u65f6\uff0c\u5c31\u65e0\u6cd5\u5728\u4e0e\u670d\u52a1\u5668\u76f8\u540c\u7684\u4e3b\u673a\u4e0a\u6267\u884c\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u7684\u57fa\u7840\u5907\u4efd\uff0c\u56e0\u4e3a\u5907\u4efd\u5c06\u4e0d\u5f97\u4e0d\u5199\u5165\u4e0e\u539f\u59cb\u8868\u7a7a\u95f4\u76f8\u540c\u7684\u76ee\u5f55\u4f4d\u7f6e\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u7528\u6237\u9700\u8981\u5728\u542f\u52a8\u4f7f\u7528\u8fd9\u4e9b\u6570\u636e\u7684 PostgreSQL \u670d\u52a1\u5668\u4e4b\u524d\uff0c\u81ea\u884c\u89e3\u5f00\u6bcf\u4e2a tar \u6587\u4ef6\u3002\u5982\u679c\u5b58\u5728\u989d\u5916\u7684\u8868\u7a7a\u95f4\uff0c\u5fc5\u987b\u5c06\u5bf9\u5e94\u7684 tar \u6587\u4ef6\u89e3\u538b\u5230\u6b63\u786e\u4f4d\u7f6e\u3002\u6b64\u65f6\uff0c\u670d\u52a1\u5668\u4f1a\u6839\u636e base.tar \u4e2d tablespace_map \u6587\u4ef6\u7684\u5185\u5bb9\uff0c\u4e3a\u8fd9\u4e9b\u8868\u7a7a\u95f4\u521b\u5efa\u7b26\u53f7\u94fe\u63a5\u3002</p>\n<p lang=\"zh\">pg_basebackup \u53ef\u4e0e\u76f8\u540c\u6216\u66f4\u65e9\u4e3b\u8981\u7248\u672c\u7684\u670d\u52a1\u5668\u914d\u5408\u4f7f\u7528\uff0c\u6700\u4f4e\u652f\u6301 9.1\u3002\u4e0d\u8fc7\uff0cWAL \u6d41\u5f0f\u4f20\u8f93\u6a21\u5f0f\uff08-X stream\uff09\u53ea\u9002\u7528\u4e8e 9.3 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\uff0ctar \u683c\u5f0f\uff08--format=tar\uff09\u53ea\u9002\u7528\u4e8e 9.5 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\uff0c\u589e\u91cf\u5907\u4efd\uff08--incremental\uff09\u53ea\u9002\u7528\u4e8e 17 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6e90\u96c6\u7c07\u542f\u7528\u4e86\u6570\u636e\u6587\u4ef6\u7684\u7ec4\u6743\u9650\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u4fdd\u7559\u8fd9\u4e9b\u7ec4\u6743\u9650\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.9\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u8981\u4e3a\u670d\u52a1\u5668<code class=\"literal\">mydbserver</code>\u521b\u5efa\u4e00\u4e2a\u57fa\u7840\u5907\u4efd\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5230\u672c\u5730\u76ee\u5f55<code class=\"filename\">/usr/local/pgsql/data</code>\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -h mydbserver -D /usr/local/pgsql/data</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u672c\u5730\u670d\u52a1\u5668\u521b\u5efa\u4e00\u4e2a\u5907\u4efd\uff0c\u4e3a\u6bcf\u4e2a\u8868\u7a7a\u95f4\u5404\u751f\u6210\u4e00\u4e2a\u538b\u7f29\u7684 tar \u6587\u4ef6\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5728\u76ee\u5f55<code class=\"filename\">backup</code>\u4e2d\uff0c\u540c\u65f6\u5728\u8fd0\u884c\u671f\u95f4\u663e\u793a\u8fdb\u5ea6\u62a5\u544a\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup -Ft -z -P</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u4e00\u4e2a\u4ec5\u5305\u542b\u5355\u4e2a\u8868\u7a7a\u95f4\u7684\u672c\u5730\u6570\u636e\u5e93\u521b\u5efa\u5907\u4efd\uff0c\u5e76\u4f7f\u7528<span class=\"productname\">bzip2</span>\u8fdb\u884c\u538b\u7f29\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D - -Ft -X fetch | bzip2 &gt; backup.tar.bz2</code></strong>\n</pre>\n<p lang=\"zh\">\uff08\u5982\u679c\u8be5\u6570\u636e\u5e93\u4e2d\u6709\u591a\u4e2a\u8868\u7a7a\u95f4\uff0c\u6b64\u547d\u4ee4\u5c06\u5931\u8d25\u3002\uff09</p>\n<p lang=\"zh\">\u8981\u521b\u5efa\u4e00\u4e2a\u672c\u5730\u6570\u636e\u5e93\u7684\u5907\u4efd\uff0c\u5e76\u5c06\u4f4d\u4e8e<code class=\"filename\">/opt/ts</code>\u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230<code class=\"filename\">./backup/ts</code>\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup/data -T /opt/ts=$(pwd)/backup/ts</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u672c\u5730\u670d\u52a1\u5668\u521b\u5efa\u4e00\u4e2a\u5907\u4efd\uff0c\u4e3a\u6bcf\u4e2a\u8868\u7a7a\u95f4\u751f\u6210\u4e00\u4e2a tar \u6587\u4ef6\uff0c\u5e76\u4f7f\u7528<span class=\"application\">gzip</span>\u4ee5 9 \u7ea7\u538b\u7f29\u540e\u5b58\u50a8\u5230\u76ee\u5f55<code class=\"filename\">backup</code>\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup -Ft --compress=gzip:9</code></strong>\n</pre>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.10\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/17/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/17/progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING\" title=\"27.4.6.\u00a0Base Backup Progress Reporting\">Section\u00a027.4.6</a></span>\n</div>\n</div></div>", "manual_path": "app-pgbasebackup.html", "localization": {"status": "complete", "sources": [{"url": "/docs/17/app-pgbasebackup.html", "method": "same-major semantic node", "sha256": "17e1e50bd5629e5a5cbcc2756643909af73d1c385e5fc3a33f825591d81e0e92", "language": "zh", "matched_nodes": ["#APP-PGBASEBACKUP/div[2]/p[1]", "#APP-PGBASEBACKUP/div[3]/h2[0]", "#APP-PGBASEBACKUP/div[4]/div[8]/ul[0]/li[0]", "#APP-PGBASEBACKUP/div[4]/div[8]/ul[0]/li[1]", "#APP-PGBASEBACKUP/div[4]/div[8]/ul[0]/li[2]", "#APP-PGBASEBACKUP/div[4]/div[8]/ul[0]/li[3]", "#APP-PGBASEBACKUP/div[4]/p[1]", "#APP-PGBASEBACKUP/div[4]/p[2]", "#APP-PGBASEBACKUP/div[4]/p[3]", "#APP-PGBASEBACKUP/div[4]/p[4]", "#APP-PGBASEBACKUP/div[4]/p[5]", "#APP-PGBASEBACKUP/div[4]/p[6]", "#APP-PGBASEBACKUP/div[4]/p[7]", "#APP-PGBASEBACKUP/div[4]/p[9]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[3]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[5]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[5]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[17]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[19]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[19]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[19]/p[3]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[19]/p[4]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[3]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[7]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[7]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[17]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[17]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[17]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[19]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[21]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[21]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[21]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[21]/p[3]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[23]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[25]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[25]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[27]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[29]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[29]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[29]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[31]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[31]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[7]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[7]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[7]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[8]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[8]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/p[3]", "#APP-PGBASEBACKUP/div[5]/p[5]", "#APP-PGBASEBACKUP/div[5]/p[7]", "#APP-PGBASEBACKUP/div[6]/h2[0]", "#APP-PGBASEBACKUP/div[6]/p[1]", "#APP-PGBASEBACKUP/div[6]/p[2]", "#APP-PGBASEBACKUP/div[7]/h2[0]", "#APP-PGBASEBACKUP/div[7]/p[1]", "#APP-PGBASEBACKUP/div[7]/p[2]", "#APP-PGBASEBACKUP/div[7]/p[3]", "#APP-PGBASEBACKUP/div[7]/p[6]", "#APP-PGBASEBACKUP/div[8]/h2[0]", "#APP-PGBASEBACKUP/div[8]/p[10]", "#APP-PGBASEBACKUP/div[8]/p[1]", "#APP-PGBASEBACKUP/div[8]/p[3]", "#APP-PGBASEBACKUP/div[8]/p[5]", "#APP-PGBASEBACKUP/div[8]/p[7]", "#APP-PGBASEBACKUP/div[8]/p[8]", "#APP-PGBASEBACKUP/div[9]/h2[0]"]}], "language": "zh", "original_text": {"/versions/17/description/0": "pg_basebackup \u2014 take a base backup of a PostgreSQL cluster", "/versions/17/facts/0/label": "Documented executable", "/versions/17/facts/1/label": "Executable version", "/versions/17/facts/2/label": "Reference inventory", "/versions/17/facts/2/value": "Client applications", "/versions/17/facts/3/label": "Option definition groups", "/versions/17/tables/0/title": "Documented options", "/versions/17/related/0/label": "libpq connection parameters", "/versions/17/tables/0/rows/0/summary": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty.", "/versions/17/tables/0/rows/1/summary": "Selects the format for the output. format can be one of the following:", "/versions/17/tables/0/rows/2/summary": "Performs an incremental backup . The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup.", "/versions/17/tables/0/rows/3/summary": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup.", "/versions/17/tables/0/rows/4/summary": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup.", "/versions/17/tables/0/rows/5/summary": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces.", "/versions/17/tables/0/rows/6/summary": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format.", "/versions/17/tables/0/rows/7/summary": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup.", "/versions/17/tables/0/rows/8/summary": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "/versions/17/tables/0/rows/9/summary": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch .", "/versions/17/tables/0/columns/0/label": "Option and arguments", "/versions/17/tables/0/columns/1/label": "Description", "/versions/17/tables/0/rows/10/summary": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 25.3.4 ).", "/versions/17/tables/0/rows/11/summary": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists.", "/versions/17/tables/0/rows/12/summary": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used.", "/versions/17/tables/0/rows/13/summary": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging.", "/versions/17/tables/0/rows/14/summary": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.", "/versions/17/tables/0/rows/15/summary": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.", "/versions/17/tables/0/rows/16/summary": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second.", "/versions/17/tables/0/rows/17/summary": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby.", "/versions/17/tables/0/rows/18/summary": "When set to fsync , which is the default, pg_basebackup will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace.", "/versions/17/tables/0/rows/19/summary": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.", "/versions/17/tables/0/rows/20/summary": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C .", "/versions/17/tables/0/rows/21/summary": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case.", "/versions/17/tables/0/rows/22/summary": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL .", "/versions/17/tables/0/rows/23/summary": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file.", "/versions/17/tables/0/rows/24/summary": "Prevents the creation of a temporary replication slot for the backup.", "/versions/17/tables/0/rows/25/summary": "Disables verification of checksums, if they are enabled on the server the base backup is taken from.", "/versions/17/tables/0/rows/26/summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "/versions/17/tables/0/rows/27/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "/versions/17/tables/0/rows/28/summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "/versions/17/tables/0/rows/29/summary": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds.", "/versions/17/tables/0/rows/30/summary": "Specifies the user name to connect as.", "/versions/17/tables/0/rows/31/summary": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/17/tables/0/rows/32/summary": "Forces pg_basebackup to prompt for a password before connecting to the source server.", "/versions/17/tables/0/rows/33/summary": "Prints the pg_basebackup version and exits.", "/versions/17/tables/0/rows/34/summary": "Shows help about pg_basebackup command line arguments, and exits."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "09b476bf1f2c1bad4d8cf02646e4feebb1809e4181c32a931448d94662bb7c07"}, "comparison_data": {"options": [{"names": ["-D directory", "--pgdata= directory"], "signature": "-D directory --pgdata= directory", "description": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty. When the backup is in tar format, the target directory may be specified as - (dash), causing the tar file to be written to stdout . This option is required."}, {"names": ["-F format", "--format= format"], "signature": "-F format --format= format", "description": "Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the source server's data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory's contents will be written to a file named base.tar , and each other tablespace will be written to a separate tar file named after that tablespace's OID. If the target directory is specified as - (dash), the tar contents will be written to standard output, suitable for piping to (for example) gzip . This is only allowed if the cluster has no additional tablespaces and WAL streaming is not used."}, {"names": ["-i old_manifest_file", "--incremental= old_manifest_file"], "signature": "-i old_manifest_file --incremental= old_manifest_file", "description": "Performs an incremental backup . The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup."}, {"names": ["-R", "--write-recovery-conf"], "signature": "-R --write-recovery-conf", "description": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup. The postgresql.auto.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that streaming replication and logical replication slot synchronization will use the same settings later on. The dbname will be recorded only if the dbname was specified explicitly in the connection string or environment variable ."}, {"names": ["-t target", "--target= target"], "signature": "-t target --target= target", "description": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup. Since WAL streaming is implemented by pg_basebackup rather than by the server, this option cannot be used together with -Xstream . Since that is the default, when this option is specified, you must also specify either -Xfetch or -Xnone ."}, {"names": ["-T olddir = newdir", "--tablespace-mapping= olddir = newdir"], "signature": "-T olddir = newdir --tablespace-mapping= olddir = newdir", "description": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected."}, {"names": ["--waldir= waldir"], "signature": "--waldir= waldir", "description": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format."}, {"names": ["-X method", "--wal-method= method"], "signature": "-X method --wal-method= method", "description": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup. The following method s for collecting the write-ahead logs are supported: n none Don't include write-ahead logs in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the source server's wal_keep_size parameter to be set high enough that the required log data is not removed before the end of the backup. If the required log data has been recycled before it's time to transfer it, the backup will fail and be unusable. When tar format is used, the write-ahead log files will be included in the base.tar file. s stream Stream write-ahead log data while the backup is being taken. This method will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will require two replication connections not just one. As long as the client can keep up with the write-ahead log data, using this method requires no extra write-ahead logs to be saved on the source server. When tar format is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default."}, {"names": ["-z", "--gzip"], "signature": "-z --gzip", "description": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-Z level", "-Z [{client|server}-] method [: detail ]", "--compress= level", "--compress=[{client|server}-] method [: detail ]"], "signature": "-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]", "description": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch . The compression method can be set to gzip , lz4 , zstd , none for no compression or an integer (no compression if 0, gzip if greater than 0). A compression detail string can optionally be specified. If the detail string is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form keyword or keyword=value . Currently, the supported keywords are level , long , and workers . The detail string cannot be used when the compression method is specified as a plain integer. If no compression level is specified, the default compression level will be used. If only a level is specified without mentioning an algorithm, gzip compression will be used if the level is greater than 0, and no compression will be used if the level is 0. When the tar format is used with gzip , lz4 , or zstd , the suffix .gz , .lz4 , or .zst , respectively, will be automatically added to all tar filenames. When the plain format is used, client-side compression may not be specified, but it is still possible to request server-side compression. If this is done, the server will compress the backup for transmission, and the client will decompress and extract it. When this option is used in combination with -Xstream , pg_wal.tar will be compressed using gzip if client-side gzip compression is selected, but will not be compressed if any other compression algorithm is selected, or if server-side compression is selected."}, {"names": ["-c {fast|spread}", "--checkpoint={fast|spread}"], "signature": "-c {fast|spread} --checkpoint={fast|spread}", "description": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 25.3.4 )."}, {"names": ["-C", "--create-slot"], "signature": "-C --create-slot", "description": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists."}, {"names": ["-l label", "--label= label"], "signature": "-l label --label= label", "description": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used."}, {"names": ["-n", "--no-clean"], "signature": "-n --no-clean", "description": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way."}, {"names": ["-N", "--no-sync"], "signature": "-N --no-sync", "description": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."}, {"names": ["-P", "--progress"], "signature": "-P --progress", "description": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL."}, {"names": ["-r rate", "--max-rate= rate"], "signature": "-r rate --max-rate= rate", "description": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch ."}, {"names": ["-S slotname", "--slot= slotname"], "signature": "-S slotname --slot= slotname", "description": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby. The specified replication slot has to exist unless the option -C is also used. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming."}, {"names": ["--sync-method= method"], "signature": "--sync-method= method", "description": "When set to fsync , which is the default, pg_basebackup will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace. On Linux, syncfs may be used instead to ask the operating system to synchronize the whole file system that contains the backup directory. When the plain format is used, pg_basebackup will also synchronize the file systems that contain the WAL files and each tablespace. See recovery_init_sync_method for information about the caveats to be aware of when using syncfs . This option has no effect when --no-sync is used."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."}, {"names": ["--manifest-checksums= algorithm"], "signature": "--manifest-checksums= algorithm", "description": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C . If NONE is selected, the backup manifest will not contain any checksums. Otherwise, it will contain a checksum of each file in the backup using the specified algorithm. In addition, the manifest will always contain a SHA256 checksum of its own contents. The SHA algorithms are significantly more CPU-intensive than CRC32C , so selecting one of them may increase the time required to complete the backup. Using a SHA hash function provides a cryptographically secure digest of each file for users who wish to verify that the backup has not been tampered with, while the CRC32C algorithm provides a checksum that is much faster to calculate; it is good at catching errors due to accidental changes but is not resistant to malicious modifications. Note that, to be useful against an adversary who has access to the backup, the backup manifest would need to be stored securely elsewhere or otherwise verified not to have been modified since the backup was taken. pg_verifybackup can be used to check the integrity of a backup against the backup manifest."}, {"names": ["--manifest-force-encode"], "signature": "--manifest-force-encode", "description": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case."}, {"names": ["--no-estimate-size"], "signature": "--no-estimate-size", "description": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL . Without this option, the backup will start by enumerating the size of the entire database, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent. This option is useful to avoid such estimation time if it's too long. This option is not allowed when using --progress ."}, {"names": ["--no-manifest"], "signature": "--no-manifest", "description": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file."}, {"names": ["--no-slot"], "signature": "--no-slot", "description": "Prevents the creation of a temporary replication slot for the backup. By default, if log streaming is selected but no slot name is given with the -S option, then a temporary replication slot is created (if supported by the source server). The main purpose of this option is to allow taking a base backup when the server has no free replication slots. Using a replication slot is almost always preferred, because it prevents needed WAL from being removed by the server during the backup."}, {"names": ["--no-verify-checksums"], "signature": "--no-verify-checksums", "description": "Disables verification of checksums, if they are enabled on the server the base backup is taken from. By default, checksums are verified and checksum failures will result in a non-zero exit status. However, the base backup will not be removed in such a case, as if the --no-clean option had been used. Checksum verification failures will also be reported in the pg_stat_database view."}, {"names": ["-d connstr", "--dbname= connstr"], "signature": "-d connstr --dbname= connstr", "description": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. This option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, any database name included in the connection string will be ignored by the server. However, a database name supplied that way overrides the default database name ( replication ) for purposes of looking up the replication connection's password in ~/.pgpass . Similarly, middleware or proxies used in connecting to PostgreSQL might utilize the name for purposes such as connection routing. The database name can also be used by logical replication slot synchronization ."}, {"names": ["-h host", "--host= host"], "signature": "-h host --host= host", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-s interval", "--status-interval= interval"], "signature": "-s interval --status-interval= interval", "description": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Specifies the user name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Forces pg_basebackup to prompt for a password before connecting to the source server. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Prints the pg_basebackup version and exits."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Shows help about pg_basebackup command line arguments, and exits."}], "synopsis": ["pg_basebackup [ option ...]"], "environment": []}, "comparison_hash": "17915f265ed4206a2736150575c5ca2e314265548d96f44f6ffdda3f809ba830", "manual_language": "zh"}, "18": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_basebackup"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "18.6"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "35"}], "tables": [{"key": "options", "rows": [{"summary": "\u8bbe\u7f6e\u5199\u5165\u8f93\u51fa\u7684\u76ee\u6807\u76ee\u5f55\u3002\u5982\u679c\u8be5\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c pg_basebackup \u4f1a\u521b\u5efa\u5b83\uff08\u4ee5\u53ca\u6240\u6709\u7f3a\u5931\u7684\u7236\u76ee\u5f55\uff09\u3002\u5982\u679c\u8be5\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-D directory --pgdata= directory"}}, {"summary": "\u9009\u62e9\u8f93\u51fa\u683c\u5f0f\u3002 format \u53ef\u4ee5\u662f\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-F format --format= format"}}, {"summary": "\u6267\u884c \u589e\u91cf\u5907\u4efd \u3002\u5fc5\u987b\u63d0\u4f9b\u53c2\u8003\u5907\u4efd\u7684\u5907\u4efd\u6e05\u5355\uff1b\u8be5\u6587\u4ef6\u5c06\u88ab\u4e0a\u4f20\u5230\u670d\u52a1\u5668\uff0c\u968f\u540e\u670d\u52a1\u5668\u4f1a\u8fd4\u56de\u6240\u8bf7\u6c42\u7684\u589e\u91cf\u5907\u4efd\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-i old_manifest_file --incremental= old_manifest_file"}}, {"summary": "\u521b\u5efa standby.signal \u6587\u4ef6\uff0c\u5e76\u5c06\u8fde\u63a5\u8bbe\u7f6e\u8ffd\u52a0\u5230\u76ee\u6807\u76ee\u5f55\u4e2d\u7684 postgresql.auto.conf \u6587\u4ef6\u4e2d\uff08\u5982\u679c\u4f7f\u7528 tar \u683c\u5f0f\uff0c\u5219\u8ffd\u52a0\u5230\u57fa\u7840\u5f52\u6863\u6587\u4ef6\u5185\uff09\u3002\u8fd9\u6837\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u5229\u7528\u5907\u4efd\u7ed3\u679c\u642d\u5efa\u5907\u5e93\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-R --write-recovery-conf"}}, {"summary": "\u6307\u793a\u670d\u52a1\u5668\u5c06\u57fa\u7840\u5907\u4efd\u653e\u5230\u54ea\u91cc\u3002\u9ed8\u8ba4\u76ee\u6807\u662f client \uff0c\u8868\u793a\u5907\u4efd\u5e94\u53d1\u9001\u5230\u8fd0\u884c pg_basebackup \u7684\u90a3\u53f0\u673a\u5668\u3002\u5982\u679c\u76ee\u6807\u6539\u4e3a server:/some/path \uff0c\u5219\u5907\u4efd\u4f1a\u5b58\u50a8\u5728\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684 /some/path \u76ee\u5f55\u4e2d\u3002\u5c06\u5907\u4efd\u5b58\u50a8\u5728\u670d\u52a1\u5668\u4e0a\u9700\u8981\u8d85\u7ea7\u7528\u6237\u6743\u9650\uff0c\u6216\u62e5\u6709 pg_write_server_files \u89d2\u8272\u7684\u6743\u9650\u3002\u5982\u679c\u76ee\u6807\u8bbe\u7f6e\u4e3a blackhole \uff0c\u5219\u5185\u5bb9\u4f1a\u88ab\u4e22\u5f03\uff0c\u4e0d\u4f1a\u5b58\u50a8\u5230\u4efb\u4f55\u5730\u65b9\u3002\u8fd9\u53ea\u5e94\u7528\u4e8e\u6d4b\u8bd5\u76ee\u7684\uff0c\u56e0\u4e3a\u6700\u7ec8\u4e0d\u4f1a\u5f97\u5230\u5b9e\u9645\u5907\u4efd\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-t target --target= target"}}, {"summary": "\u5728\u5907\u4efd\u671f\u95f4\uff0c\u5c06\u76ee\u5f55 olddir \u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230 newdir \u3002\u8981\u4f7f\u6b64\u9009\u9879\u751f\u6548\uff0c olddir \u5fc5\u987b\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u5b9a\u4e49\u7684\u8be5\u8868\u7a7a\u95f4\u8def\u5f84\u5b8c\u5168\u4e00\u81f4\u3002\uff08\u4f46\u5982\u679c\u6e90\u670d\u52a1\u5668\u4e0a\u5728 olddir \u4e2d\u6ca1\u6709\u8868\u7a7a\u95f4\uff0c\u4e5f\u4e0d\u7b97\u9519\u8bef\u3002\uff09\u4e0e\u6b64\u540c\u65f6\uff0c newdir \u662f\u63a5\u6536\u4e3b\u673a\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u4e00\u4e2a\u76ee\u5f55\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c newdir \u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002 olddir \u548c newdir \u90fd\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u5982\u679c\u4efb\u4e00\u8def\u5f84\u4e2d\u9700\u8981\u5305\u542b\u7b49\u53f7\uff08 = \uff09\uff0c\u8bf7\u5728\u5176\u524d\u9762\u52a0\u4e0a\u53cd\u659c\u6760\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u4ee5\u5904\u7406\u591a\u4e2a\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-T olddir = newdir --tablespace-mapping= olddir = newdir"}}, {"summary": "\u8bbe\u7f6e\u5199\u5165 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cWAL \u6587\u4ef6\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u7684 pg_wal \u5b50\u76ee\u5f55\u4e2d\uff0c\u4f46\u6b64\u9009\u9879\u53ef\u7528\u4e8e\u5c06\u5176\u653e\u5728\u5176\u4ed6\u4f4d\u7f6e\u3002 waldir \u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c waldir \u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002\u53ea\u6709\u5f53\u5907\u4efd\u91c7\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u624d\u80fd\u6307\u5b9a\u6b64\u9009\u9879\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "--waldir= waldir"}}, {"summary": "\u5728\u5907\u4efd\u4e2d\u5305\u542b\u6240\u9700\u7684 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u3002\u8fd9\u5c06\u5305\u62ec\u5907\u4efd\u671f\u95f4\u751f\u6210\u7684\u6240\u6709\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u9664\u975e\u6307\u5b9a\u65b9\u6cd5 none \uff0c\u5426\u5219\u5c31\u53ef\u4ee5\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u542f\u52a8 postmaster\uff0c\u800c\u65e0\u9700\u67e5\u9605 WAL \u5f52\u6863\uff0c\u4ece\u800c\u4f7f\u8f93\u51fa\u6210\u4e3a\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u5907\u4efd\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-X method --wal-method= method"}}, {"summary": "\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u4f7f\u7528\u9ed8\u8ba4\u538b\u7f29\u7ea7\u522b\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0 .gz \u540e\u7f00\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-z --gzip"}}, {"summary": "\u8bf7\u6c42\u5bf9\u5907\u4efd\u8fdb\u884c\u538b\u7f29\u3002\u5982\u679c\u5305\u542b client \u6216 server \uff0c\u5219\u6307\u5b9a\u538b\u7f29\u6267\u884c\u7684\u4f4d\u7f6e\u3002\u5728\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4f1a\u51cf\u5c11\u4f20\u8f93\u5e26\u5bbd\u5360\u7528\uff0c\u4f46\u4f1a\u589e\u52a0\u670d\u52a1\u5668 CPU \u6d88\u8017\u3002\u9ed8\u8ba4\u503c\u662f client \uff0c\u4f46\u4f7f\u7528 --target \u65f6\u9664\u5916\uff1b\u6b64\u65f6\u5907\u4efd\u4e0d\u4f1a\u53d1\u9001\u5230\u5ba2\u6237\u7aef\uff0c\u56e0\u6b64\u53ea\u6709\u670d\u52a1\u5668\u7aef\u538b\u7f29\u624d\u6709\u610f\u4e49\u3002\u4f7f\u7528\u9ed8\u8ba4\u7684 -Xstream \u65f6\uff0c\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4e0d\u4f1a\u5e94\u7528\u4e8e WAL\u3002\u82e5\u8981\u538b\u7f29 WAL\uff0c\u8bf7\u4f7f\u7528\u5ba2\u6237\u7aef\u538b\u7f29\uff0c\u6216\u8005\u6307\u5b9a -Xfetch \u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]"}}, {"summary": "\u5c06\u68c0\u67e5\u70b9\u6a21\u5f0f\u8bbe\u7f6e\u4e3a fast\uff08\u7acb\u5373\uff09\u6216 spread\uff08\u9ed8\u8ba4\uff09\uff08\u89c1 \u7b2c 25.3.4 \u8282 \uff09\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-c {fast|spread} --checkpoint={fast|spread}"}}, {"summary": "\u6307\u5b9a\u5728\u5f00\u59cb\u5907\u4efd\u4e4b\u524d\uff0c\u5e94\u521b\u5efa\u7531 --slot \u9009\u9879\u6307\u5b9a\u540d\u79f0\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u8be5\u69fd\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u9519\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-C --create-slot"}}, {"summary": "\u8bbe\u7f6e\u5907\u4efd\u6807\u7b7e\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u503c \u201c pg_basebackup base backup \u201d \u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-l label --label= label"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53 pg_basebackup \u56e0\u9519\u8bef\u4e2d\u6b62\u65f6\uff0c\u5b83\u4f1a\u5220\u9664\u5728\u53d1\u73b0\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u76ee\u5f55\uff08\u4f8b\u5982\u76ee\u6807\u76ee\u5f55\u548c\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\uff09\u3002\u6b64\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u5f88\u6709\u5e2e\u52a9\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-n --no-clean"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_basebackup \u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u88ab\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f1a\u4f7f pg_basebackup \u4e0d\u7ecf\u7b49\u5f85\u5c31\u76f4\u63a5\u8fd4\u56de\uff0c\u56e0\u6b64\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u968f\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u57fa\u7840\u5907\u4efd\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u5408\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-N --no-sync"}}, {"summary": "\u542f\u7528\u8fdb\u5ea6\u62a5\u544a\u3002\u6253\u5f00\u6b64\u9009\u9879\u540e\uff0c\u4f1a\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u7ed9\u51fa\u4e00\u4e2a\u8fd1\u4f3c\u7684\u8fdb\u5ea6\u62a5\u544a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u53d1\u751f\u53d8\u5316\uff0c\u56e0\u6b64\u8fd9\u53ea\u662f\u8fd1\u4f3c\u503c\uff0c\u6700\u7ec8\u672a\u5fc5\u6070\u597d\u7ed3\u675f\u5728 100% \u3002\u7279\u522b\u662f\u5f53\u5907\u4efd\u4e2d\u5305\u542b WAL \u65f6\uff0c\u603b\u6570\u636e\u91cf\u65e0\u6cd5\u9884\u5148\u4f30\u8ba1\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u65e6\u8fdb\u5ea6\u8d85\u8fc7\u4e0d\u542b WAL \u65f6\u7684\u603b\u4f30\u8ba1\u503c\uff0c\u4f30\u8ba1\u76ee\u6807\u5927\u5c0f\u5c31\u4f1a\u7ee7\u7eed\u589e\u52a0\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-P --progress"}}, {"summary": "\u8bbe\u7f6e\u4ece\u6e90\u670d\u52a1\u5668\u6536\u96c6\u6570\u636e\u65f6\u5141\u8bb8\u7684\u6700\u5927\u4f20\u8f93\u901f\u7387\u3002\u8fd9\u6709\u52a9\u4e8e\u9650\u5236 pg_basebackup \u5bf9\u670d\u52a1\u5668\u7684\u5f71\u54cd\u3002\u53d6\u503c\u5355\u4f4d\u4e3a\u6bcf\u79d2\u5343\u5b57\u8282\u3002\u4f7f\u7528\u540e\u7f00 M \u8868\u793a\u6bcf\u79d2\u5146\u5b57\u8282\u3002\u4e5f\u63a5\u53d7\u540e\u7f00 k \uff0c\u4f46\u6ca1\u6709\u5b9e\u9645\u5f71\u54cd\u3002\u6709\u6548\u53d6\u503c\u8303\u56f4\u4e3a\u6bcf\u79d2 32 \u5343\u5b57\u8282\u5230\u6bcf\u79d2 1024 \u5146\u5b57\u8282\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-r rate --max-rate= rate"}}, {"summary": "\u6b64\u9009\u9879\u53ea\u80fd\u4e0e -X stream \u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u4f1a\u4f7f WAL \u6d41\u5f0f\u4f20\u8f93\u4f7f\u7528\u6307\u5b9a\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u6b64\u57fa\u7840\u5907\u4efd\u6253\u7b97\u7528\u4f5c\u4f7f\u7528\u590d\u5236\u69fd\u7684\u6d41\u590d\u5236\u5907\u5e93\uff0c\u90a3\u4e48\u8be5\u5907\u5e93\u5e94\u5c06\u540c\u4e00\u4e2a\u590d\u5236\u69fd\u540d\u79f0\u7528\u4f5c primary_slot_name \u7684\u503c\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u4e3b\u5e93\u5728\u57fa\u7840\u5907\u4efd\u7ed3\u675f\u4e0e\u65b0\u5907\u5e93\u5f00\u59cb\u6d41\u590d\u5236\u4e4b\u95f4\u7684\u8fd9\u6bb5\u65f6\u95f4\u5185\uff0c\u4e0d\u4f1a\u79fb\u9664\u4efb\u4f55\u5fc5\u9700\u7684 WAL \u6570\u636e\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-S slotname --slot= slotname"}}, {"summary": "\u8bbe\u7f6e\u4e3a fsync \uff08\u9ed8\u8ba4\uff09\u65f6\uff0c pg_basebackup \u4f1a\u9012\u5f52\u6253\u5f00\u5e76\u540c\u6b65\u5907\u4efd\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3002\u4f7f\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u67e5\u627e\u6587\u4ef6\u4f1a\u8ddf\u968f WAL \u76ee\u5f55\u548c\u5404\u5df2\u914d\u7f6e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "--sync-method= method"}}, {"summary": "\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\u3002\u5b83\u4f1a\u5728\u542f\u52a8\u548c\u5173\u95ed\u8fc7\u7a0b\u4e2d\u8f93\u51fa\u4e00\u4e9b\u989d\u5916\u6b65\u9aa4\uff1b\u5982\u679c\u540c\u65f6\u542f\u7528\u4e86\u8fdb\u5ea6\u62a5\u544a\uff0c\u8fd8\u4f1a\u663e\u793a\u5f53\u524d\u6b63\u5728\u5904\u7406\u7684\u786e\u5207\u6587\u4ef6\u540d\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-v --verbose"}}, {"summary": "\u6307\u5b9a\u5e94\u7528\u5230\u5907\u4efd\u6e05\u5355\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u7684\u6821\u9a8c\u548c\u7b97\u6cd5\u3002\u76ee\u524d\u53ef\u7528\u7684\u7b97\u6cd5\u6709 NONE \u3001 CRC32C \u3001 SHA224 \u3001 SHA256 \u3001 SHA384 \u548c SHA512 \u3002\u9ed8\u8ba4\u503c\u4e3a CRC32C \u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "--manifest-checksums= algorithm"}}, {"summary": "\u5f3a\u5236\u5c06\u5907\u4efd\u6e05\u5355\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u540d\u7f16\u7801\u4e3a\u5341\u516d\u8fdb\u5236\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u5bf9\u975e UTF8 \u6587\u4ef6\u540d\u8fdb\u884c\u5341\u516d\u8fdb\u5236\u7f16\u7801\u3002\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u8bfb\u53d6\u5907\u4efd\u6e05\u5355\u6587\u4ef6\u7684\u5de5\u5177\u662f\u5426\u80fd\u6b63\u786e\u5904\u7406\u8fd9\u79cd\u60c5\u51b5\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "--manifest-force-encode"}}, {"summary": "\u7981\u6b62\u670d\u52a1\u5668\u4f30\u7b97\u5c06\u8981\u6d41\u5f0f\u4f20\u8f93\u7684\u5907\u4efd\u6570\u636e\u603b\u91cf\uff0c\u56e0\u6b64 pg_stat_progress_basebackup \u89c6\u56fe\u4e2d\u7684 backup_total \u5217\u59cb\u7ec8\u4e3a NULL\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "--no-estimate-size"}}, {"summary": "\u7981\u6b62\u751f\u6210\u5907\u4efd\u6e05\u5355\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u670d\u52a1\u5668\u5c06\u751f\u6210\u5e76\u53d1\u9001\u4e00\u4e2a\u5907\u4efd\u6e05\u5355\uff0c\u53ef\u4f7f\u7528 pg_verifybackup \u8fdb\u884c\u9a8c\u8bc1\u3002\u8be5\u6e05\u5355\u5217\u51fa\u4e86\u5907\u4efd\u4e2d\u7684\u6bcf\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u4e0d\u5305\u62ec\u53ef\u80fd\u5305\u542b\u5728\u5176\u4e2d\u7684\u4efb\u4f55 WAL \u6587\u4ef6\u3002\u5b83\u8fd8\u4f1a\u4fdd\u5b58\u6bcf\u4e2a\u6587\u4ef6\u7684\u5927\u5c0f\u3001\u6700\u540e\u4fee\u6539\u65f6\u95f4\u4ee5\u53ca\u53ef\u9009\u7684\u6821\u9a8c\u548c\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "--no-manifest"}}, {"summary": "\u9632\u6b62\u4e3a\u5907\u4efd\u521b\u5efa\u4e34\u65f6\u590d\u5236\u69fd\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "--no-slot"}}, {"summary": "\u5982\u679c\u83b7\u53d6\u57fa\u7840\u5907\u4efd\u7684\u670d\u52a1\u5668\u542f\u7528\u4e86\u6821\u9a8c\u548c\uff0c\u5219\u7981\u7528\u5bf9\u8fd9\u4e9b\u6821\u9a8c\u548c\u7684\u9a8c\u8bc1\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "--no-verify-checksums"}}, {"summary": "\u4ee5 \u8fde\u63a5\u5b57\u7b26\u4e32 \u7684\u5f62\u5f0f\u6307\u5b9a\u7528\u4e8e\u8fde\u63a5\u670d\u52a1\u5668\u7684\u53c2\u6570\uff1b\u8fd9\u4e9b\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u76f8\u4e92\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-d connstr --dbname= connstr"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGHOST \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff1b\u5426\u5219\u4f1a\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-h host --host= host"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u6240\u4f7f\u7528\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u4e2d\u7684\u503c\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u786e\u5b9a\u7684\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-p port --port= port"}}, {"summary": "\u6307\u5b9a\u53d1\u9001\u56de\u6e90\u670d\u52a1\u5668\u7684\u72b6\u6001\u5305\u4e4b\u95f4\u76f8\u9694\u7684\u79d2\u6570\u3002\u8f83\u5c0f\u7684\u503c\u53ef\u4ee5\u8ba9\u670d\u52a1\u5668\u7aef\u5bf9\u5907\u4efd\u8fdb\u5ea6\u7684\u76d1\u63a7\u66f4\u7cbe\u786e\u3002\u503c\u4e3a\u96f6\u65f6\u4f1a\u5b8c\u5168\u7981\u7528\u5468\u671f\u6027\u72b6\u6001\u66f4\u65b0\uff0c\u4e0d\u8fc7\u5f53\u670d\u52a1\u5668\u8bf7\u6c42\u65f6\u4ecd\u4f1a\u53d1\u9001\u66f4\u65b0\uff0c\u4ee5\u907f\u514d\u56e0\u8d85\u65f6\u800c\u65ad\u5f00\u8fde\u63a5\u3002\u9ed8\u8ba4\u503c\u662f 10 \u79d2\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-s interval --status-interval= interval"}}, {"summary": "\u6307\u5b9a\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-U username --username= username"}}, {"summary": "\u7981\u6b62\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\uff08\u4f8b\u5982 .pgpass \u6587\u4ef6\uff09\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u6b64\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u79cd\u573a\u666f\u4e0b\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 pg_basebackup \u5728\u8fde\u63a5\u6e90\u670d\u52a1\u5668\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-W --password"}}, {"summary": "\u8f93\u51fa pg_basebackup \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-V --version"}}, {"summary": "\u663e\u793a pg_basebackup \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}], "options": [{"names": ["-D directory", "--pgdata= directory"], "summary": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty.", "signature": "-D directory --pgdata= directory", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty. When the backup is in tar format, the target directory may be specified as - (dash), causing the tar file to be written to stdout . This option is required."}, {"names": ["-F format", "--format= format"], "summary": "Selects the format for the output. format can be one of the following:", "signature": "-F format --format= format", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the source server's data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory's contents will be written to a file named base.tar , and each other tablespace will be written to a separate tar file named after that tablespace's OID. If the target directory is specified as - (dash), the tar contents will be written to standard output, suitable for piping to (for example) gzip . This is only allowed if the cluster has no additional tablespaces and WAL streaming is not used."}, {"names": ["-i old_manifest_file", "--incremental= old_manifest_file"], "summary": "Performs an incremental backup . The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup.", "signature": "-i old_manifest_file --incremental= old_manifest_file", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Performs an incremental backup . The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup."}, {"names": ["-R", "--write-recovery-conf"], "summary": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup.", "signature": "-R --write-recovery-conf", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup. The postgresql.auto.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that streaming replication and logical replication slot synchronization will use the same settings later on. The dbname will be recorded only if the dbname was specified explicitly in the connection string or environment variable ."}, {"names": ["-t target", "--target= target"], "summary": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup.", "signature": "-t target --target= target", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup. Since WAL streaming is implemented by pg_basebackup rather than by the server, this option cannot be used together with -Xstream . Since that is the default, when this option is specified, you must also specify either -Xfetch or -Xnone ."}, {"names": ["-T olddir = newdir", "--tablespace-mapping= olddir = newdir"], "summary": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces.", "signature": "-T olddir = newdir --tablespace-mapping= olddir = newdir", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected."}, {"names": ["--waldir= waldir"], "summary": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format.", "signature": "--waldir= waldir", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format."}, {"names": ["-X method", "--wal-method= method"], "summary": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup.", "signature": "-X method --wal-method= method", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup. The following method s for collecting the write-ahead logs are supported: n none Don't include write-ahead logs in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the source server's wal_keep_size parameter to be set high enough that the required log data is not removed before the end of the backup. If the required log data has been recycled before it's time to transfer it, the backup will fail and be unusable. When tar format is used, the write-ahead log files will be included in the base.tar file. s stream Stream write-ahead log data while the backup is being taken. This method will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will require two replication connections not just one. As long as the client can keep up with the write-ahead log data, using this method requires no extra write-ahead logs to be saved on the source server. When tar format is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default."}, {"names": ["-z", "--gzip"], "summary": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "signature": "-z --gzip", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-Z level", "-Z [{client|server}-] method [: detail ]", "--compress= level", "--compress=[{client|server}-] method [: detail ]"], "summary": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch .", "signature": "-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch . The compression method can be set to gzip , lz4 , zstd , none for no compression or an integer (no compression if 0, gzip if greater than 0). A compression detail string can optionally be specified. If the detail string is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form keyword or keyword=value . Currently, the supported keywords are level , long , and workers . The detail string cannot be used when the compression method is specified as a plain integer. If no compression level is specified, the default compression level will be used. If only a level is specified without mentioning an algorithm, gzip compression will be used if the level is greater than 0, and no compression will be used if the level is 0. When the tar format is used with gzip , lz4 , or zstd , the suffix .gz , .lz4 , or .zst , respectively, will be automatically added to all tar filenames. When the plain format is used, client-side compression may not be specified, but it is still possible to request server-side compression. If this is done, the server will compress the backup for transmission, and the client will decompress and extract it. When this option is used in combination with -Xstream , pg_wal.tar will be compressed using gzip if client-side gzip compression is selected, but will not be compressed if any other compression algorithm is selected, or if server-side compression is selected."}, {"names": ["-c {fast|spread}", "--checkpoint={fast|spread}"], "summary": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 25.3.4 ).", "signature": "-c {fast|spread} --checkpoint={fast|spread}", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 25.3.4 )."}, {"names": ["-C", "--create-slot"], "summary": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists.", "signature": "-C --create-slot", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists."}, {"names": ["-l label", "--label= label"], "summary": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used.", "signature": "-l label --label= label", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used."}, {"names": ["-n", "--no-clean"], "summary": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging.", "signature": "-n --no-clean", "source_url": "/docs/18/app-pgbasebackup.html", "description": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way."}, {"names": ["-N", "--no-sync"], "summary": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.", "signature": "-N --no-sync", "source_url": "/docs/18/app-pgbasebackup.html", "description": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."}, {"names": ["-P", "--progress"], "summary": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.", "signature": "-P --progress", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL."}, {"names": ["-r rate", "--max-rate= rate"], "summary": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second.", "signature": "-r rate --max-rate= rate", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch ."}, {"names": ["-S slotname", "--slot= slotname"], "summary": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby.", "signature": "-S slotname --slot= slotname", "source_url": "/docs/18/app-pgbasebackup.html", "description": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby. The specified replication slot has to exist unless the option -C is also used. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming."}, {"names": ["--sync-method= method"], "summary": "When set to fsync , which is the default, pg_basebackup will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace.", "signature": "--sync-method= method", "source_url": "/docs/18/app-pgbasebackup.html", "description": "When set to fsync , which is the default, pg_basebackup will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace. On Linux, syncfs may be used instead to ask the operating system to synchronize the whole file system that contains the backup directory. When the plain format is used, pg_basebackup will also synchronize the file systems that contain the WAL files and each tablespace. See recovery_init_sync_method for information about the caveats to be aware of when using syncfs . This option has no effect when --no-sync is used."}, {"names": ["-v", "--verbose"], "summary": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.", "signature": "-v --verbose", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."}, {"names": ["--manifest-checksums= algorithm"], "summary": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C .", "signature": "--manifest-checksums= algorithm", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C . If NONE is selected, the backup manifest will not contain any checksums. Otherwise, it will contain a checksum of each file in the backup using the specified algorithm. In addition, the manifest will always contain a SHA256 checksum of its own contents. The SHA algorithms are significantly more CPU-intensive than CRC32C , so selecting one of them may increase the time required to complete the backup. Using a SHA hash function provides a cryptographically secure digest of each file for users who wish to verify that the backup has not been tampered with, while the CRC-32C algorithm provides a checksum that is much faster to calculate; it is good at catching errors due to accidental changes but is not resistant to malicious modifications. Note that, to be useful against an adversary who has access to the backup, the backup manifest would need to be stored securely elsewhere or otherwise verified not to have been modified since the backup was taken. pg_verifybackup can be used to check the integrity of a backup against the backup manifest."}, {"names": ["--manifest-force-encode"], "summary": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case.", "signature": "--manifest-force-encode", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case."}, {"names": ["--no-estimate-size"], "summary": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL .", "signature": "--no-estimate-size", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL . Without this option, the backup will start by enumerating the size of the entire database, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent. This option is useful to avoid such estimation time if it's too long. This option is not allowed when using --progress ."}, {"names": ["--no-manifest"], "summary": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file.", "signature": "--no-manifest", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file."}, {"names": ["--no-slot"], "summary": "Prevents the creation of a temporary replication slot for the backup.", "signature": "--no-slot", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Prevents the creation of a temporary replication slot for the backup. By default, if log streaming is selected but no slot name is given with the -S option, then a temporary replication slot is created (if supported by the source server). The main purpose of this option is to allow taking a base backup when the server has no free replication slots. Using a replication slot is almost always preferred, because it prevents needed WAL from being removed by the server during the backup."}, {"names": ["--no-verify-checksums"], "summary": "Disables verification of checksums, if they are enabled on the server the base backup is taken from.", "signature": "--no-verify-checksums", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Disables verification of checksums, if they are enabled on the server the base backup is taken from. By default, checksums are verified and checksum failures will result in a non-zero exit status. However, the base backup will not be removed in such a case, as if the --no-clean option had been used. Checksum verification failures will also be reported in the pg_stat_database view."}, {"names": ["-d connstr", "--dbname= connstr"], "summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": "-d connstr --dbname= connstr", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. This option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, any database name included in the connection string will be ignored by the server. However, a database name supplied that way overrides the default database name ( replication ) for purposes of looking up the replication connection's password in ~/.pgpass . Similarly, middleware or proxies used in connecting to PostgreSQL might utilize the name for purposes such as connection routing. The database name can also be used by logical replication slot synchronization ."}, {"names": ["-h host", "--host= host"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "signature": "-h host --host= host", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "signature": "-p port --port= port", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-s interval", "--status-interval= interval"], "summary": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds.", "signature": "-s interval --status-interval= interval", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds."}, {"names": ["-U username", "--username= username"], "summary": "Specifies the user name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Specifies the user name to connect as."}, {"names": ["-w", "--no-password"], "summary": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "summary": "Forces pg_basebackup to prompt for a password before connecting to the source server.", "signature": "-W --password", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Forces pg_basebackup to prompt for a password before connecting to the source server. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["-V", "--version"], "summary": "Prints the pg_basebackup version and exits.", "signature": "-V --version", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Prints the pg_basebackup version and exits."}, {"names": ["-?", "--help"], "summary": "Shows help about pg_basebackup command line arguments, and exits.", "signature": "-? --help", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Shows help about pg_basebackup command line arguments, and exits."}], "related": [{"url": "/wiki/conn/?v=18", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "label": "18.6", "major": "18", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/18/postgresql-18-A4.pdf", "bytes": 15865106, "pages": 3154, "sha256": "19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/18/postgresql-18-US.pdf", "bytes": 15748059, "pages": 3328, "sha256": "facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319", "built_at": "2026-09-26"}}, "tree": "18", "index": "index.html", "major": "18", "pages": 1148, "release": "18.6", "source_url": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "svg_assets": 3, "source_mode": "en SGML built with pinned official archive", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "revision": "ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8", "evidence_kind": "English manual and source declarations", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "sources": [{"url": "https://pg.center/docs/18/app-pgbasebackup.html", "file": "app-pgbasebackup.html", "label": "18.6 English manual \u00b7 app-pgbasebackup.html", "anchor": "", "sha256": "76780bc785b5bf8a7b20cdc1678b3e8d1de6aafb9cc46df9e578012d4f71546b", "language": "en", "original_url": "/docs/18/app-pgbasebackup.html"}, {"url": "https://pg.center/docs/18/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0", "language": "en", "original_url": "/docs/18/reference-client.html"}], "sections": [], "synopsis": ["pg_basebackup [ option ...]"], "signature": "pg_basebackup [ option ...]", "description": ["pg_basebackup \u2014 \u83b7\u53d6 PostgreSQL \u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd"], "environment": [], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGBASEBACKUP\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_basebackup</span></span></h2>\n<p lang=\"zh\">pg_basebackup \u2014 \u83b7\u53d6<span class=\"productname\">PostgreSQL</span>\u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.10.4.1\"><code class=\"command\">pg_basebackup</code> [<em class=\"replaceable\"><code>option</code></em>...]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u7528\u4e8e\u83b7\u53d6\u6b63\u5728\u8fd0\u884c\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd\u3002\u5907\u4efd\u8fc7\u7a0b\u4e0d\u4f1a\u5f71\u54cd\u6570\u636e\u5e93\u7684\u5176\u4ed6\u5ba2\u6237\u7aef\uff0c\u5e76\u4e14\u8be5\u5907\u4efd\u65e2\u53ef\u7528\u4e8e\u65f6\u95f4\u70b9\u6062\u590d\uff08\u89c1<a class=\"xref\" href=\"/docs/18/continuous-archiving.html\" title=\"25.3.\u00a0\u6301\u7eed\u5f52\u6863\u548c\u65f6\u95f4\u70b9\u6062\u590d\uff08PITR\uff09\">\u7b2c\u00a025.3\u00a0\u8282</a>\uff09\uff0c\u4e5f\u53ef\u7528\u4f5c\u65e5\u5fd7\u4f20\u9001\u6216\u6d41\u590d\u5236\u5907\u5e93\u7684\u8d77\u70b9\uff08\u89c1<a class=\"xref\" href=\"/docs/18/warm-standby.html\" title=\"26.2.\u00a0\u65e5\u5fd7\u4f20\u9001\u5907\u5e93\">\u7b2c\u00a026.2\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u65e2\u53ef\u4ee5\u6267\u884c\u5b8c\u6574\u57fa\u7840\u5907\u4efd\uff0c\u4e5f\u53ef\u4ee5\u6267\u884c\u589e\u91cf\u57fa\u7840\u5907\u4efd\u3002\u6267\u884c\u5b8c\u6574\u5907\u4efd\u65f6\uff0c\u5b83\u4f1a\u7cbe\u786e\u590d\u5236\u6570\u636e\u5e93\u96c6\u7c07\u7684\u6587\u4ef6\u3002\u6267\u884c\u589e\u91cf\u5907\u4efd\u65f6\uff0c\u539f\u672c\u4f1a\u5305\u542b\u5728\u5b8c\u6574\u5907\u4efd\u4e2d\u7684\u67d0\u4e9b\u6587\u4ef6\uff0c\u53ef\u80fd\u4f1a\u88ab\u8fd9\u4e9b\u6587\u4ef6\u7684\u589e\u91cf\u7248\u672c\u66ff\u4ee3\uff0c\u5176\u4e2d\u4ec5\u5305\u542b\u81ea\u53c2\u8003\u5907\u4efd\u4ee5\u6765\u88ab\u4fee\u6539\u8fc7\u7684\u5757\u3002\u589e\u91cf\u5907\u4efd\u4e0d\u80fd\u76f4\u63a5\u4f7f\u7528\uff1b\u5fc5\u987b\u5148\u4f7f\u7528<a class=\"xref\" href=\"/docs/18/app-pgcombinebackup.html\" title=\"pg_combinebackup\"><span class=\"refentrytitle\"><span class=\"application\">pg_combinebackup</span></span></a>\u5c06\u5176\u4e0e\u5b83\u6240\u4f9d\u8d56\u7684\u5148\u524d\u5907\u4efd\u5408\u5e76\u3002\u5173\u4e8e\u589e\u91cf\u5907\u4efd\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u89c1<a class=\"xref\" href=\"/docs/18/continuous-archiving.html#BACKUP-INCREMENTAL-BACKUP\" title=\"25.3.3.\u00a0\u8fdb\u884c\u589e\u91cf\u5907\u4efd\">\u7b2c\u00a025.3.3\u00a0\u8282</a>\uff1b\u5173\u4e8e\u4ece\u5907\u4efd\u6062\u590d\u7684\u6b65\u9aa4\uff0c\u89c1<a class=\"xref\" href=\"/docs/18/continuous-archiving.html#BACKUP-PITR-RECOVERY\" title=\"25.3.5.\u00a0\u4f7f\u7528\u6301\u7eed\u5f52\u6863\u5907\u4efd\u8fdb\u884c\u6062\u590d\">\u7b2c\u00a025.3.5\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5728\u4efb\u4f55\u6a21\u5f0f\u4e0b\uff0c<span class=\"application\">pg_basebackup</span>\u90fd\u4f1a\u786e\u4fdd\u670d\u52a1\u5668\u81ea\u52a8\u8fdb\u5165\u548c\u9000\u51fa\u5907\u4efd\u6a21\u5f0f\u3002\u5907\u4efd\u59cb\u7ec8\u9488\u5bf9\u6574\u4e2a\u6570\u636e\u5e93\u96c6\u7c07\uff1b\u4e0d\u53ef\u80fd\u53ea\u5907\u4efd\u5355\u4e2a\u6570\u636e\u5e93\u6216\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u5bf9\u4e8e\u9009\u62e9\u6027\u5907\u4efd\uff0c\u5fc5\u987b\u4f7f\u7528\u8bf8\u5982<a class=\"xref\" href=\"/docs/18/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>\u4e4b\u7c7b\u7684\u5176\u4ed6\u5de5\u5177\u3002</p>\n<p lang=\"zh\">\u5907\u4efd\u662f\u901a\u8fc7\u4e00\u4e2a\u4f7f\u7528\u590d\u5236\u534f\u8bae\u7684\u5e38\u89c4<span class=\"productname\">PostgreSQL</span>\u8fde\u63a5\u8fdb\u884c\u7684\u3002\u5efa\u7acb\u8be5\u8fde\u63a5\u6240\u4f7f\u7528\u7684\u7528\u6237 ID \u5fc5\u987b\u5177\u6709<code class=\"literal\">REPLICATION</code>\u6743\u9650\uff08\u89c1<a class=\"xref\" href=\"/docs/18/role-attributes.html\" title=\"21.2.\u00a0\u89d2\u8272\u5c5e\u6027\">\u7b2c\u00a021.2\u00a0\u8282</a>\uff09\uff0c\u6216\u8005\u662f\u8d85\u7ea7\u7528\u6237\uff0c\u5e76\u4e14<a class=\"link\" href=\"/docs/18/auth-pg-hba-conf.html\" title=\"20.1.\u00a0pg_hba.conf \u6587\u4ef6\"><code class=\"filename\">pg_hba.conf</code></a>\u5fc5\u987b\u5141\u8bb8\u8be5\u590d\u5236\u8fde\u63a5\u3002\u670d\u52a1\u5668\u8fd8\u5fc5\u987b\u5c06<a class=\"xref\" href=\"/docs/18/runtime-config-replication.html#GUC-MAX-WAL-SENDERS\">max_wal_senders</a>\u8bbe\u7f6e\u5f97\u8db3\u591f\u9ad8\uff0c\u4ee5\u4fbf\u81f3\u5c11\u63d0\u4f9b\u4e00\u4e2a\u7528\u4e8e\u5907\u4efd\u7684 WAL \u53d1\u9001\u8fdb\u7a0b\uff0c\u5e76\u5728\u4f7f\u7528 WAL \u6d41\u5f0f\u4f20\u8f93\u65f6\u518d\u63d0\u4f9b\u4e00\u4e2a WAL \u53d1\u9001\u8fdb\u7a0b\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u540c\u65f6\u8fd0\u884c\u591a\u4e2a<code class=\"command\">pg_basebackup</code>\uff0c\u4f46\u4ece\u6027\u80fd\u89d2\u5ea6\u6765\u770b\uff0c\u901a\u5e38\u6700\u597d\u53ea\u6267\u884c\u4e00\u6b21\u5907\u4efd\uff0c\u7136\u540e\u590d\u5236\u5176\u7ed3\u679c\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u4e0d\u4ec5\u53ef\u4ee5\u4ece\u4e3b\u5e93\u83b7\u53d6\u57fa\u7840\u5907\u4efd\uff0c\u4e5f\u53ef\u4ee5\u4ece\u5907\u5e93\u83b7\u53d6\u3002\u8981\u4ece\u5907\u5e93\u83b7\u53d6\u5907\u4efd\uff0c\u9700\u8981\u5c06\u5907\u5e93\u914d\u7f6e\u4e3a\u80fd\u591f\u63a5\u53d7\u590d\u5236\u8fde\u63a5\uff08\u5373\u8bbe\u7f6e<code class=\"varname\">max_wal_senders</code>\u548c<a class=\"xref\" href=\"/docs/18/runtime-config-replication.html#GUC-HOT-STANDBY\">hot_standby</a>\uff0c\u5e76\u9002\u5f53\u5730\u914d\u7f6e\u5176<code class=\"filename\">pg_hba.conf</code>\uff09\u3002\u8fd8\u9700\u8981\u5728\u4e3b\u5e93\u4e0a\u542f\u7528<a class=\"xref\" href=\"/docs/18/runtime-config-wal.html#GUC-FULL-PAGE-WRITES\">full_page_writes</a>\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u4ece\u5907\u5e93\u83b7\u53d6\u5907\u4efd\u5b58\u5728\u4e00\u4e9b\u9650\u5236\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5907\u4efd\u5386\u53f2\u6587\u4ef6\u4e0d\u4f1a\u5728\u88ab\u5907\u4efd\u7684\u6570\u636e\u5e93\u96c6\u7c07\u4e2d\u521b\u5efa\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">pg_basebackup</span>\u65e0\u6cd5\u5f3a\u5236\u5907\u5e93\u5728\u5907\u4efd\u7ed3\u675f\u65f6\u5207\u6362\u5230\u65b0\u7684 WAL \u6587\u4ef6\u3002\u5f53\u4f7f\u7528<code class=\"literal\">-X none</code>\u65f6\uff0c\u5982\u679c\u4e3b\u5e93\u4e0a\u7684\u5199\u5165\u6d3b\u52a8\u8f83\u5c11\uff0c<span class=\"application\">pg_basebackup</span>\u53ef\u80fd\u9700\u8981\u957f\u65f6\u95f4\u7b49\u5f85\uff0c\u76f4\u5230\u5907\u4efd\u6240\u9700\u7684\u6700\u540e\u4e00\u4e2a WAL \u6587\u4ef6\u88ab\u5207\u6362\u5e76\u5f52\u6863\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5728\u4e3b\u5e93\u4e0a\u8fd0\u884c<code class=\"function\">pg_switch_wal</code>\uff0c\u4ee5\u7acb\u5373\u89e6\u53d1 WAL \u6587\u4ef6\u5207\u6362\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5982\u679c\u5907\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u88ab\u63d0\u5347\u4e3a\u4e3b\u5e93\uff0c\u5219\u5907\u4efd\u4f1a\u5931\u8d25\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5907\u4efd\u6240\u9700\u7684\u6240\u6709 WAL \u8bb0\u5f55\u90fd\u5fc5\u987b\u5305\u542b\u8db3\u591f\u7684\u6574\u9875\u5199\u5165\uff0c\u56e0\u6b64\u5fc5\u987b\u5728\u4e3b\u5e93\u4e0a\u542f\u7528<code class=\"varname\">full_page_writes</code>\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u6bcf\u5f53<span class=\"application\">pg_basebackup</span>\u6267\u884c\u57fa\u7840\u5907\u4efd\u65f6\uff0c\u670d\u52a1\u5668\u7684<code class=\"structname\">pg_stat_progress_basebackup</code>\u89c6\u56fe\u90fd\u4f1a\u62a5\u544a\u5907\u4efd\u8fdb\u5ea6\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/18/progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING\" title=\"27.4.6.\u00a0\u57fa\u7840\u5907\u4efd\u8fdb\u5ea6\u62a5\u544a\">\u7b2c\u00a027.4.6\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u8f93\u51fa\u7684\u4f4d\u7f6e\u548c\u683c\u5f0f\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>directory</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u5199\u5165\u8f93\u51fa\u7684\u76ee\u6807\u76ee\u5f55\u3002\u5982\u679c\u8be5\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u521b\u5efa\u5b83\uff08\u4ee5\u53ca\u6240\u6709\u7f3a\u5931\u7684\u7236\u76ee\u5f55\uff09\u3002\u5982\u679c\u8be5\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002</p>\n<p lang=\"zh\">\u5f53\u5907\u4efd\u91c7\u7528 tar \u683c\u5f0f\u65f6\uff0c\u76ee\u6807\u76ee\u5f55\u53ef\u4ee5\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff08\u77ed\u6a2a\u7ebf\uff09\uff0c\u4ece\u800c\u5c06 tar \u6587\u4ef6\u5199\u5230<code class=\"literal\">stdout</code>\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u662f\u5fc5\u9700\u7684\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>format</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--format=<em class=\"replaceable\"><code>format</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u9009\u62e9\u8f93\u51fa\u683c\u5f0f\u3002<em class=\"replaceable\"><code>format</code></em>\u53ef\u4ee5\u662f\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">p</code><br/></span><span class=\"term\"><code class=\"literal\">plain</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u5199\u4e3a\u666e\u901a\u6587\u4ef6\uff0c\u5176\u5e03\u5c40\u4e0e\u6e90\u670d\u52a1\u5668\u7684\u6570\u636e\u76ee\u5f55\u548c\u8868\u7a7a\u95f4\u76f8\u540c\u3002\u5f53\u96c6\u7c07\u6ca1\u6709\u989d\u5916\u8868\u7a7a\u95f4\u65f6\uff0c\u6574\u4e2a\u6570\u636e\u5e93\u90fd\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u3002\u5982\u679c\u96c6\u7c07\u5305\u542b\u989d\u5916\u8868\u7a7a\u95f4\uff0c\u5219\u4e3b\u6570\u636e\u76ee\u5f55\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\uff0c\u800c\u5176\u4ed6\u6240\u6709\u8868\u7a7a\u95f4\u90fd\u4f1a\u653e\u5728\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u76f8\u540c\u7684\u7edd\u5bf9\u8def\u5f84\u4e2d\u3002\uff08\u5982\u9700\u6539\u53d8\u8fd9\u4e00\u70b9\uff0c\u89c1<code class=\"option\">--tablespace-mapping</code>\u3002\uff09</p>\n<p lang=\"zh\">\u8fd9\u662f\u9ed8\u8ba4\u683c\u5f0f\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">t</code><br/></span><span class=\"term\"><code class=\"literal\">tar</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u5199\u4e3a\u76ee\u6807\u76ee\u5f55\u4e2d\u7684 tar \u6587\u4ef6\u3002\u4e3b\u6570\u636e\u76ee\u5f55\u7684\u5185\u5bb9\u4f1a\u5199\u5165\u540d\u4e3a<code class=\"filename\">base.tar</code>\u7684\u6587\u4ef6\u4e2d\uff0c\u800c\u6bcf\u4e2a\u5176\u4ed6\u8868\u7a7a\u95f4\u90fd\u4f1a\u5199\u5165\u4e00\u4e2a\u4ee5\u8be5\u8868\u7a7a\u95f4 OID \u547d\u540d\u7684\u72ec\u7acb tar \u6587\u4ef6\u4e2d\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u76ee\u6807\u76ee\u5f55\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff08\u77ed\u6a2a\u7ebf\uff09\uff0ctar \u5185\u5bb9\u5c06\u5199\u5165\u6807\u51c6\u8f93\u51fa\uff0c\u9002\u5408\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u4f8b\u5982<span class=\"productname\">gzip</span>\u3002\u53ea\u6709\u5f53\u96c6\u7c07\u6ca1\u6709\u989d\u5916\u8868\u7a7a\u95f4\u4e14\u672a\u4f7f\u7528 WAL \u6d41\u5f0f\u4f20\u8f93\u65f6\uff0c\u624d\u5141\u8bb8\u8fd9\u6837\u505a\u3002</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-i <em class=\"replaceable\"><code>old_manifest_file</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--incremental=<em class=\"replaceable\"><code>old_manifest_file</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6267\u884c<a class=\"link\" href=\"/docs/18/continuous-archiving.html#BACKUP-INCREMENTAL-BACKUP\" title=\"25.3.3.\u00a0\u8fdb\u884c\u589e\u91cf\u5907\u4efd\">\u589e\u91cf\u5907\u4efd</a>\u3002\u5fc5\u987b\u63d0\u4f9b\u53c2\u8003\u5907\u4efd\u7684\u5907\u4efd\u6e05\u5355\uff1b\u8be5\u6587\u4ef6\u5c06\u88ab\u4e0a\u4f20\u5230\u670d\u52a1\u5668\uff0c\u968f\u540e\u670d\u52a1\u5668\u4f1a\u8fd4\u56de\u6240\u8bf7\u6c42\u7684\u589e\u91cf\u5907\u4efd\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code><br/></span><span class=\"term\"><code class=\"option\">--write-recovery-conf</code></span></dt>\n<dd>\n<p lang=\"zh\">\u521b\u5efa<a class=\"link\" href=\"/docs/18/warm-standby.html#FILE-STANDBY-SIGNAL\"><code class=\"filename\">standby.signal</code></a> <a class=\"indexterm\" id=\"id-1.9.4.10.6.2.1.4.3.1.2\" name=\"id-1.9.4.10.6.2.1.4.3.1.2\"></a>\u6587\u4ef6\uff0c\u5e76\u5c06\u8fde\u63a5\u8bbe\u7f6e\u8ffd\u52a0\u5230\u76ee\u6807\u76ee\u5f55\u4e2d\u7684<code class=\"filename\">postgresql.auto.conf</code>\u6587\u4ef6\u4e2d\uff08\u5982\u679c\u4f7f\u7528 tar \u683c\u5f0f\uff0c\u5219\u8ffd\u52a0\u5230\u57fa\u7840\u5f52\u6863\u6587\u4ef6\u5185\uff09\u3002\u8fd9\u6837\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u5229\u7528\u5907\u4efd\u7ed3\u679c\u642d\u5efa\u5907\u5e93\u3002</p>\n<p lang=\"zh\"><code class=\"filename\">postgresql.auto.conf</code>\u6587\u4ef6\u5c06\u8bb0\u5f55\u8fde\u63a5\u8bbe\u7f6e\uff0c\u4ee5\u53ca\uff08\u5982\u679c\u6307\u5b9a\uff09<span class=\"application\">pg_basebackup</span>\u6b63\u5728\u4f7f\u7528\u7684\u590d\u5236\u69fd\uff0c\u4ee5\u4fbf\u540e\u7eed\u7684\u6d41\u590d\u5236\u548c<a class=\"link\" href=\"/docs/18/logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS-SYNCHRONIZATION\" title=\"47.2.3.\u00a0\u590d\u5236\u69fd\u540c\u6b65\">\u903b\u8f91\u590d\u5236\u69fd\u540c\u6b65</a>\u4f7f\u7528\u76f8\u540c\u7684\u8bbe\u7f6e\u3002\u53ea\u6709\u5f53 dbname \u5728\u8fde\u63a5\u5b57\u7b26\u4e32\u6216<a class=\"link\" href=\"/docs/18/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u73af\u5883\u53d8\u91cf</a>\u4e2d\u88ab\u663e\u5f0f\u6307\u5b9a\u65f6\uff0c\u624d\u4f1a\u8bb0\u5f55 dbname\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t <em class=\"replaceable\"><code>target</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--target=<em class=\"replaceable\"><code>target</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u793a\u670d\u52a1\u5668\u5c06\u57fa\u7840\u5907\u4efd\u653e\u5230\u54ea\u91cc\u3002\u9ed8\u8ba4\u76ee\u6807\u662f<code class=\"literal\">client</code>\uff0c\u8868\u793a\u5907\u4efd\u5e94\u53d1\u9001\u5230\u8fd0\u884c<span class=\"application\">pg_basebackup</span>\u7684\u90a3\u53f0\u673a\u5668\u3002\u5982\u679c\u76ee\u6807\u6539\u4e3a<code class=\"literal\">server:/some/path</code>\uff0c\u5219\u5907\u4efd\u4f1a\u5b58\u50a8\u5728\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684<code class=\"literal\">/some/path</code>\u76ee\u5f55\u4e2d\u3002\u5c06\u5907\u4efd\u5b58\u50a8\u5728\u670d\u52a1\u5668\u4e0a\u9700\u8981\u8d85\u7ea7\u7528\u6237\u6743\u9650\uff0c\u6216\u62e5\u6709<code class=\"literal\">pg_write_server_files</code>\u89d2\u8272\u7684\u6743\u9650\u3002\u5982\u679c\u76ee\u6807\u8bbe\u7f6e\u4e3a<code class=\"literal\">blackhole</code>\uff0c\u5219\u5185\u5bb9\u4f1a\u88ab\u4e22\u5f03\uff0c\u4e0d\u4f1a\u5b58\u50a8\u5230\u4efb\u4f55\u5730\u65b9\u3002\u8fd9\u53ea\u5e94\u7528\u4e8e\u6d4b\u8bd5\u76ee\u7684\uff0c\u56e0\u4e3a\u6700\u7ec8\u4e0d\u4f1a\u5f97\u5230\u5b9e\u9645\u5907\u4efd\u3002</p>\n<p lang=\"zh\">\u7531\u4e8e WAL \u6d41\u5f0f\u4f20\u8f93\u662f\u7531<span class=\"application\">pg_basebackup</span>\u800c\u4e0d\u662f\u670d\u52a1\u5668\u5b9e\u73b0\u7684\uff0c\u56e0\u6b64\u6b64\u9009\u9879\u4e0d\u80fd\u4e0e<code class=\"literal\">-Xstream</code>\u4e00\u8d77\u4f7f\u7528\u3002\u7531\u4e8e\u540e\u8005\u662f\u9ed8\u8ba4\u503c\uff0c\u6240\u4ee5\u6307\u5b9a\u6b64\u9009\u9879\u65f6\uff0c\u8fd8\u5fc5\u987b\u540c\u65f6\u6307\u5b9a<code class=\"literal\">-Xfetch</code>\u6216<code class=\"literal\">-Xnone</code>\u4e4b\u4e00\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>olddir</code></em>=<em class=\"replaceable\"><code>newdir</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--tablespace-mapping=<em class=\"replaceable\"><code>olddir</code></em>=<em class=\"replaceable\"><code>newdir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u671f\u95f4\uff0c\u5c06\u76ee\u5f55<em class=\"replaceable\"><code>olddir</code></em>\u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230<em class=\"replaceable\"><code>newdir</code></em>\u3002\u8981\u4f7f\u6b64\u9009\u9879\u751f\u6548\uff0c<em class=\"replaceable\"><code>olddir</code></em>\u5fc5\u987b\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u5b9a\u4e49\u7684\u8be5\u8868\u7a7a\u95f4\u8def\u5f84\u5b8c\u5168\u4e00\u81f4\u3002\uff08\u4f46\u5982\u679c\u6e90\u670d\u52a1\u5668\u4e0a\u5728<em class=\"replaceable\"><code>olddir</code></em>\u4e2d\u6ca1\u6709\u8868\u7a7a\u95f4\uff0c\u4e5f\u4e0d\u7b97\u9519\u8bef\u3002\uff09\u4e0e\u6b64\u540c\u65f6\uff0c<em class=\"replaceable\"><code>newdir</code></em>\u662f\u63a5\u6536\u4e3b\u673a\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u4e00\u4e2a\u76ee\u5f55\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c<em class=\"replaceable\"><code>newdir</code></em>\u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002<em class=\"replaceable\"><code>olddir</code></em>\u548c<em class=\"replaceable\"><code>newdir</code></em>\u90fd\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u5982\u679c\u4efb\u4e00\u8def\u5f84\u4e2d\u9700\u8981\u5305\u542b\u7b49\u53f7\uff08<code class=\"literal\">=</code>\uff09\uff0c\u8bf7\u5728\u5176\u524d\u9762\u52a0\u4e0a\u53cd\u659c\u6760\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u4ee5\u5904\u7406\u591a\u4e2a\u8868\u7a7a\u95f4\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u91cd\u5b9a\u4f4d\u8868\u7a7a\u95f4\uff0c\u4e3b\u6570\u636e\u76ee\u5f55\u4e2d\u7684\u7b26\u53f7\u94fe\u63a5\u5c06\u88ab\u66f4\u65b0\u4e3a\u6307\u5411\u65b0\u4f4d\u7f6e\u3002\u56e0\u6b64\uff0c\u65b0\u6570\u636e\u76ee\u5f55\u5df2\u53ef\u76f4\u63a5\u7528\u4e8e\u542f\u52a8\u4e00\u4e2a\u6240\u6709\u8868\u7a7a\u95f4\u90fd\u4f4d\u4e8e\u66f4\u65b0\u540e\u4f4d\u7f6e\u7684\u65b0\u670d\u52a1\u5668\u5b9e\u4f8b\u3002</p>\n<p lang=\"zh\">\u76ee\u524d\uff0c\u6b64\u9009\u9879\u4ec5\u9002\u7528\u4e8e\u666e\u901a\u6587\u4ef6\u8f93\u51fa\u683c\u5f0f\uff1b\u5982\u679c\u9009\u62e9\u4e86 tar \u683c\u5f0f\uff0c\u5219\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--waldir=<em class=\"replaceable\"><code>waldir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5199\u5165 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cWAL \u6587\u4ef6\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u7684<code class=\"filename\">pg_wal</code>\u5b50\u76ee\u5f55\u4e2d\uff0c\u4f46\u6b64\u9009\u9879\u53ef\u7528\u4e8e\u5c06\u5176\u653e\u5728\u5176\u4ed6\u4f4d\u7f6e\u3002<em class=\"replaceable\"><code>waldir</code></em>\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c<em class=\"replaceable\"><code>waldir</code></em>\u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002\u53ea\u6709\u5f53\u5907\u4efd\u91c7\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u624d\u80fd\u6307\u5b9a\u6b64\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-X <em class=\"replaceable\"><code>method</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--wal-method=<em class=\"replaceable\"><code>method</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u4e2d\u5305\u542b\u6240\u9700\u7684 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u3002\u8fd9\u5c06\u5305\u62ec\u5907\u4efd\u671f\u95f4\u751f\u6210\u7684\u6240\u6709\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u9664\u975e\u6307\u5b9a\u65b9\u6cd5<code class=\"literal\">none</code>\uff0c\u5426\u5219\u5c31\u53ef\u4ee5\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u542f\u52a8 postmaster\uff0c\u800c\u65e0\u9700\u67e5\u9605 WAL \u5f52\u6863\uff0c\u4ece\u800c\u4f7f\u8f93\u51fa\u6210\u4e3a\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u5907\u4efd\u3002</p>\n<p lang=\"zh\">\u652f\u6301\u4ee5\u4e0b\u7528\u4e8e\u6536\u96c6\u9884\u5199\u5f0f\u65e5\u5fd7\u7684<em class=\"replaceable\"><code>method</code></em>\u503c\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">n</code><br/></span><span class=\"term\"><code class=\"literal\">none</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u5728\u5907\u4efd\u4e2d\u5305\u542b\u9884\u5199\u5f0f\u65e5\u5fd7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">f</code><br/></span><span class=\"term\"><code class=\"literal\">fetch</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u7ed3\u675f\u65f6\u6536\u96c6\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u3002\u56e0\u6b64\uff0c\u6e90\u670d\u52a1\u5668\u7684<a class=\"xref\" href=\"/docs/18/runtime-config-replication.html#GUC-WAL-KEEP-SIZE\">wal_keep_size</a>\u53c2\u6570\u5fc5\u987b\u8bbe\u7f6e\u5f97\u8db3\u591f\u9ad8\uff0c\u4ee5\u786e\u4fdd\u5728\u5907\u4efd\u7ed3\u675f\u524d\u4e0d\u4f1a\u79fb\u9664\u6240\u9700\u7684\u65e5\u5fd7\u6570\u636e\u3002\u5982\u679c\u5728\u4f20\u8f93\u8fd9\u4e9b\u6570\u636e\u4e4b\u524d\u5b83\u4eec\u5df2\u7ecf\u88ab\u56de\u6536\uff0c\u5219\u5907\u4efd\u4f1a\u5931\u8d25\u5e76\u4e14\u65e0\u6cd5\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u4f1a\u5305\u542b\u5728<code class=\"filename\">base.tar</code>\u6587\u4ef6\u4e2d\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">s</code><br/></span><span class=\"term\"><code class=\"literal\">stream</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u6267\u884c\u5907\u4efd\u7684\u540c\u65f6\u6d41\u5f0f\u4f20\u8f93\u9884\u5199\u5f0f\u65e5\u5fd7\u6570\u636e\u3002\u6b64\u65b9\u6cd5\u4f1a\u5411\u670d\u52a1\u5668\u6253\u5f00\u7b2c\u4e8c\u4e2a\u8fde\u63a5\uff0c\u5e76\u5728\u6267\u884c\u5907\u4efd\u65f6\u5e76\u884c\u5f00\u59cb\u6d41\u5f0f\u4f20\u8f93\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u56e0\u6b64\uff0c\u5b83\u9700\u8981\u4e24\u4e2a\u590d\u5236\u8fde\u63a5\uff0c\u800c\u4e0d\u53ea\u662f\u4e00\u4e2a\u3002\u53ea\u8981\u5ba2\u6237\u7aef\u80fd\u591f\u8ddf\u4e0a\u9884\u5199\u5f0f\u65e5\u5fd7\u6570\u636e\uff0c\u4f7f\u7528\u6b64\u65b9\u6cd5\u5c31\u4e0d\u9700\u8981\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u989d\u5916\u4fdd\u7559\u9884\u5199\u5f0f\u65e5\u5fd7\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u4f1a\u5199\u5165\u4e00\u4e2a\u540d\u4e3a<code class=\"filename\">pg_wal.tar</code>\u7684\u72ec\u7acb\u6587\u4ef6\u4e2d\uff08\u5982\u679c\u670d\u52a1\u5668\u7248\u672c\u65e9\u4e8e 10\uff0c\u5219\u6587\u4ef6\u540d\u4e3a<code class=\"filename\">pg_xlog.tar</code>\uff09\u3002</p>\n<p lang=\"zh\">\u8fd9\u662f\u9ed8\u8ba4\u503c\u3002</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-z</code><br/></span><span class=\"term\"><code class=\"option\">--gzip</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u4f7f\u7528\u9ed8\u8ba4\u538b\u7f29\u7ea7\u522b\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0<code class=\"filename\">.gz</code>\u540e\u7f00\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-Z <em class=\"replaceable\"><code>level</code></em></code><br/></span><span class=\"term\"><code class=\"option\">-Z [{client|server}-]<em class=\"replaceable\"><code>method</code></em>[:<em class=\"replaceable\"><code>detail</code></em>]</code><br/></span><span class=\"term\"><code class=\"option\">--compress=<em class=\"replaceable\"><code>level</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--compress=[{client|server}-]<em class=\"replaceable\"><code>method</code></em>[:<em class=\"replaceable\"><code>detail</code></em>]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bf7\u6c42\u5bf9\u5907\u4efd\u8fdb\u884c\u538b\u7f29\u3002\u5982\u679c\u5305\u542b<code class=\"literal\">client</code>\u6216<code class=\"literal\">server</code>\uff0c\u5219\u6307\u5b9a\u538b\u7f29\u6267\u884c\u7684\u4f4d\u7f6e\u3002\u5728\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4f1a\u51cf\u5c11\u4f20\u8f93\u5e26\u5bbd\u5360\u7528\uff0c\u4f46\u4f1a\u589e\u52a0\u670d\u52a1\u5668 CPU \u6d88\u8017\u3002\u9ed8\u8ba4\u503c\u662f<code class=\"literal\">client</code>\uff0c\u4f46\u4f7f\u7528<code class=\"literal\">--target</code>\u65f6\u9664\u5916\uff1b\u6b64\u65f6\u5907\u4efd\u4e0d\u4f1a\u53d1\u9001\u5230\u5ba2\u6237\u7aef\uff0c\u56e0\u6b64\u53ea\u6709\u670d\u52a1\u5668\u7aef\u538b\u7f29\u624d\u6709\u610f\u4e49\u3002\u4f7f\u7528\u9ed8\u8ba4\u7684<code class=\"literal\">-Xstream</code>\u65f6\uff0c\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4e0d\u4f1a\u5e94\u7528\u4e8e WAL\u3002\u82e5\u8981\u538b\u7f29 WAL\uff0c\u8bf7\u4f7f\u7528\u5ba2\u6237\u7aef\u538b\u7f29\uff0c\u6216\u8005\u6307\u5b9a<code class=\"literal\">-Xfetch</code>\u3002</p>\n<p lang=\"zh\">\u538b\u7f29\u65b9\u6cd5\u53ef\u4ee5\u8bbe\u7f6e\u4e3a<code class=\"literal\">gzip</code>\u3001<code class=\"literal\">lz4</code>\u3001<code class=\"literal\">zstd</code>\u3001<code class=\"literal\">none</code>\uff08\u4e0d\u538b\u7f29\uff09\uff0c\u4e5f\u53ef\u4ee5\u76f4\u63a5\u6307\u5b9a\u4e00\u4e2a\u6574\u6570\uff080 \u8868\u793a\u4e0d\u538b\u7f29\uff0c\u5927\u4e8e 0 \u8868\u793a<code class=\"literal\">gzip</code>\uff09\u3002\u8fd8\u53ef\u4ee5\u9009\u62e9\u6027\u5730\u6307\u5b9a\u538b\u7f29\u7ec6\u8282\u5b57\u7b26\u4e32\u3002\u5982\u679c\u7ec6\u8282\u5b57\u7b26\u4e32\u662f\u6574\u6570\uff0c\u5219\u8868\u793a\u538b\u7f29\u7ea7\u522b\uff1b\u5426\u5219\uff0c\u5b83\u5e94\u4e3a\u9017\u53f7\u5206\u9694\u7684\u9879\u76ee\u5217\u8868\uff0c\u6bcf\u9879\u7684\u5f62\u5f0f\u4e3a<em class=\"replaceable\"><code>keyword</code></em>\u6216<em class=\"replaceable\"><code>keyword=value</code></em>\u3002\u76ee\u524d\u652f\u6301\u7684\u5173\u952e\u5b57\u6709<code class=\"literal\">level</code>\u3001<code class=\"literal\">long</code>\u548c<code class=\"literal\">workers</code>\u3002\u5f53\u538b\u7f29\u65b9\u6cd5\u4ee5\u7eaf\u6574\u6570\u5f62\u5f0f\u6307\u5b9a\u65f6\uff0c\u4e0d\u80fd\u518d\u4f7f\u7528\u7ec6\u8282\u5b57\u7b26\u4e32\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u538b\u7f29\u7ea7\u522b\uff0c\u5c06\u4f7f\u7528\u9ed8\u8ba4\u7ea7\u522b\u3002\u5982\u679c\u53ea\u6307\u5b9a\u7ea7\u522b\u800c\u672a\u6307\u5b9a\u7b97\u6cd5\uff0c\u5219\u7ea7\u522b\u5927\u4e8e 0 \u65f6\u4f7f\u7528 gzip \u538b\u7f29\uff0c\u7ea7\u522b\u4e3a 0 \u65f6\u4e0d\u538b\u7f29\u3002</p>\n<p lang=\"zh\">\u5f53 tar \u683c\u5f0f\u914d\u5408<code class=\"literal\">gzip</code>\u3001<code class=\"literal\">lz4</code>\u6216<code class=\"literal\">zstd</code>\u4f7f\u7528\u65f6\uff0c\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u5206\u522b\u81ea\u52a8\u52a0\u4e0a<code class=\"filename\">.gz</code>\u3001<code class=\"filename\">.lz4</code>\u6216<code class=\"filename\">.zst</code>\u540e\u7f00\u3002\u4f7f\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u4e0d\u80fd\u6307\u5b9a\u5ba2\u6237\u7aef\u538b\u7f29\uff0c\u4f46\u4ecd\u53ef\u4ee5\u8bf7\u6c42\u670d\u52a1\u5668\u7aef\u538b\u7f29\u3002\u8fd9\u6837\u505a\u65f6\uff0c\u670d\u52a1\u5668\u4f1a\u5148\u538b\u7f29\u5907\u4efd\u518d\u4f20\u8f93\uff0c\u800c\u5ba2\u6237\u7aef\u4f1a\u5bf9\u5176\u8fdb\u884c\u89e3\u538b\u5e76\u63d0\u53d6\u3002</p>\n<p lang=\"zh\">\u5f53\u6b64\u9009\u9879\u4e0e<code class=\"literal\">-Xstream</code>\u7ec4\u5408\u4f7f\u7528\u65f6\uff0c\u5982\u679c\u9009\u62e9\u4e86\u5ba2\u6237\u7aef gzip \u538b\u7f29\uff0c\u5219<code class=\"literal\">pg_wal.tar</code>\u4f1a\u4f7f\u7528<code class=\"literal\">gzip</code>\u538b\u7f29\uff1b\u4f46\u5982\u679c\u9009\u62e9\u4e86\u5176\u4ed6\u538b\u7f29\u7b97\u6cd5\uff0c\u6216\u8005\u9009\u62e9\u4e86\u670d\u52a1\u5668\u7aef\u538b\u7f29\uff0c\u5219\u4e0d\u4f1a\u88ab\u538b\u7f29\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u5907\u4efd\u7684\u751f\u6210\u548c\u7a0b\u5e8f\u7684\u8c03\u7528\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-c {fast|spread}</code><br/></span><span class=\"term\"><code class=\"option\">--checkpoint={fast|spread}</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u68c0\u67e5\u70b9\u6a21\u5f0f\u8bbe\u7f6e\u4e3a fast\uff08\u7acb\u5373\uff09\u6216 spread\uff08\u9ed8\u8ba4\uff09\uff08\u89c1<a class=\"xref\" href=\"/docs/18/continuous-archiving.html#BACKUP-LOWLEVEL-BASE-BACKUP\" title=\"25.3.4.\u00a0\u4f7f\u7528\u4f4e\u7ea7 API \u8fdb\u884c\u57fa\u7840\u5907\u4efd\">\u7b2c\u00a025.3.4\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--create-slot</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728\u5f00\u59cb\u5907\u4efd\u4e4b\u524d\uff0c\u5e94\u521b\u5efa\u7531<code class=\"literal\">--slot</code>\u9009\u9879\u6307\u5b9a\u540d\u79f0\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u8be5\u69fd\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u9519\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>label</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--label=<em class=\"replaceable\"><code>label</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5907\u4efd\u6807\u7b7e\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u503c<span class=\"quote\">\u201c<span class=\"quote\"><code class=\"literal\">pg_basebackup base backup</code></span>\u201d</span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-clean</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53<code class=\"command\">pg_basebackup</code>\u56e0\u9519\u8bef\u4e2d\u6b62\u65f6\uff0c\u5b83\u4f1a\u5220\u9664\u5728\u53d1\u73b0\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u76ee\u5f55\uff08\u4f8b\u5982\u76ee\u6807\u76ee\u5f55\u548c\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\uff09\u3002\u6b64\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u5f88\u6709\u5e2e\u52a9\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u65e0\u8bba\u662f\u5426\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u8868\u7a7a\u95f4\u76ee\u5f55\u90fd\u4e0d\u4f1a\u88ab\u6e05\u7406\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N</code><br/></span><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">pg_basebackup</code>\u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u88ab\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f1a\u4f7f<code class=\"command\">pg_basebackup</code>\u4e0d\u7ecf\u7b49\u5f85\u5c31\u76f4\u63a5\u8fd4\u56de\uff0c\u56e0\u6b64\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u968f\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u57fa\u7840\u5907\u4efd\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u5408\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P</code><br/></span><span class=\"term\"><code class=\"option\">--progress</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528\u8fdb\u5ea6\u62a5\u544a\u3002\u6253\u5f00\u6b64\u9009\u9879\u540e\uff0c\u4f1a\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u7ed9\u51fa\u4e00\u4e2a\u8fd1\u4f3c\u7684\u8fdb\u5ea6\u62a5\u544a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u53d1\u751f\u53d8\u5316\uff0c\u56e0\u6b64\u8fd9\u53ea\u662f\u8fd1\u4f3c\u503c\uff0c\u6700\u7ec8\u672a\u5fc5\u6070\u597d\u7ed3\u675f\u5728<code class=\"literal\">100%</code>\u3002\u7279\u522b\u662f\u5f53\u5907\u4efd\u4e2d\u5305\u542b WAL \u65f6\uff0c\u603b\u6570\u636e\u91cf\u65e0\u6cd5\u9884\u5148\u4f30\u8ba1\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u65e6\u8fdb\u5ea6\u8d85\u8fc7\u4e0d\u542b WAL \u65f6\u7684\u603b\u4f30\u8ba1\u503c\uff0c\u4f30\u8ba1\u76ee\u6807\u5927\u5c0f\u5c31\u4f1a\u7ee7\u7eed\u589e\u52a0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r <em class=\"replaceable\"><code>rate</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--max-rate=<em class=\"replaceable\"><code>rate</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u4ece\u6e90\u670d\u52a1\u5668\u6536\u96c6\u6570\u636e\u65f6\u5141\u8bb8\u7684\u6700\u5927\u4f20\u8f93\u901f\u7387\u3002\u8fd9\u6709\u52a9\u4e8e\u9650\u5236<span class=\"application\">pg_basebackup</span>\u5bf9\u670d\u52a1\u5668\u7684\u5f71\u54cd\u3002\u53d6\u503c\u5355\u4f4d\u4e3a\u6bcf\u79d2\u5343\u5b57\u8282\u3002\u4f7f\u7528\u540e\u7f00<code class=\"literal\">M</code>\u8868\u793a\u6bcf\u79d2\u5146\u5b57\u8282\u3002\u4e5f\u63a5\u53d7\u540e\u7f00<code class=\"literal\">k</code>\uff0c\u4f46\u6ca1\u6709\u5b9e\u9645\u5f71\u54cd\u3002\u6709\u6548\u53d6\u503c\u8303\u56f4\u4e3a\u6bcf\u79d2 32 \u5343\u5b57\u8282\u5230\u6bcf\u79d2 1024 \u5146\u5b57\u8282\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u59cb\u7ec8\u5f71\u54cd\u6570\u636e\u76ee\u5f55\u7684\u4f20\u8f93\u3002\u53ea\u6709\u5f53\u6536\u96c6\u65b9\u6cd5\u4e3a<code class=\"literal\">fetch</code>\u65f6\uff0cWAL \u6587\u4ef6\u7684\u4f20\u8f93\u624d\u4f1a\u53d7\u5230\u5f71\u54cd\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>slotname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--slot=<em class=\"replaceable\"><code>slotname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u53ea\u80fd\u4e0e<code class=\"literal\">-X stream</code>\u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u4f1a\u4f7f WAL \u6d41\u5f0f\u4f20\u8f93\u4f7f\u7528\u6307\u5b9a\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u6b64\u57fa\u7840\u5907\u4efd\u6253\u7b97\u7528\u4f5c\u4f7f\u7528\u590d\u5236\u69fd\u7684\u6d41\u590d\u5236\u5907\u5e93\uff0c\u90a3\u4e48\u8be5\u5907\u5e93\u5e94\u5c06\u540c\u4e00\u4e2a\u590d\u5236\u69fd\u540d\u79f0\u7528\u4f5c<a class=\"xref\" href=\"/docs/18/runtime-config-replication.html#GUC-PRIMARY-SLOT-NAME\">primary_slot_name</a>\u7684\u503c\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u4e3b\u5e93\u5728\u57fa\u7840\u5907\u4efd\u7ed3\u675f\u4e0e\u65b0\u5907\u5e93\u5f00\u59cb\u6d41\u590d\u5236\u4e4b\u95f4\u7684\u8fd9\u6bb5\u65f6\u95f4\u5185\uff0c\u4e0d\u4f1a\u79fb\u9664\u4efb\u4f55\u5fc5\u9700\u7684 WAL \u6570\u636e\u3002</p>\n<p lang=\"zh\">\u6307\u5b9a\u7684\u590d\u5236\u69fd\u5fc5\u987b\u5df2\u7ecf\u5b58\u5728\uff0c\u9664\u975e\u8fd8\u540c\u65f6\u4f7f\u7528\u4e86<code class=\"option\">-C</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5e76\u4e14\u670d\u52a1\u5668\u652f\u6301\u4e34\u65f6\u590d\u5236\u69fd\uff0810 \u53ca\u4ee5\u4e0a\u7248\u672c\uff09\uff0c\u5219\u4f1a\u81ea\u52a8\u4f7f\u7528\u4e34\u65f6\u590d\u5236\u69fd\u8fdb\u884c WAL \u6d41\u5f0f\u4f20\u8f93\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--sync-method=<em class=\"replaceable\"><code>method</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u4e3a<code class=\"literal\">fsync</code>\uff08\u9ed8\u8ba4\uff09\u65f6\uff0c<code class=\"command\">pg_basebackup</code>\u4f1a\u9012\u5f52\u6253\u5f00\u5e76\u540c\u6b65\u5907\u4efd\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3002\u4f7f\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u67e5\u627e\u6587\u4ef6\u4f1a\u8ddf\u968f WAL \u76ee\u5f55\u548c\u5404\u5df2\u914d\u7f6e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u3002</p>\n<p lang=\"zh\">\u5728 Linux \u4e0a\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528<code class=\"literal\">syncfs</code>\uff0c\u8ba9\u64cd\u4f5c\u7cfb\u7edf\u540c\u6b65\u5305\u542b\u5907\u4efd\u76ee\u5f55\u7684\u6574\u4e2a\u6587\u4ef6\u7cfb\u7edf\u3002\u4f7f\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c<code class=\"command\">pg_basebackup</code>\u8fd8\u4f1a\u540c\u6b65\u5305\u542b WAL \u6587\u4ef6\u548c\u5404\u8868\u7a7a\u95f4\u7684\u6587\u4ef6\u7cfb\u7edf\u3002\u5173\u4e8e\u4f7f\u7528<code class=\"literal\">syncfs</code>\u65f6\u9700\u8981\u6ce8\u610f\u7684\u4e8b\u9879\uff0c\u89c1<a class=\"xref\" href=\"/docs/18/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\">recovery_init_sync_method</a>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--no-sync</code>\u65f6\uff0c\u6b64\u9009\u9879\u65e0\u6548\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\u3002\u5b83\u4f1a\u5728\u542f\u52a8\u548c\u5173\u95ed\u8fc7\u7a0b\u4e2d\u8f93\u51fa\u4e00\u4e9b\u989d\u5916\u6b65\u9aa4\uff1b\u5982\u679c\u540c\u65f6\u542f\u7528\u4e86\u8fdb\u5ea6\u62a5\u544a\uff0c\u8fd8\u4f1a\u663e\u793a\u5f53\u524d\u6b63\u5728\u5904\u7406\u7684\u786e\u5207\u6587\u4ef6\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--manifest-checksums=<em class=\"replaceable\"><code>algorithm</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u5e94\u7528\u5230\u5907\u4efd\u6e05\u5355\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u7684\u6821\u9a8c\u548c\u7b97\u6cd5\u3002\u76ee\u524d\u53ef\u7528\u7684\u7b97\u6cd5\u6709<code class=\"literal\">NONE</code>\u3001<code class=\"literal\">CRC32C</code>\u3001<code class=\"literal\">SHA224</code>\u3001<code class=\"literal\">SHA256</code>\u3001<code class=\"literal\">SHA384</code>\u548c<code class=\"literal\">SHA512</code>\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">CRC32C</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">NONE</code>\uff0c\u5907\u4efd\u6e05\u5355\u5c06\u4e0d\u5305\u542b\u4efb\u4f55\u6821\u9a8c\u548c\u3002\u5426\u5219\uff0c\u5b83\u5c06\u5305\u542b\u4f7f\u7528\u6307\u5b9a\u7b97\u6cd5\u4e3a\u5907\u4efd\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u8ba1\u7b97\u7684\u6821\u9a8c\u548c\u3002\u6b64\u5916\uff0c\u6e05\u5355\u59cb\u7ec8\u4f1a\u5305\u542b\u5176\u81ea\u8eab\u5185\u5bb9\u7684<code class=\"literal\">SHA256</code>\u6821\u9a8c\u548c\u3002<code class=\"literal\">SHA</code>\u7b97\u6cd5\u660e\u663e\u6bd4<code class=\"literal\">CRC32C</code>\u66f4\u8017\u8d39 CPU\uff0c\u56e0\u6b64\u9009\u62e9\u5176\u4e2d\u4e00\u79cd\u53ef\u80fd\u4f1a\u589e\u52a0\u5b8c\u6210\u5907\u4efd\u6240\u9700\u7684\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u5e0c\u671b\u9a8c\u8bc1\u5907\u4efd\u672a\u88ab\u7be1\u6539\u7684\u7528\u6237\uff0c\u4f7f\u7528 SHA hash \u51fd\u6570\u53ef\u4ee5\u4e3a\u6bcf\u4e2a\u6587\u4ef6\u63d0\u4f9b\u5177\u6709\u5bc6\u7801\u5b66\u5b89\u5168\u6027\u7684\u6458\u8981\uff1b\u800c CRC-32C \u7b97\u6cd5\u63d0\u4f9b\u7684\u6821\u9a8c\u548c\u8ba1\u7b97\u901f\u5ea6\u8981\u5feb\u5f97\u591a\uff0c\u867d\u7136\u5b83\u5f88\u9002\u5408\u53d1\u73b0\u7531\u4e8e\u610f\u5916\u6539\u52a8\u9020\u6210\u7684\u9519\u8bef\uff0c\u4f46\u5e76\u4e0d\u80fd\u62b5\u5fa1\u6076\u610f\u4fee\u6539\u3002\u8bf7\u6ce8\u610f\uff0c\u8981\u60f3\u5bf9\u80fd\u591f\u8bbf\u95ee\u5907\u4efd\u7684\u653b\u51fb\u8005\u5f62\u6210\u9632\u62a4\uff0c\u5907\u4efd\u6e05\u5355\u5c31\u9700\u8981\u5b89\u5168\u5730\u4fdd\u5b58\u5728\u5176\u4ed6\u5730\u65b9\uff0c\u6216\u8005\u4ee5\u5176\u4ed6\u65b9\u5f0f\u786e\u8ba4\u81ea\u5907\u4efd\u5b8c\u6210\u540e\u672a\u88ab\u4fee\u6539\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528<a class=\"xref\" href=\"/docs/18/app-pgverifybackup.html\" title=\"pg_verifybackup\"><span class=\"refentrytitle\"><span class=\"application\">pg_verifybackup</span></span></a>\u6839\u636e\u5907\u4efd\u6e05\u5355\u68c0\u67e5\u5907\u4efd\u7684\u5b8c\u6574\u6027\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--manifest-force-encode</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f3a\u5236\u5c06\u5907\u4efd\u6e05\u5355\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u540d\u7f16\u7801\u4e3a\u5341\u516d\u8fdb\u5236\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u5bf9\u975e UTF8 \u6587\u4ef6\u540d\u8fdb\u884c\u5341\u516d\u8fdb\u5236\u7f16\u7801\u3002\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u8bfb\u53d6\u5907\u4efd\u6e05\u5355\u6587\u4ef6\u7684\u5de5\u5177\u662f\u5426\u80fd\u6b63\u786e\u5904\u7406\u8fd9\u79cd\u60c5\u51b5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-estimate-size</code></span></dt>\n<dd>\n<p lang=\"zh\">\u7981\u6b62\u670d\u52a1\u5668\u4f30\u7b97\u5c06\u8981\u6d41\u5f0f\u4f20\u8f93\u7684\u5907\u4efd\u6570\u636e\u603b\u91cf\uff0c\u56e0\u6b64 pg_stat_progress_basebackup \u89c6\u56fe\u4e2d\u7684 backup_total \u5217\u59cb\u7ec8\u4e3a NULL\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5907\u4efd\u4f1a\u5148\u679a\u4e3e\u6574\u4e2a\u6570\u636e\u5e93\u7684\u5927\u5c0f\uff0c\u7136\u540e\u518d\u56de\u8fc7\u5934\u6765\u53d1\u9001\u5b9e\u9645\u5185\u5bb9\u3002\u8fd9\u53ef\u80fd\u4f1a\u8ba9\u5907\u4efd\u8017\u65f6\u7565\u957f\uff0c\u7279\u522b\u662f\u5728\u53d1\u9001\u7b2c\u4e00\u6279\u6570\u636e\u4e4b\u524d\u6240\u9700\u65f6\u95f4\u4f1a\u66f4\u4e45\u3002\u5982\u679c\u8fd9\u79cd\u4f30\u7b97\u8017\u65f6\u8fc7\u957f\uff0c\u6b64\u9009\u9879\u5c31\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u5b83\u53ef\u4ee5\u907f\u514d\u8fd9\u6bb5\u4f30\u7b97\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--progress</code>\u65f6\uff0c\u4e0d\u5141\u8bb8\u4f7f\u7528\u6b64\u9009\u9879\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-manifest</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7981\u6b62\u751f\u6210\u5907\u4efd\u6e05\u5355\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u670d\u52a1\u5668\u5c06\u751f\u6210\u5e76\u53d1\u9001\u4e00\u4e2a\u5907\u4efd\u6e05\u5355\uff0c\u53ef\u4f7f\u7528<a class=\"xref\" href=\"/docs/18/app-pgverifybackup.html\" title=\"pg_verifybackup\"><span class=\"refentrytitle\"><span class=\"application\">pg_verifybackup</span></span></a>\u8fdb\u884c\u9a8c\u8bc1\u3002\u8be5\u6e05\u5355\u5217\u51fa\u4e86\u5907\u4efd\u4e2d\u7684\u6bcf\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u4e0d\u5305\u62ec\u53ef\u80fd\u5305\u542b\u5728\u5176\u4e2d\u7684\u4efb\u4f55 WAL \u6587\u4ef6\u3002\u5b83\u8fd8\u4f1a\u4fdd\u5b58\u6bcf\u4e2a\u6587\u4ef6\u7684\u5927\u5c0f\u3001\u6700\u540e\u4fee\u6539\u65f6\u95f4\u4ee5\u53ca\u53ef\u9009\u7684\u6821\u9a8c\u548c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-slot</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9632\u6b62\u4e3a\u5907\u4efd\u521b\u5efa\u4e34\u65f6\u590d\u5236\u69fd\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u9009\u62e9\u4e86 WAL \u6d41\u5f0f\u4f20\u8f93\uff0c\u4f46\u6ca1\u6709\u4f7f\u7528<code class=\"option\">-S</code>\u9009\u9879\u7ed9\u51fa\u69fd\u540d\uff0c\u90a3\u4e48\u4f1a\u521b\u5efa\u4e00\u4e2a\u4e34\u65f6\u590d\u5236\u69fd\uff08\u5982\u679c\u6e90\u670d\u52a1\u5668\u652f\u6301\uff09\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7684\u4e3b\u8981\u76ee\u7684\u662f\u5728\u670d\u52a1\u5668\u6ca1\u6709\u7a7a\u95f2\u590d\u5236\u69fd\u65f6\uff0c\u4ecd\u7136\u5141\u8bb8\u6267\u884c\u57fa\u7840\u5907\u4efd\u3002\u51e0\u4e4e\u603b\u662f\u9996\u9009\u4f7f\u7528\u590d\u5236\u69fd\uff0c\u56e0\u4e3a\u5b83\u80fd\u9632\u6b62\u670d\u52a1\u5668\u5728\u5907\u4efd\u671f\u95f4\u79fb\u9664\u6240\u9700\u7684 WAL\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-verify-checksums</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u83b7\u53d6\u57fa\u7840\u5907\u4efd\u7684\u670d\u52a1\u5668\u542f\u7528\u4e86\u6821\u9a8c\u548c\uff0c\u5219\u7981\u7528\u5bf9\u8fd9\u4e9b\u6821\u9a8c\u548c\u7684\u9a8c\u8bc1\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f1a\u9a8c\u8bc1\u6821\u9a8c\u548c\uff1b\u6821\u9a8c\u548c\u9a8c\u8bc1\u5931\u8d25\u5c06\u5bfc\u81f4\u975e\u96f6\u9000\u51fa\u72b6\u6001\u3002\u4e0d\u8fc7\uff0c\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u57fa\u7840\u5907\u4efd\u4e0d\u4f1a\u88ab\u5220\u9664\uff0c\u5c31\u50cf\u4f7f\u7528\u4e86<code class=\"option\">--no-clean</code>\u4e00\u6837\u3002\u6821\u9a8c\u548c\u9a8c\u8bc1\u5931\u8d25\u4e5f\u4f1a\u5728<a class=\"link\" href=\"/docs/18/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW\" title=\"27.2.17.\u00a0pg_stat_database\"><code class=\"structname\">pg_stat_database</code></a>\u89c6\u56fe\u4e2d\u62a5\u544a\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u5230\u6e90\u670d\u52a1\u5668\u7684\u8fde\u63a5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>connstr</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>connstr</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ee5<a class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u7684\u5f62\u5f0f\u6307\u5b9a\u7528\u4e8e\u8fde\u63a5\u670d\u52a1\u5668\u7684\u53c2\u6570\uff1b\u8fd9\u4e9b\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u76f8\u4e92\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u51fa\u4e8e\u4e0e\u5176\u4ed6\u5ba2\u6237\u7aef\u5e94\u7528\u4fdd\u6301\u4e00\u81f4\u7684\u8003\u8651\uff0c\u6b64\u9009\u9879\u540d\u4e3a<code class=\"literal\">--dbname</code>\uff1b\u4f46\u7531\u4e8e<span class=\"application\">pg_basebackup</span>\u5e76\u4e0d\u8fde\u63a5\u5230\u96c6\u7c07\u4e2d\u7684\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u7684\u6570\u636e\u5e93\u540d\u4f1a\u88ab\u670d\u52a1\u5668\u5ffd\u7565\u3002\u4e0d\u8fc7\uff0c\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u63d0\u4f9b\u7684\u6570\u636e\u5e93\u540d\u4f1a\u8986\u76d6\u9ed8\u8ba4\u6570\u636e\u5e93\u540d\uff08<code class=\"literal\">replication</code>\uff09\uff0c\u4ece\u800c\u7528\u4e8e\u5728<code class=\"filename\">~/.pgpass</code>\u4e2d\u67e5\u627e\u590d\u5236\u8fde\u63a5\u7684\u5bc6\u7801\u3002\u7c7b\u4f3c\u5730\uff0c\u8fde\u63a5<span class=\"productname\">PostgreSQL</span>\u65f6\u4f7f\u7528\u7684\u4e2d\u95f4\u4ef6\u6216\u4ee3\u7406\uff0c\u4e5f\u53ef\u80fd\u51fa\u4e8e\u8fde\u63a5\u8def\u7531\u7b49\u76ee\u7684\u4f7f\u7528\u8be5\u540d\u79f0\u3002\u8be5\u6570\u636e\u5e93\u540d\u4e5f\u53ef\u4f9b<a class=\"link\" href=\"/docs/18/logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS-SYNCHRONIZATION\" title=\"47.2.3.\u00a0\u590d\u5236\u69fd\u540c\u6b65\">\u903b\u8f91\u590d\u5236\u69fd\u540c\u6b65</a>\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea<code class=\"envar\">PGHOST</code>\u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff1b\u5426\u5219\u4f1a\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u6240\u4f7f\u7528\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u4f7f\u7528<code class=\"envar\">PGPORT</code>\u73af\u5883\u53d8\u91cf\u4e2d\u7684\u503c\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u786e\u5b9a\u7684\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s <em class=\"replaceable\"><code>interval</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--status-interval=<em class=\"replaceable\"><code>interval</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u53d1\u9001\u56de\u6e90\u670d\u52a1\u5668\u7684\u72b6\u6001\u5305\u4e4b\u95f4\u76f8\u9694\u7684\u79d2\u6570\u3002\u8f83\u5c0f\u7684\u503c\u53ef\u4ee5\u8ba9\u670d\u52a1\u5668\u7aef\u5bf9\u5907\u4efd\u8fdb\u5ea6\u7684\u76d1\u63a7\u66f4\u7cbe\u786e\u3002\u503c\u4e3a\u96f6\u65f6\u4f1a\u5b8c\u5168\u7981\u7528\u5468\u671f\u6027\u72b6\u6001\u66f4\u65b0\uff0c\u4e0d\u8fc7\u5f53\u670d\u52a1\u5668\u8bf7\u6c42\u65f6\u4ecd\u4f1a\u53d1\u9001\u66f4\u65b0\uff0c\u4ee5\u907f\u514d\u56e0\u8d85\u65f6\u800c\u65ad\u5f00\u8fde\u63a5\u3002\u9ed8\u8ba4\u503c\u662f 10 \u79d2\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7981\u6b62\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\uff08\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff09\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u6b64\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u79cd\u573a\u666f\u4e0b\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236<span class=\"application\">pg_basebackup</span>\u5728\u8fde\u63a5\u6e90\u670d\u52a1\u5668\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7edd\u975e\u5fc5\u9700\uff0c\u56e0\u4e3a\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u81ea\u52a8\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\u6765\u53d1\u73b0\u670d\u52a1\u5668\u9700\u8981\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u8f93\u5165<code class=\"option\">-W</code>\u4ee5\u907f\u514d\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u662f\u503c\u5f97\u7684\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5176\u4ed6\u9009\u9879\u4e5f\u53ef\u7528\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa<span class=\"application\">pg_basebackup</span>\u7684\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"application\">pg_basebackup</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6<span class=\"productname\">PostgreSQL</span>\u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528<span class=\"application\">libpq</span>\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.15\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\">\u73af\u5883\u53d8\u91cf<code class=\"envar\">PG_COLOR</code>\u6307\u5b9a\u662f\u5426\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a<code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c<code class=\"literal\">never</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u5728\u5907\u4efd\u5f00\u59cb\u65f6\uff0c\u9700\u8981\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u6267\u884c\u4e00\u6b21\u68c0\u67e5\u70b9\u3002\u8fd9\u53ef\u80fd\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\uff08\u5c24\u5176\u662f\u5728\u672a\u4f7f\u7528<code class=\"literal\">--checkpoint=fast</code>\u9009\u9879\u65f6\uff09\uff1b\u5728\u6b64\u671f\u95f4\uff0c<span class=\"application\">pg_basebackup</span>\u770b\u8d77\u6765\u4f1a\u5904\u4e8e\u7a7a\u95f2\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u5907\u4efd\u5c06\u5305\u62ec\u6570\u636e\u76ee\u5f55\u548c\u8868\u7a7a\u95f4\u4e2d\u7684\u6240\u6709\u6587\u4ef6\uff0c\u5305\u62ec\u914d\u7f6e\u6587\u4ef6\u4ee5\u53ca\u7b2c\u4e09\u65b9\u653e\u5728\u8fd9\u4e9b\u76ee\u5f55\u4e2d\u7684\u4efb\u4f55\u989d\u5916\u6587\u4ef6\uff0c\u4f46\u7531 PostgreSQL \u7ba1\u7406\u7684\u67d0\u4e9b\u4e34\u65f6\u6587\u4ef6\u548c\u64cd\u4f5c\u7cfb\u7edf\u6587\u4ef6\u9664\u5916\u3002\u4e0d\u8fc7\uff0c\u53ea\u6709\u666e\u901a\u6587\u4ef6\u548c\u76ee\u5f55\u4f1a\u88ab\u590d\u5236\uff0c\u4f46\u7528\u4e8e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u4f1a\u88ab\u4fdd\u7559\u3002\u6307\u5411 PostgreSQL \u5df2\u77e5\u7684\u67d0\u4e9b\u76ee\u5f55\u7684\u7b26\u53f7\u94fe\u63a5\u4f1a\u88ab\u590d\u5236\u4e3a\u7a7a\u76ee\u5f55\u3002\u5176\u4ed6\u7b26\u53f7\u94fe\u63a5\u548c\u7279\u6b8a\u8bbe\u5907\u6587\u4ef6\u5219\u4f1a\u88ab\u8df3\u8fc7\u3002\u5177\u4f53\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/18/protocol-replication.html\" title=\"54.4.\u00a0\u6d41\u590d\u5236\u534f\u8bae\">\u7b2c\u00a054.4\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5728\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u4e2d\uff0c\u9664\u975e\u4f7f\u7528\u4e86<code class=\"literal\">--tablespace-mapping</code>\u9009\u9879\uff0c\u5426\u5219\u8868\u7a7a\u95f4\u4f1a\u5907\u4efd\u5230\u5176\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u7684\u76f8\u540c\u8def\u5f84\u3002\u5982\u679c\u4e0d\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u90a3\u4e48\u5f53\u8868\u7a7a\u95f4\u6b63\u5728\u4f7f\u7528\u65f6\uff0c\u5c31\u65e0\u6cd5\u5728\u4e0e\u670d\u52a1\u5668\u76f8\u540c\u7684\u4e3b\u673a\u4e0a\u6267\u884c\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u7684\u57fa\u7840\u5907\u4efd\uff0c\u56e0\u4e3a\u5907\u4efd\u5c06\u4e0d\u5f97\u4e0d\u5199\u5165\u4e0e\u539f\u59cb\u8868\u7a7a\u95f4\u76f8\u540c\u7684\u76ee\u5f55\u4f4d\u7f6e\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u7528\u6237\u9700\u8981\u5728\u542f\u52a8\u4f7f\u7528\u8fd9\u4e9b\u6570\u636e\u7684 PostgreSQL \u670d\u52a1\u5668\u4e4b\u524d\uff0c\u81ea\u884c\u89e3\u5f00\u6bcf\u4e2a tar \u6587\u4ef6\u3002\u5982\u679c\u5b58\u5728\u989d\u5916\u7684\u8868\u7a7a\u95f4\uff0c\u5fc5\u987b\u5c06\u5bf9\u5e94\u7684 tar \u6587\u4ef6\u89e3\u538b\u5230\u6b63\u786e\u4f4d\u7f6e\u3002\u6b64\u65f6\uff0c\u670d\u52a1\u5668\u4f1a\u6839\u636e base.tar \u4e2d tablespace_map \u6587\u4ef6\u7684\u5185\u5bb9\uff0c\u4e3a\u8fd9\u4e9b\u8868\u7a7a\u95f4\u521b\u5efa\u7b26\u53f7\u94fe\u63a5\u3002</p>\n<p lang=\"zh\">pg_basebackup \u53ef\u4e0e\u76f8\u540c\u6216\u66f4\u65e9\u4e3b\u8981\u7248\u672c\u7684\u670d\u52a1\u5668\u914d\u5408\u4f7f\u7528\uff0c\u6700\u4f4e\u652f\u6301 9.1\u3002\u4e0d\u8fc7\uff0cWAL \u6d41\u5f0f\u4f20\u8f93\u6a21\u5f0f\uff08-X stream\uff09\u53ea\u9002\u7528\u4e8e 9.3 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\uff0ctar \u683c\u5f0f\uff08--format=tar\uff09\u53ea\u9002\u7528\u4e8e 9.5 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\uff0c\u589e\u91cf\u5907\u4efd\uff08--incremental\uff09\u53ea\u9002\u7528\u4e8e 17 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6e90\u96c6\u7c07\u542f\u7528\u4e86\u6570\u636e\u6587\u4ef6\u7684\u7ec4\u6743\u9650\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u4fdd\u7559\u8fd9\u4e9b\u7ec4\u6743\u9650\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.9\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u8981\u4e3a\u670d\u52a1\u5668<code class=\"literal\">mydbserver</code>\u521b\u5efa\u4e00\u4e2a\u57fa\u7840\u5907\u4efd\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5230\u672c\u5730\u76ee\u5f55<code class=\"filename\">/usr/local/pgsql/data</code>\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -h mydbserver -D /usr/local/pgsql/data</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u672c\u5730\u670d\u52a1\u5668\u521b\u5efa\u4e00\u4e2a\u5907\u4efd\uff0c\u4e3a\u6bcf\u4e2a\u8868\u7a7a\u95f4\u5404\u751f\u6210\u4e00\u4e2a\u538b\u7f29\u7684 tar \u6587\u4ef6\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5728\u76ee\u5f55<code class=\"filename\">backup</code>\u4e2d\uff0c\u540c\u65f6\u5728\u8fd0\u884c\u671f\u95f4\u663e\u793a\u8fdb\u5ea6\u62a5\u544a\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup -Ft -z -P</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u4e00\u4e2a\u4ec5\u5305\u542b\u5355\u4e2a\u8868\u7a7a\u95f4\u7684\u672c\u5730\u6570\u636e\u5e93\u521b\u5efa\u5907\u4efd\uff0c\u5e76\u4f7f\u7528<span class=\"productname\">bzip2</span>\u8fdb\u884c\u538b\u7f29\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D - -Ft -X fetch | bzip2 &gt; backup.tar.bz2</code></strong>\n</pre>\n<p lang=\"zh\">\uff08\u5982\u679c\u8be5\u6570\u636e\u5e93\u4e2d\u6709\u591a\u4e2a\u8868\u7a7a\u95f4\uff0c\u6b64\u547d\u4ee4\u5c06\u5931\u8d25\u3002\uff09</p>\n<p lang=\"zh\">\u8981\u521b\u5efa\u4e00\u4e2a\u672c\u5730\u6570\u636e\u5e93\u7684\u5907\u4efd\uff0c\u5e76\u5c06\u4f4d\u4e8e<code class=\"filename\">/opt/ts</code>\u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230<code class=\"filename\">./backup/ts</code>\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup/data -T /opt/ts=$(pwd)/backup/ts</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u672c\u5730\u670d\u52a1\u5668\u521b\u5efa\u4e00\u4e2a\u5907\u4efd\uff0c\u4e3a\u6bcf\u4e2a\u8868\u7a7a\u95f4\u751f\u6210\u4e00\u4e2a tar \u6587\u4ef6\uff0c\u5e76\u4f7f\u7528<span class=\"application\">gzip</span>\u4ee5 9 \u7ea7\u538b\u7f29\u540e\u5b58\u50a8\u5230\u76ee\u5f55<code class=\"filename\">backup</code>\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup -Ft --compress=gzip:9</code></strong>\n</pre>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.10\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/18/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/18/progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING\" title=\"27.4.6.\u00a0Base Backup Progress Reporting\">Section\u00a027.4.6</a></span>\n</div>\n</div></div>", "manual_path": "app-pgbasebackup.html", "localization": {"status": "complete", "sources": [{"url": "/docs/18/app-pgbasebackup.html", "method": "same-major semantic node", "sha256": "a703370a3d669288bd3b7a33c5fb4a2a2dd313310a93c6c7775c108f9e9e0327", "language": "zh", "matched_nodes": ["#APP-PGBASEBACKUP/div[2]/p[1]", "#APP-PGBASEBACKUP/div[3]/h2[0]", "#APP-PGBASEBACKUP/div[4]/div[8]/ul[0]/li[0]", "#APP-PGBASEBACKUP/div[4]/div[8]/ul[0]/li[1]", "#APP-PGBASEBACKUP/div[4]/div[8]/ul[0]/li[2]", "#APP-PGBASEBACKUP/div[4]/div[8]/ul[0]/li[3]", "#APP-PGBASEBACKUP/div[4]/p[1]", "#APP-PGBASEBACKUP/div[4]/p[2]", "#APP-PGBASEBACKUP/div[4]/p[3]", "#APP-PGBASEBACKUP/div[4]/p[4]", "#APP-PGBASEBACKUP/div[4]/p[5]", "#APP-PGBASEBACKUP/div[4]/p[6]", "#APP-PGBASEBACKUP/div[4]/p[7]", "#APP-PGBASEBACKUP/div[4]/p[9]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[3]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[5]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[5]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[17]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[19]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[19]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[19]/p[3]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[19]/p[4]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[3]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[7]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[7]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[17]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[17]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[17]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[19]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[21]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[21]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[21]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[21]/p[3]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[23]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[25]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[25]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[27]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[29]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[29]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[29]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[31]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[31]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[7]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[7]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[7]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[8]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[8]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/p[3]", "#APP-PGBASEBACKUP/div[5]/p[5]", "#APP-PGBASEBACKUP/div[5]/p[7]", "#APP-PGBASEBACKUP/div[6]/h2[0]", "#APP-PGBASEBACKUP/div[6]/p[1]", "#APP-PGBASEBACKUP/div[6]/p[2]", "#APP-PGBASEBACKUP/div[7]/h2[0]", "#APP-PGBASEBACKUP/div[7]/p[1]", "#APP-PGBASEBACKUP/div[7]/p[2]", "#APP-PGBASEBACKUP/div[7]/p[3]", "#APP-PGBASEBACKUP/div[7]/p[6]", "#APP-PGBASEBACKUP/div[8]/h2[0]", "#APP-PGBASEBACKUP/div[8]/p[10]", "#APP-PGBASEBACKUP/div[8]/p[1]", "#APP-PGBASEBACKUP/div[8]/p[3]", "#APP-PGBASEBACKUP/div[8]/p[5]", "#APP-PGBASEBACKUP/div[8]/p[7]", "#APP-PGBASEBACKUP/div[8]/p[8]", "#APP-PGBASEBACKUP/div[9]/h2[0]"]}], "language": "zh", "original_text": {"/versions/18/description/0": "pg_basebackup \u2014 take a base backup of a PostgreSQL cluster", "/versions/18/facts/0/label": "Documented executable", "/versions/18/facts/1/label": "Executable version", "/versions/18/facts/2/label": "Reference inventory", "/versions/18/facts/2/value": "Client applications", "/versions/18/facts/3/label": "Option definition groups", "/versions/18/tables/0/title": "Documented options", "/versions/18/related/0/label": "libpq connection parameters", "/versions/18/tables/0/rows/0/summary": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty.", "/versions/18/tables/0/rows/1/summary": "Selects the format for the output. format can be one of the following:", "/versions/18/tables/0/rows/2/summary": "Performs an incremental backup . The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup.", "/versions/18/tables/0/rows/3/summary": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup.", "/versions/18/tables/0/rows/4/summary": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup.", "/versions/18/tables/0/rows/5/summary": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces.", "/versions/18/tables/0/rows/6/summary": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format.", "/versions/18/tables/0/rows/7/summary": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup.", "/versions/18/tables/0/rows/8/summary": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "/versions/18/tables/0/rows/9/summary": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch .", "/versions/18/tables/0/columns/0/label": "Option and arguments", "/versions/18/tables/0/columns/1/label": "Description", "/versions/18/tables/0/rows/10/summary": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 25.3.4 ).", "/versions/18/tables/0/rows/11/summary": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists.", "/versions/18/tables/0/rows/12/summary": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used.", "/versions/18/tables/0/rows/13/summary": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging.", "/versions/18/tables/0/rows/14/summary": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.", "/versions/18/tables/0/rows/15/summary": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.", "/versions/18/tables/0/rows/16/summary": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second.", "/versions/18/tables/0/rows/17/summary": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby.", "/versions/18/tables/0/rows/18/summary": "When set to fsync , which is the default, pg_basebackup will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace.", "/versions/18/tables/0/rows/19/summary": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.", "/versions/18/tables/0/rows/20/summary": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C .", "/versions/18/tables/0/rows/21/summary": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case.", "/versions/18/tables/0/rows/22/summary": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL .", "/versions/18/tables/0/rows/23/summary": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file.", "/versions/18/tables/0/rows/24/summary": "Prevents the creation of a temporary replication slot for the backup.", "/versions/18/tables/0/rows/25/summary": "Disables verification of checksums, if they are enabled on the server the base backup is taken from.", "/versions/18/tables/0/rows/26/summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "/versions/18/tables/0/rows/27/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "/versions/18/tables/0/rows/28/summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "/versions/18/tables/0/rows/29/summary": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds.", "/versions/18/tables/0/rows/30/summary": "Specifies the user name to connect as.", "/versions/18/tables/0/rows/31/summary": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/18/tables/0/rows/32/summary": "Forces pg_basebackup to prompt for a password before connecting to the source server.", "/versions/18/tables/0/rows/33/summary": "Prints the pg_basebackup version and exits.", "/versions/18/tables/0/rows/34/summary": "Shows help about pg_basebackup command line arguments, and exits."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "55343dccf452f10043bd73c75aa4d1e6dd8d9b76eb29b3ab36a07f131673fa0c"}, "comparison_data": {"options": [{"names": ["-D directory", "--pgdata= directory"], "signature": "-D directory --pgdata= directory", "description": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty. When the backup is in tar format, the target directory may be specified as - (dash), causing the tar file to be written to stdout . This option is required."}, {"names": ["-F format", "--format= format"], "signature": "-F format --format= format", "description": "Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the source server's data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory's contents will be written to a file named base.tar , and each other tablespace will be written to a separate tar file named after that tablespace's OID. If the target directory is specified as - (dash), the tar contents will be written to standard output, suitable for piping to (for example) gzip . This is only allowed if the cluster has no additional tablespaces and WAL streaming is not used."}, {"names": ["-i old_manifest_file", "--incremental= old_manifest_file"], "signature": "-i old_manifest_file --incremental= old_manifest_file", "description": "Performs an incremental backup . The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup."}, {"names": ["-R", "--write-recovery-conf"], "signature": "-R --write-recovery-conf", "description": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup. The postgresql.auto.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that streaming replication and logical replication slot synchronization will use the same settings later on. The dbname will be recorded only if the dbname was specified explicitly in the connection string or environment variable ."}, {"names": ["-t target", "--target= target"], "signature": "-t target --target= target", "description": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup. Since WAL streaming is implemented by pg_basebackup rather than by the server, this option cannot be used together with -Xstream . Since that is the default, when this option is specified, you must also specify either -Xfetch or -Xnone ."}, {"names": ["-T olddir = newdir", "--tablespace-mapping= olddir = newdir"], "signature": "-T olddir = newdir --tablespace-mapping= olddir = newdir", "description": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected."}, {"names": ["--waldir= waldir"], "signature": "--waldir= waldir", "description": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format."}, {"names": ["-X method", "--wal-method= method"], "signature": "-X method --wal-method= method", "description": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup. The following method s for collecting the write-ahead logs are supported: n none Don't include write-ahead logs in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the source server's wal_keep_size parameter to be set high enough that the required log data is not removed before the end of the backup. If the required log data has been recycled before it's time to transfer it, the backup will fail and be unusable. When tar format is used, the write-ahead log files will be included in the base.tar file. s stream Stream write-ahead log data while the backup is being taken. This method will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will require two replication connections not just one. As long as the client can keep up with the write-ahead log data, using this method requires no extra write-ahead logs to be saved on the source server. When tar format is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default."}, {"names": ["-z", "--gzip"], "signature": "-z --gzip", "description": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-Z level", "-Z [{client|server}-] method [: detail ]", "--compress= level", "--compress=[{client|server}-] method [: detail ]"], "signature": "-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]", "description": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch . The compression method can be set to gzip , lz4 , zstd , none for no compression or an integer (no compression if 0, gzip if greater than 0). A compression detail string can optionally be specified. If the detail string is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form keyword or keyword=value . Currently, the supported keywords are level , long , and workers . The detail string cannot be used when the compression method is specified as a plain integer. If no compression level is specified, the default compression level will be used. If only a level is specified without mentioning an algorithm, gzip compression will be used if the level is greater than 0, and no compression will be used if the level is 0. When the tar format is used with gzip , lz4 , or zstd , the suffix .gz , .lz4 , or .zst , respectively, will be automatically added to all tar filenames. When the plain format is used, client-side compression may not be specified, but it is still possible to request server-side compression. If this is done, the server will compress the backup for transmission, and the client will decompress and extract it. When this option is used in combination with -Xstream , pg_wal.tar will be compressed using gzip if client-side gzip compression is selected, but will not be compressed if any other compression algorithm is selected, or if server-side compression is selected."}, {"names": ["-c {fast|spread}", "--checkpoint={fast|spread}"], "signature": "-c {fast|spread} --checkpoint={fast|spread}", "description": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 25.3.4 )."}, {"names": ["-C", "--create-slot"], "signature": "-C --create-slot", "description": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists."}, {"names": ["-l label", "--label= label"], "signature": "-l label --label= label", "description": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used."}, {"names": ["-n", "--no-clean"], "signature": "-n --no-clean", "description": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way."}, {"names": ["-N", "--no-sync"], "signature": "-N --no-sync", "description": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."}, {"names": ["-P", "--progress"], "signature": "-P --progress", "description": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL."}, {"names": ["-r rate", "--max-rate= rate"], "signature": "-r rate --max-rate= rate", "description": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch ."}, {"names": ["-S slotname", "--slot= slotname"], "signature": "-S slotname --slot= slotname", "description": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby. The specified replication slot has to exist unless the option -C is also used. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming."}, {"names": ["--sync-method= method"], "signature": "--sync-method= method", "description": "When set to fsync , which is the default, pg_basebackup will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace. On Linux, syncfs may be used instead to ask the operating system to synchronize the whole file system that contains the backup directory. When the plain format is used, pg_basebackup will also synchronize the file systems that contain the WAL files and each tablespace. See recovery_init_sync_method for information about the caveats to be aware of when using syncfs . This option has no effect when --no-sync is used."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."}, {"names": ["--manifest-checksums= algorithm"], "signature": "--manifest-checksums= algorithm", "description": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C . If NONE is selected, the backup manifest will not contain any checksums. Otherwise, it will contain a checksum of each file in the backup using the specified algorithm. In addition, the manifest will always contain a SHA256 checksum of its own contents. The SHA algorithms are significantly more CPU-intensive than CRC32C , so selecting one of them may increase the time required to complete the backup. Using a SHA hash function provides a cryptographically secure digest of each file for users who wish to verify that the backup has not been tampered with, while the CRC-32C algorithm provides a checksum that is much faster to calculate; it is good at catching errors due to accidental changes but is not resistant to malicious modifications. Note that, to be useful against an adversary who has access to the backup, the backup manifest would need to be stored securely elsewhere or otherwise verified not to have been modified since the backup was taken. pg_verifybackup can be used to check the integrity of a backup against the backup manifest."}, {"names": ["--manifest-force-encode"], "signature": "--manifest-force-encode", "description": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case."}, {"names": ["--no-estimate-size"], "signature": "--no-estimate-size", "description": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL . Without this option, the backup will start by enumerating the size of the entire database, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent. This option is useful to avoid such estimation time if it's too long. This option is not allowed when using --progress ."}, {"names": ["--no-manifest"], "signature": "--no-manifest", "description": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file."}, {"names": ["--no-slot"], "signature": "--no-slot", "description": "Prevents the creation of a temporary replication slot for the backup. By default, if log streaming is selected but no slot name is given with the -S option, then a temporary replication slot is created (if supported by the source server). The main purpose of this option is to allow taking a base backup when the server has no free replication slots. Using a replication slot is almost always preferred, because it prevents needed WAL from being removed by the server during the backup."}, {"names": ["--no-verify-checksums"], "signature": "--no-verify-checksums", "description": "Disables verification of checksums, if they are enabled on the server the base backup is taken from. By default, checksums are verified and checksum failures will result in a non-zero exit status. However, the base backup will not be removed in such a case, as if the --no-clean option had been used. Checksum verification failures will also be reported in the pg_stat_database view."}, {"names": ["-d connstr", "--dbname= connstr"], "signature": "-d connstr --dbname= connstr", "description": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. This option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, any database name included in the connection string will be ignored by the server. However, a database name supplied that way overrides the default database name ( replication ) for purposes of looking up the replication connection's password in ~/.pgpass . Similarly, middleware or proxies used in connecting to PostgreSQL might utilize the name for purposes such as connection routing. The database name can also be used by logical replication slot synchronization ."}, {"names": ["-h host", "--host= host"], "signature": "-h host --host= host", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-s interval", "--status-interval= interval"], "signature": "-s interval --status-interval= interval", "description": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Specifies the user name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Forces pg_basebackup to prompt for a password before connecting to the source server. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Prints the pg_basebackup version and exits."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Shows help about pg_basebackup command line arguments, and exits."}], "synopsis": ["pg_basebackup [ option ...]"], "environment": []}, "comparison_hash": "1355c21a25dc07b130a2e139c0430698018dbc37b620dff3f0f565fbaec56228", "manual_language": "zh"}, "19": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_basebackup"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "19beta4"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "35"}], "tables": [{"key": "options", "rows": [{"summary": "\u8bbe\u7f6e\u5199\u5165\u8f93\u51fa\u7684\u76ee\u6807\u76ee\u5f55\u3002\u5982\u679c\u8be5\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c pg_basebackup \u4f1a\u521b\u5efa\u5b83\uff08\u4ee5\u53ca\u6240\u6709\u7f3a\u5931\u7684\u7236\u76ee\u5f55\uff09\u3002\u5982\u679c\u8be5\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-D directory --pgdata= directory"}}, {"summary": "\u9009\u62e9\u8f93\u51fa\u683c\u5f0f\u3002 format \u53ef\u4ee5\u662f\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-F format --format= format"}}, {"summary": "\u6267\u884c \u589e\u91cf\u5907\u4efd \u3002\u5fc5\u987b\u63d0\u4f9b\u53c2\u8003\u5907\u4efd\u7684\u5907\u4efd\u6e05\u5355\uff1b\u8be5\u6587\u4ef6\u5c06\u88ab\u4e0a\u4f20\u5230\u670d\u52a1\u5668\uff0c\u968f\u540e\u670d\u52a1\u5668\u4f1a\u8fd4\u56de\u6240\u8bf7\u6c42\u7684\u589e\u91cf\u5907\u4efd\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-i old_manifest_file --incremental= old_manifest_file"}}, {"summary": "\u521b\u5efa standby.signal \u6587\u4ef6\uff0c\u5e76\u5c06\u8fde\u63a5\u8bbe\u7f6e\u8ffd\u52a0\u5230\u76ee\u6807\u76ee\u5f55\u4e2d\u7684 postgresql.auto.conf \u6587\u4ef6\u4e2d\uff08\u5982\u679c\u4f7f\u7528 tar \u683c\u5f0f\uff0c\u5219\u8ffd\u52a0\u5230\u57fa\u7840\u5f52\u6863\u6587\u4ef6\u5185\uff09\u3002\u8fd9\u6837\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u5229\u7528\u5907\u4efd\u7ed3\u679c\u642d\u5efa\u5907\u5e93\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-R --write-recovery-conf"}}, {"summary": "\u6307\u793a\u670d\u52a1\u5668\u5c06\u57fa\u7840\u5907\u4efd\u653e\u5230\u54ea\u91cc\u3002\u9ed8\u8ba4\u76ee\u6807\u662f client \uff0c\u8868\u793a\u5907\u4efd\u5e94\u53d1\u9001\u5230\u8fd0\u884c pg_basebackup \u7684\u90a3\u53f0\u673a\u5668\u3002\u5982\u679c\u76ee\u6807\u6539\u4e3a server:/some/path \uff0c\u5219\u5907\u4efd\u4f1a\u5b58\u50a8\u5728\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684 /some/path \u76ee\u5f55\u4e2d\u3002\u5c06\u5907\u4efd\u5b58\u50a8\u5728\u670d\u52a1\u5668\u4e0a\u9700\u8981\u8d85\u7ea7\u7528\u6237\u6743\u9650\uff0c\u6216\u62e5\u6709 pg_write_server_files \u89d2\u8272\u7684\u6743\u9650\u3002\u5982\u679c\u76ee\u6807\u8bbe\u7f6e\u4e3a blackhole \uff0c\u5219\u5185\u5bb9\u4f1a\u88ab\u4e22\u5f03\uff0c\u4e0d\u4f1a\u5b58\u50a8\u5230\u4efb\u4f55\u5730\u65b9\u3002\u8fd9\u53ea\u5e94\u7528\u4e8e\u6d4b\u8bd5\u76ee\u7684\uff0c\u56e0\u4e3a\u6700\u7ec8\u4e0d\u4f1a\u5f97\u5230\u5b9e\u9645\u5907\u4efd\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-t target --target= target"}}, {"summary": "\u5728\u5907\u4efd\u671f\u95f4\uff0c\u5c06\u76ee\u5f55 olddir \u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230 newdir \u3002\u8981\u4f7f\u6b64\u9009\u9879\u751f\u6548\uff0c olddir \u5fc5\u987b\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u5b9a\u4e49\u7684\u8be5\u8868\u7a7a\u95f4\u8def\u5f84\u5b8c\u5168\u4e00\u81f4\u3002\uff08\u4f46\u5982\u679c\u6e90\u670d\u52a1\u5668\u4e0a\u5728 olddir \u4e2d\u6ca1\u6709\u8868\u7a7a\u95f4\uff0c\u4e5f\u4e0d\u7b97\u9519\u8bef\u3002\uff09\u4e0e\u6b64\u540c\u65f6\uff0c newdir \u662f\u63a5\u6536\u4e3b\u673a\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u4e00\u4e2a\u76ee\u5f55\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c newdir \u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002 olddir \u548c newdir \u90fd\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u5982\u679c\u4efb\u4e00\u8def\u5f84\u4e2d\u9700\u8981\u5305\u542b\u7b49\u53f7\uff08 = \uff09\uff0c\u8bf7\u5728\u5176\u524d\u9762\u52a0\u4e0a\u53cd\u659c\u6760\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u4ee5\u5904\u7406\u591a\u4e2a\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-T olddir = newdir --tablespace-mapping= olddir = newdir"}}, {"summary": "\u8bbe\u7f6e\u5199\u5165 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cWAL \u6587\u4ef6\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u7684 pg_wal \u5b50\u76ee\u5f55\u4e2d\uff0c\u4f46\u6b64\u9009\u9879\u53ef\u7528\u4e8e\u5c06\u5176\u653e\u5728\u5176\u4ed6\u4f4d\u7f6e\u3002 waldir \u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c waldir \u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002\u53ea\u6709\u5f53\u5907\u4efd\u91c7\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u624d\u80fd\u6307\u5b9a\u6b64\u9009\u9879\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "--waldir= waldir"}}, {"summary": "\u5728\u5907\u4efd\u4e2d\u5305\u542b\u6240\u9700\u7684 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u3002\u8fd9\u5c06\u5305\u62ec\u5907\u4efd\u671f\u95f4\u751f\u6210\u7684\u6240\u6709\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u9664\u975e\u6307\u5b9a\u65b9\u6cd5 none \uff0c\u5426\u5219\u5c31\u53ef\u4ee5\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u542f\u52a8 postmaster\uff0c\u800c\u65e0\u9700\u67e5\u9605 WAL \u5f52\u6863\uff0c\u4ece\u800c\u4f7f\u8f93\u51fa\u6210\u4e3a\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u5907\u4efd\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-X method --wal-method= method"}}, {"summary": "\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u4f7f\u7528\u9ed8\u8ba4\u538b\u7f29\u7ea7\u522b\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0 .gz \u540e\u7f00\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-z --gzip"}}, {"summary": "\u8bf7\u6c42\u5bf9\u5907\u4efd\u8fdb\u884c\u538b\u7f29\u3002\u5982\u679c\u5305\u542b client \u6216 server \uff0c\u5219\u6307\u5b9a\u538b\u7f29\u6267\u884c\u7684\u4f4d\u7f6e\u3002\u5728\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4f1a\u51cf\u5c11\u4f20\u8f93\u5e26\u5bbd\u5360\u7528\uff0c\u4f46\u4f1a\u589e\u52a0\u670d\u52a1\u5668 CPU \u6d88\u8017\u3002\u9ed8\u8ba4\u503c\u662f client \uff0c\u4f46\u4f7f\u7528 --target \u65f6\u9664\u5916\uff1b\u6b64\u65f6\u5907\u4efd\u4e0d\u4f1a\u53d1\u9001\u5230\u5ba2\u6237\u7aef\uff0c\u56e0\u6b64\u53ea\u6709\u670d\u52a1\u5668\u7aef\u538b\u7f29\u624d\u6709\u610f\u4e49\u3002\u4f7f\u7528\u9ed8\u8ba4\u7684 -Xstream \u65f6\uff0c\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4e0d\u4f1a\u5e94\u7528\u4e8e WAL\u3002\u82e5\u8981\u538b\u7f29 WAL\uff0c\u8bf7\u4f7f\u7528\u5ba2\u6237\u7aef\u538b\u7f29\uff0c\u6216\u8005\u6307\u5b9a -Xfetch \u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]"}}, {"summary": "\u5c06\u68c0\u67e5\u70b9\u6a21\u5f0f\u8bbe\u7f6e\u4e3a fast \u6216 spread\uff08\u89c1 \u7b2c 25.3.4 \u8282 \uff09\u3002\u9ed8\u8ba4\u503c\u4e3a spread\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-c {fast|spread} --checkpoint={fast|spread}"}}, {"summary": "\u6307\u5b9a\u5728\u5f00\u59cb\u5907\u4efd\u4e4b\u524d\uff0c\u5e94\u521b\u5efa\u7531 --slot \u9009\u9879\u6307\u5b9a\u540d\u79f0\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u8be5\u69fd\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u9519\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-C --create-slot"}}, {"summary": "\u8bbe\u7f6e\u5907\u4efd\u6807\u7b7e\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u503c \u201c pg_basebackup base backup \u201d \u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-l label --label= label"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53 pg_basebackup \u56e0\u9519\u8bef\u4e2d\u6b62\u65f6\uff0c\u5b83\u4f1a\u5220\u9664\u5728\u53d1\u73b0\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u76ee\u5f55\uff08\u4f8b\u5982\u76ee\u6807\u76ee\u5f55\u548c\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\uff09\u3002\u6b64\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u5f88\u6709\u5e2e\u52a9\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-n --no-clean"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_basebackup \u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u88ab\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f1a\u4f7f pg_basebackup \u4e0d\u7ecf\u7b49\u5f85\u5c31\u76f4\u63a5\u8fd4\u56de\uff0c\u56e0\u6b64\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u968f\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u57fa\u7840\u5907\u4efd\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u5408\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-N --no-sync"}}, {"summary": "\u542f\u7528\u8fdb\u5ea6\u62a5\u544a\u3002\u6253\u5f00\u6b64\u9009\u9879\u540e\uff0c\u4f1a\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u7ed9\u51fa\u4e00\u4e2a\u8fd1\u4f3c\u7684\u8fdb\u5ea6\u62a5\u544a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u53d1\u751f\u53d8\u5316\uff0c\u56e0\u6b64\u8fd9\u53ea\u662f\u8fd1\u4f3c\u503c\uff0c\u6700\u7ec8\u672a\u5fc5\u6070\u597d\u7ed3\u675f\u5728 100% \u3002\u7279\u522b\u662f\u5f53\u5907\u4efd\u4e2d\u5305\u542b WAL \u65f6\uff0c\u603b\u6570\u636e\u91cf\u65e0\u6cd5\u9884\u5148\u4f30\u8ba1\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u65e6\u8fdb\u5ea6\u8d85\u8fc7\u4e0d\u542b WAL \u65f6\u7684\u603b\u4f30\u8ba1\u503c\uff0c\u4f30\u8ba1\u76ee\u6807\u5927\u5c0f\u5c31\u4f1a\u7ee7\u7eed\u589e\u52a0\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-P --progress"}}, {"summary": "\u8bbe\u7f6e\u4ece\u6e90\u670d\u52a1\u5668\u6536\u96c6\u6570\u636e\u65f6\u5141\u8bb8\u7684\u6700\u5927\u4f20\u8f93\u901f\u7387\u3002\u8fd9\u6709\u52a9\u4e8e\u9650\u5236 pg_basebackup \u5bf9\u670d\u52a1\u5668\u7684\u5f71\u54cd\u3002\u53d6\u503c\u5355\u4f4d\u4e3a\u6bcf\u79d2\u5343\u5b57\u8282\u3002\u4f7f\u7528\u540e\u7f00 M \u8868\u793a\u6bcf\u79d2\u5146\u5b57\u8282\u3002\u4e5f\u63a5\u53d7\u540e\u7f00 k \uff0c\u4f46\u6ca1\u6709\u5b9e\u9645\u5f71\u54cd\u3002\u6709\u6548\u53d6\u503c\u8303\u56f4\u4e3a\u6bcf\u79d2 32 \u5343\u5b57\u8282\u5230\u6bcf\u79d2 1024 \u5146\u5b57\u8282\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-r rate --max-rate= rate"}}, {"summary": "\u6b64\u9009\u9879\u53ea\u80fd\u4e0e -X stream \u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u4f1a\u4f7f WAL \u6d41\u5f0f\u4f20\u8f93\u4f7f\u7528\u6307\u5b9a\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u6b64\u57fa\u7840\u5907\u4efd\u6253\u7b97\u7528\u4f5c\u4f7f\u7528\u590d\u5236\u69fd\u7684\u6d41\u590d\u5236\u5907\u5e93\uff0c\u90a3\u4e48\u8be5\u5907\u5e93\u5e94\u5c06\u540c\u4e00\u4e2a\u590d\u5236\u69fd\u540d\u79f0\u7528\u4f5c primary_slot_name \u7684\u503c\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u4e3b\u5e93\u5728\u57fa\u7840\u5907\u4efd\u7ed3\u675f\u4e0e\u65b0\u5907\u5e93\u5f00\u59cb\u6d41\u590d\u5236\u4e4b\u95f4\u7684\u8fd9\u6bb5\u65f6\u95f4\u5185\uff0c\u4e0d\u4f1a\u79fb\u9664\u4efb\u4f55\u5fc5\u9700\u7684 WAL \u6570\u636e\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-S slotname --slot= slotname"}}, {"summary": "\u8bbe\u7f6e\u4e3a fsync \uff08\u9ed8\u8ba4\uff09\u65f6\uff0c pg_basebackup \u4f1a\u9012\u5f52\u6253\u5f00\u5e76\u540c\u6b65\u5907\u4efd\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3002\u4f7f\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u67e5\u627e\u6587\u4ef6\u4f1a\u8ddf\u968f WAL \u76ee\u5f55\u548c\u5404\u5df2\u914d\u7f6e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "--sync-method= method"}}, {"summary": "\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\u3002\u5b83\u4f1a\u5728\u542f\u52a8\u548c\u5173\u95ed\u8fc7\u7a0b\u4e2d\u8f93\u51fa\u4e00\u4e9b\u989d\u5916\u6b65\u9aa4\uff1b\u5982\u679c\u540c\u65f6\u542f\u7528\u4e86\u8fdb\u5ea6\u62a5\u544a\uff0c\u8fd8\u4f1a\u663e\u793a\u5f53\u524d\u6b63\u5728\u5904\u7406\u7684\u786e\u5207\u6587\u4ef6\u540d\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-v --verbose"}}, {"summary": "\u6307\u5b9a\u5e94\u7528\u5230\u5907\u4efd\u6e05\u5355\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u7684\u6821\u9a8c\u548c\u7b97\u6cd5\u3002\u76ee\u524d\u53ef\u7528\u7684\u7b97\u6cd5\u6709 NONE \u3001 CRC32C \u3001 SHA224 \u3001 SHA256 \u3001 SHA384 \u548c SHA512 \u3002\u9ed8\u8ba4\u503c\u4e3a CRC32C \u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "--manifest-checksums= algorithm"}}, {"summary": "\u5f3a\u5236\u5c06\u5907\u4efd\u6e05\u5355\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u540d\u7f16\u7801\u4e3a\u5341\u516d\u8fdb\u5236\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u5bf9\u975e UTF8 \u6587\u4ef6\u540d\u8fdb\u884c\u5341\u516d\u8fdb\u5236\u7f16\u7801\u3002\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u8bfb\u53d6\u5907\u4efd\u6e05\u5355\u6587\u4ef6\u7684\u5de5\u5177\u662f\u5426\u80fd\u6b63\u786e\u5904\u7406\u8fd9\u79cd\u60c5\u51b5\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "--manifest-force-encode"}}, {"summary": "\u7981\u6b62\u670d\u52a1\u5668\u4f30\u7b97\u5c06\u8981\u6d41\u5f0f\u4f20\u8f93\u7684\u5907\u4efd\u6570\u636e\u603b\u91cf\uff0c\u56e0\u6b64 pg_stat_progress_basebackup \u89c6\u56fe\u4e2d\u7684 backup_total \u5217\u59cb\u7ec8\u4e3a NULL\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "--no-estimate-size"}}, {"summary": "\u7981\u6b62\u751f\u6210\u5907\u4efd\u6e05\u5355\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u670d\u52a1\u5668\u5c06\u751f\u6210\u5e76\u53d1\u9001\u4e00\u4e2a\u5907\u4efd\u6e05\u5355\uff0c\u53ef\u4f7f\u7528 pg_verifybackup \u8fdb\u884c\u9a8c\u8bc1\u3002\u8be5\u6e05\u5355\u5217\u51fa\u4e86\u5907\u4efd\u4e2d\u7684\u6bcf\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u4e0d\u5305\u62ec\u53ef\u80fd\u5305\u542b\u5728\u5176\u4e2d\u7684\u4efb\u4f55 WAL \u6587\u4ef6\u3002\u5b83\u8fd8\u4f1a\u4fdd\u5b58\u6bcf\u4e2a\u6587\u4ef6\u7684\u5927\u5c0f\u3001\u6700\u540e\u4fee\u6539\u65f6\u95f4\u4ee5\u53ca\u53ef\u9009\u7684\u6821\u9a8c\u548c\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "--no-manifest"}}, {"summary": "\u9632\u6b62\u4e3a\u5907\u4efd\u521b\u5efa\u4e34\u65f6\u590d\u5236\u69fd\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "--no-slot"}}, {"summary": "\u5982\u679c\u83b7\u53d6\u57fa\u7840\u5907\u4efd\u7684\u670d\u52a1\u5668\u542f\u7528\u4e86\u6821\u9a8c\u548c\uff0c\u5219\u7981\u7528\u5bf9\u8fd9\u4e9b\u6821\u9a8c\u548c\u7684\u9a8c\u8bc1\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "--no-verify-checksums"}}, {"summary": "\u4ee5 \u8fde\u63a5\u5b57\u7b26\u4e32 \u7684\u5f62\u5f0f\u6307\u5b9a\u7528\u4e8e\u8fde\u63a5\u670d\u52a1\u5668\u7684\u53c2\u6570\uff1b\u8fd9\u4e9b\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u76f8\u4e92\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-d connstr --dbname= connstr"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGHOST \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff1b\u5426\u5219\u4f1a\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-h host --host= host"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u6240\u4f7f\u7528\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u4e2d\u7684\u503c\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u786e\u5b9a\u7684\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-p port --port= port"}}, {"summary": "\u6307\u5b9a\u53d1\u9001\u56de\u6e90\u670d\u52a1\u5668\u7684\u72b6\u6001\u5305\u4e4b\u95f4\u76f8\u9694\u7684\u79d2\u6570\u3002\u8f83\u5c0f\u7684\u503c\u53ef\u4ee5\u8ba9\u670d\u52a1\u5668\u7aef\u5bf9\u5907\u4efd\u8fdb\u5ea6\u7684\u76d1\u63a7\u66f4\u7cbe\u786e\u3002\u503c\u4e3a\u96f6\u65f6\u4f1a\u5b8c\u5168\u7981\u7528\u5468\u671f\u6027\u72b6\u6001\u66f4\u65b0\uff0c\u4e0d\u8fc7\u5f53\u670d\u52a1\u5668\u8bf7\u6c42\u65f6\u4ecd\u4f1a\u53d1\u9001\u66f4\u65b0\uff0c\u4ee5\u907f\u514d\u56e0\u8d85\u65f6\u800c\u65ad\u5f00\u8fde\u63a5\u3002\u9ed8\u8ba4\u503c\u662f 10 \u79d2\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-s interval --status-interval= interval"}}, {"summary": "\u6307\u5b9a\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-U username --username= username"}}, {"summary": "\u7981\u6b62\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\uff08\u4f8b\u5982 .pgpass \u6587\u4ef6\uff09\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u6b64\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u79cd\u573a\u666f\u4e0b\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 pg_basebackup \u5728\u8fde\u63a5\u6e90\u670d\u52a1\u5668\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-W --password"}}, {"summary": "\u8f93\u51fa pg_basebackup \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-V --version"}}, {"summary": "\u663e\u793a pg_basebackup \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/19/app-pgbasebackup.html", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}], "options": [{"names": ["-D directory", "--pgdata= directory"], "summary": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty.", "signature": "-D directory --pgdata= directory", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty. When the backup is in tar format, the target directory may be specified as - (dash), causing the tar file to be written to stdout . This option is required."}, {"names": ["-F format", "--format= format"], "summary": "Selects the format for the output. format can be one of the following:", "signature": "-F format --format= format", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the source server's data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory's contents will be written to a file named base.tar , and each other tablespace will be written to a separate tar file named after that tablespace's OID. If the target directory is specified as - (dash), the tar contents will be written to standard output, suitable for piping to (for example) gzip . This is only allowed if the cluster has no additional tablespaces and WAL streaming is not used."}, {"names": ["-i old_manifest_file", "--incremental= old_manifest_file"], "summary": "Performs an incremental backup . The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup.", "signature": "-i old_manifest_file --incremental= old_manifest_file", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Performs an incremental backup . The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup."}, {"names": ["-R", "--write-recovery-conf"], "summary": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup.", "signature": "-R --write-recovery-conf", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup. The postgresql.auto.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that streaming replication and logical replication slot synchronization will use the same settings later on. The dbname will be recorded only if the dbname was specified explicitly in the connection string or environment variable ."}, {"names": ["-t target", "--target= target"], "summary": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup.", "signature": "-t target --target= target", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup. Since WAL streaming is implemented by pg_basebackup rather than by the server, this option cannot be used together with -Xstream . Since that is the default, when this option is specified, you must also specify either -Xfetch or -Xnone ."}, {"names": ["-T olddir = newdir", "--tablespace-mapping= olddir = newdir"], "summary": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces.", "signature": "-T olddir = newdir --tablespace-mapping= olddir = newdir", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected."}, {"names": ["--waldir= waldir"], "summary": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format.", "signature": "--waldir= waldir", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format."}, {"names": ["-X method", "--wal-method= method"], "summary": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup.", "signature": "-X method --wal-method= method", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup. The following method s for collecting the write-ahead logs are supported: n none Don't include write-ahead logs in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the source server's wal_keep_size parameter to be set high enough that the required log data is not removed before the end of the backup. If the required log data has been recycled before it's time to transfer it, the backup will fail and be unusable. When tar format is used, the write-ahead log files will be included in the base.tar file. s stream Stream write-ahead log data while the backup is being taken. This method will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will require two replication connections not just one. As long as the client can keep up with the write-ahead log data, using this method requires no extra write-ahead logs to be saved on the source server. When tar format is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default."}, {"names": ["-z", "--gzip"], "summary": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "signature": "-z --gzip", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-Z level", "-Z [{client|server}-] method [: detail ]", "--compress= level", "--compress=[{client|server}-] method [: detail ]"], "summary": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch .", "signature": "-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch . The compression method can be set to gzip , lz4 , zstd , none for no compression or an integer (no compression if 0, gzip if greater than 0). A compression detail string can optionally be specified. If the detail string is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form keyword or keyword=value . Currently, the supported keywords are level , long , and workers . The detail string cannot be used when the compression method is specified as a plain integer. If no compression level is specified, the default compression level will be used. If only a level is specified without mentioning an algorithm, gzip compression will be used if the level is greater than 0, and no compression will be used if the level is 0. When the tar format is used with gzip , lz4 , or zstd , the suffix .gz , .lz4 , or .zst , respectively, will be automatically added to all tar filenames. When the plain format is used, client-side compression may not be specified, but it is still possible to request server-side compression. If this is done, the server will compress the backup for transmission, and the client will decompress and extract it. When this option is used in combination with -Xstream , pg_wal.tar will be compressed using gzip if client-side gzip compression is selected, but will not be compressed if any other compression algorithm is selected, or if server-side compression is selected."}, {"names": ["-c {fast|spread}", "--checkpoint={fast|spread}"], "summary": "Sets checkpoint mode to fast or spread (see Section 25.3.4 ). The default is spread.", "signature": "-c {fast|spread} --checkpoint={fast|spread}", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Sets checkpoint mode to fast or spread (see Section 25.3.4 ). The default is spread."}, {"names": ["-C", "--create-slot"], "summary": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists.", "signature": "-C --create-slot", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists."}, {"names": ["-l label", "--label= label"], "summary": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used.", "signature": "-l label --label= label", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used."}, {"names": ["-n", "--no-clean"], "summary": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging.", "signature": "-n --no-clean", "source_url": "/docs/19/app-pgbasebackup.html", "description": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way."}, {"names": ["-N", "--no-sync"], "summary": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.", "signature": "-N --no-sync", "source_url": "/docs/19/app-pgbasebackup.html", "description": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."}, {"names": ["-P", "--progress"], "summary": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.", "signature": "-P --progress", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL."}, {"names": ["-r rate", "--max-rate= rate"], "summary": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second.", "signature": "-r rate --max-rate= rate", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch ."}, {"names": ["-S slotname", "--slot= slotname"], "summary": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby.", "signature": "-S slotname --slot= slotname", "source_url": "/docs/19/app-pgbasebackup.html", "description": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby. The specified replication slot has to exist unless the option -C is also used. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming."}, {"names": ["--sync-method= method"], "summary": "When set to fsync , which is the default, pg_basebackup will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace.", "signature": "--sync-method= method", "source_url": "/docs/19/app-pgbasebackup.html", "description": "When set to fsync , which is the default, pg_basebackup will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace. On Linux, syncfs may be used instead to ask the operating system to synchronize the whole file system that contains the backup directory. When the plain format is used, pg_basebackup will also synchronize the file systems that contain the WAL files and each tablespace. See recovery_init_sync_method for information about the caveats to be aware of when using syncfs . This option has no effect when --no-sync is used."}, {"names": ["-v", "--verbose"], "summary": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.", "signature": "-v --verbose", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."}, {"names": ["--manifest-checksums= algorithm"], "summary": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C .", "signature": "--manifest-checksums= algorithm", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C . If NONE is selected, the backup manifest will not contain any checksums. Otherwise, it will contain a checksum of each file in the backup using the specified algorithm. In addition, the manifest will always contain a SHA256 checksum of its own contents. The SHA algorithms are significantly more CPU-intensive than CRC32C , so selecting one of them may increase the time required to complete the backup. Using a SHA hash function provides a cryptographically secure digest of each file for users who wish to verify that the backup has not been tampered with, while the CRC-32C algorithm provides a checksum that is much faster to calculate; it is good at catching errors due to accidental changes but is not resistant to malicious modifications. Note that, to be useful against an adversary who has access to the backup, the backup manifest would need to be stored securely elsewhere or otherwise verified not to have been modified since the backup was taken. pg_verifybackup can be used to check the integrity of a backup against the backup manifest."}, {"names": ["--manifest-force-encode"], "summary": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case.", "signature": "--manifest-force-encode", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case."}, {"names": ["--no-estimate-size"], "summary": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL .", "signature": "--no-estimate-size", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL . Without this option, the backup will start by enumerating the size of the entire database, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent. This option is useful to avoid such estimation time if it's too long. This option is not allowed when using --progress ."}, {"names": ["--no-manifest"], "summary": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file.", "signature": "--no-manifest", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file."}, {"names": ["--no-slot"], "summary": "Prevents the creation of a temporary replication slot for the backup.", "signature": "--no-slot", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Prevents the creation of a temporary replication slot for the backup. By default, if log streaming is selected but no slot name is given with the -S option, then a temporary replication slot is created (if supported by the source server). The main purpose of this option is to allow taking a base backup when the server has no free replication slots. Using a replication slot is almost always preferred, because it prevents needed WAL from being removed by the server during the backup."}, {"names": ["--no-verify-checksums"], "summary": "Disables verification of checksums, if they are enabled on the server the base backup is taken from.", "signature": "--no-verify-checksums", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Disables verification of checksums, if they are enabled on the server the base backup is taken from. By default, checksums are verified and checksum failures will result in a non-zero exit status. However, the base backup will not be removed in such a case, as if the --no-clean option had been used. Checksum verification failures will also be reported in the pg_stat_database view."}, {"names": ["-d connstr", "--dbname= connstr"], "summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": "-d connstr --dbname= connstr", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. This option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, any database name included in the connection string will be ignored by the server. However, a database name supplied that way overrides the default database name ( replication ) for purposes of looking up the replication connection's password in ~/.pgpass . Similarly, middleware or proxies used in connecting to PostgreSQL might utilize the name for purposes such as connection routing. The database name can also be used by logical replication slot synchronization ."}, {"names": ["-h host", "--host= host"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "signature": "-h host --host= host", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "signature": "-p port --port= port", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-s interval", "--status-interval= interval"], "summary": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds.", "signature": "-s interval --status-interval= interval", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds."}, {"names": ["-U username", "--username= username"], "summary": "Specifies the user name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Specifies the user name to connect as."}, {"names": ["-w", "--no-password"], "summary": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "summary": "Forces pg_basebackup to prompt for a password before connecting to the source server.", "signature": "-W --password", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Forces pg_basebackup to prompt for a password before connecting to the source server. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["-V", "--version"], "summary": "Prints the pg_basebackup version and exits.", "signature": "-V --version", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Prints the pg_basebackup version and exits."}, {"names": ["-?", "--help"], "summary": "Shows help about pg_basebackup command line arguments, and exits.", "signature": "-? --help", "source_url": "/docs/19/app-pgbasebackup.html", "description": "Shows help about pg_basebackup command line arguments, and exits."}], "related": [{"url": "/wiki/conn/?v=19", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v19beta4/postgresql-19beta4.tar.bz2", "label": "19beta4", "major": "19", "channel": "preview", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/19/postgresql-19-A4.pdf", "bytes": 16064841, "pages": 3052, "sha256": "4dd099e4125c591128fc5f3ebd02178dc24781f9e5ae629f96d67c4c8547427b", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/19/postgresql-19-US.pdf", "bytes": 15974616, "pages": 3225, "sha256": "61971fa857f0956d47341a0388fa6af9ae10acf691d4b2fc009007d384b0342b", "built_at": "2026-09-26"}}, "tree": "19", "index": "index.html", "major": "19", "pages": 1155, "release": "19beta4", "source_url": "https://ftp.postgresql.org/pub/source/v19beta4/postgresql-19beta4.tar.bz2", "svg_assets": 5, "source_mode": "en SGML built with pinned official archive", "source_sha256": "83157ee9c599d03b2f7a3d73ef3a56ec24e0e79cc2b3501a64d1364f56398c86"}, "revision": "1bbbbf4133d426f0e4304010688d2984c30fb67df0cc3a61b3e37eb3f6f37833", "evidence_kind": "English manual and source declarations", "source_sha256": "83157ee9c599d03b2f7a3d73ef3a56ec24e0e79cc2b3501a64d1364f56398c86"}, "sources": [{"url": "https://pg.center/docs/19/app-pgbasebackup.html", "file": "app-pgbasebackup.html", "label": "19beta4 English manual \u00b7 app-pgbasebackup.html", "anchor": "", "sha256": "9658c982553138ec05473353c33103fff14760c65ac9ea0291e44ee8d185763b", "language": "en", "original_url": "/docs/19/app-pgbasebackup.html"}, {"url": "https://pg.center/docs/19/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "c827f460db781b39da305303c88e73729a419cd2b2b9dedb126d8ad5cbf02c95", "language": "en", "original_url": "/docs/19/reference-client.html"}], "sections": [], "synopsis": ["pg_basebackup [ option ...]"], "signature": "pg_basebackup [ option ...]", "description": ["pg_basebackup \u2014 \u83b7\u53d6 PostgreSQL \u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd"], "environment": [], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGBASEBACKUP\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_basebackup</span></span></h2>\n<p lang=\"zh\">pg_basebackup \u2014 \u83b7\u53d6<span class=\"productname\">PostgreSQL</span>\u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.10.4.1\"><code class=\"command\">pg_basebackup</code> [<em class=\"replaceable\"><code>option</code></em>...]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u7528\u4e8e\u83b7\u53d6\u6b63\u5728\u8fd0\u884c\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd\u3002\u5907\u4efd\u8fc7\u7a0b\u4e0d\u4f1a\u5f71\u54cd\u6570\u636e\u5e93\u7684\u5176\u4ed6\u5ba2\u6237\u7aef\uff0c\u5e76\u4e14\u8be5\u5907\u4efd\u65e2\u53ef\u7528\u4e8e\u65f6\u95f4\u70b9\u6062\u590d\uff08\u89c1<a class=\"xref\" href=\"/docs/19/continuous-archiving.html\" title=\"25.3.\u00a0\u6301\u7eed\u5f52\u6863\u548c\u65f6\u95f4\u70b9\u6062\u590d\uff08PITR\uff09\">\u7b2c\u00a025.3\u00a0\u8282</a>\uff09\uff0c\u4e5f\u53ef\u7528\u4f5c\u65e5\u5fd7\u4f20\u9001\u6216\u6d41\u590d\u5236\u5907\u5e93\u7684\u8d77\u70b9\uff08\u89c1<a class=\"xref\" href=\"/docs/19/warm-standby.html\" title=\"26.2.\u00a0\u65e5\u5fd7\u4f20\u9001\u5907\u5e93\">\u7b2c\u00a026.2\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u65e2\u53ef\u4ee5\u6267\u884c\u5b8c\u6574\u57fa\u7840\u5907\u4efd\uff0c\u4e5f\u53ef\u4ee5\u6267\u884c\u589e\u91cf\u57fa\u7840\u5907\u4efd\u3002\u6267\u884c\u5b8c\u6574\u5907\u4efd\u65f6\uff0c\u5b83\u4f1a\u7cbe\u786e\u590d\u5236\u6570\u636e\u5e93\u96c6\u7c07\u7684\u6587\u4ef6\u3002\u6267\u884c\u589e\u91cf\u5907\u4efd\u65f6\uff0c\u539f\u672c\u4f1a\u5305\u542b\u5728\u5b8c\u6574\u5907\u4efd\u4e2d\u7684\u67d0\u4e9b\u6587\u4ef6\uff0c\u53ef\u80fd\u4f1a\u88ab\u8fd9\u4e9b\u6587\u4ef6\u7684\u589e\u91cf\u7248\u672c\u66ff\u4ee3\uff0c\u5176\u4e2d\u4ec5\u5305\u542b\u81ea\u53c2\u8003\u5907\u4efd\u4ee5\u6765\u88ab\u4fee\u6539\u8fc7\u7684\u5757\u3002\u589e\u91cf\u5907\u4efd\u4e0d\u80fd\u76f4\u63a5\u4f7f\u7528\uff1b\u5fc5\u987b\u5148\u4f7f\u7528<a class=\"xref\" href=\"/docs/19/app-pgcombinebackup.html\" title=\"pg_combinebackup\"><span class=\"refentrytitle\"><span class=\"application\">pg_combinebackup</span></span></a>\u5c06\u5176\u4e0e\u5b83\u6240\u4f9d\u8d56\u7684\u5148\u524d\u5907\u4efd\u5408\u5e76\u3002\u5173\u4e8e\u589e\u91cf\u5907\u4efd\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u89c1<a class=\"xref\" href=\"/docs/19/continuous-archiving.html#BACKUP-INCREMENTAL-BACKUP\" title=\"25.3.3.\u00a0\u8fdb\u884c\u589e\u91cf\u5907\u4efd\">\u7b2c\u00a025.3.3\u00a0\u8282</a>\uff1b\u5173\u4e8e\u4ece\u5907\u4efd\u6062\u590d\u7684\u6b65\u9aa4\uff0c\u89c1<a class=\"xref\" href=\"/docs/19/continuous-archiving.html#BACKUP-PITR-RECOVERY\" title=\"25.3.5.\u00a0\u4f7f\u7528\u6301\u7eed\u5f52\u6863\u5907\u4efd\u8fdb\u884c\u6062\u590d\">\u7b2c\u00a025.3.5\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5728\u4efb\u4f55\u6a21\u5f0f\u4e0b\uff0c<span class=\"application\">pg_basebackup</span>\u90fd\u4f1a\u786e\u4fdd\u670d\u52a1\u5668\u81ea\u52a8\u8fdb\u5165\u548c\u9000\u51fa\u5907\u4efd\u6a21\u5f0f\u3002\u5907\u4efd\u59cb\u7ec8\u9488\u5bf9\u6574\u4e2a\u6570\u636e\u5e93\u96c6\u7c07\uff1b\u4e0d\u53ef\u80fd\u53ea\u5907\u4efd\u5355\u4e2a\u6570\u636e\u5e93\u6216\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u5bf9\u4e8e\u9009\u62e9\u6027\u5907\u4efd\uff0c\u5fc5\u987b\u4f7f\u7528\u8bf8\u5982<a class=\"xref\" href=\"/docs/19/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>\u4e4b\u7c7b\u7684\u5176\u4ed6\u5de5\u5177\u3002</p>\n<p lang=\"zh\">\u5907\u4efd\u662f\u901a\u8fc7\u4e00\u4e2a\u4f7f\u7528\u590d\u5236\u534f\u8bae\u7684\u5e38\u89c4<span class=\"productname\">PostgreSQL</span>\u8fde\u63a5\u8fdb\u884c\u7684\u3002\u5efa\u7acb\u8be5\u8fde\u63a5\u6240\u4f7f\u7528\u7684\u7528\u6237 ID \u5fc5\u987b\u5177\u6709<code class=\"literal\">REPLICATION</code>\u6743\u9650\uff08\u89c1<a class=\"xref\" href=\"/docs/19/role-attributes.html\" title=\"21.2.\u00a0\u89d2\u8272\u5c5e\u6027\">\u7b2c\u00a021.2\u00a0\u8282</a>\uff09\uff0c\u6216\u8005\u662f\u8d85\u7ea7\u7528\u6237\uff0c\u5e76\u4e14<a class=\"link\" href=\"/docs/19/auth-pg-hba-conf.html\" title=\"20.1.\u00a0pg_hba.conf \u6587\u4ef6\"><code class=\"filename\">pg_hba.conf</code></a>\u5fc5\u987b\u5141\u8bb8\u8be5\u590d\u5236\u8fde\u63a5\u3002\u670d\u52a1\u5668\u8fd8\u5fc5\u987b\u5c06<a class=\"xref\" href=\"/docs/19/runtime-config-replication.html#GUC-MAX-WAL-SENDERS\">max_wal_senders</a>\u8bbe\u7f6e\u5f97\u8db3\u591f\u9ad8\uff0c\u4ee5\u4fbf\u81f3\u5c11\u63d0\u4f9b\u4e00\u4e2a\u7528\u4e8e\u5907\u4efd\u7684 WAL \u53d1\u9001\u8fdb\u7a0b\uff0c\u5e76\u5728\u4f7f\u7528 WAL \u6d41\u5f0f\u4f20\u8f93\u65f6\u518d\u63d0\u4f9b\u4e00\u4e2a WAL \u53d1\u9001\u8fdb\u7a0b\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u540c\u65f6\u8fd0\u884c\u591a\u4e2a<code class=\"command\">pg_basebackup</code>\uff0c\u4f46\u4ece\u6027\u80fd\u89d2\u5ea6\u6765\u770b\uff0c\u901a\u5e38\u6700\u597d\u53ea\u6267\u884c\u4e00\u6b21\u5907\u4efd\uff0c\u7136\u540e\u590d\u5236\u5176\u7ed3\u679c\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u4e0d\u4ec5\u53ef\u4ee5\u4ece\u4e3b\u5e93\u83b7\u53d6\u57fa\u7840\u5907\u4efd\uff0c\u4e5f\u53ef\u4ee5\u4ece\u5907\u5e93\u83b7\u53d6\u3002\u8981\u4ece\u5907\u5e93\u83b7\u53d6\u5907\u4efd\uff0c\u9700\u8981\u5c06\u5907\u5e93\u914d\u7f6e\u4e3a\u80fd\u591f\u63a5\u53d7\u590d\u5236\u8fde\u63a5\uff08\u5373\u8bbe\u7f6e<code class=\"varname\">max_wal_senders</code>\u548c<a class=\"xref\" href=\"/docs/19/runtime-config-replication.html#GUC-HOT-STANDBY\">hot_standby</a>\uff0c\u5e76\u9002\u5f53\u5730\u914d\u7f6e\u5176<code class=\"filename\">pg_hba.conf</code>\uff09\u3002\u8fd8\u9700\u8981\u5728\u4e3b\u5e93\u4e0a\u542f\u7528<a class=\"xref\" href=\"/docs/19/runtime-config-wal.html#GUC-FULL-PAGE-WRITES\">full_page_writes</a>\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u4ece\u5907\u5e93\u83b7\u53d6\u5907\u4efd\u5b58\u5728\u4e00\u4e9b\u9650\u5236\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5907\u4efd\u5386\u53f2\u6587\u4ef6\u4e0d\u4f1a\u5728\u88ab\u5907\u4efd\u7684\u6570\u636e\u5e93\u96c6\u7c07\u4e2d\u521b\u5efa\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">pg_basebackup</span>\u65e0\u6cd5\u5f3a\u5236\u5907\u5e93\u5728\u5907\u4efd\u7ed3\u675f\u65f6\u5207\u6362\u5230\u65b0\u7684 WAL \u6587\u4ef6\u3002\u5f53\u4f7f\u7528<code class=\"literal\">-X none</code>\u65f6\uff0c\u5982\u679c\u4e3b\u5e93\u4e0a\u7684\u5199\u5165\u6d3b\u52a8\u8f83\u5c11\uff0c<span class=\"application\">pg_basebackup</span>\u53ef\u80fd\u9700\u8981\u957f\u65f6\u95f4\u7b49\u5f85\uff0c\u76f4\u5230\u5907\u4efd\u6240\u9700\u7684\u6700\u540e\u4e00\u4e2a WAL \u6587\u4ef6\u88ab\u5207\u6362\u5e76\u5f52\u6863\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5728\u4e3b\u5e93\u4e0a\u8fd0\u884c<code class=\"function\">pg_switch_wal</code>\uff0c\u4ee5\u7acb\u5373\u89e6\u53d1 WAL \u6587\u4ef6\u5207\u6362\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5982\u679c\u5907\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u88ab\u63d0\u5347\u4e3a\u4e3b\u5e93\uff0c\u5219\u5907\u4efd\u4f1a\u5931\u8d25\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5907\u4efd\u6240\u9700\u7684\u6240\u6709 WAL \u8bb0\u5f55\u90fd\u5fc5\u987b\u5305\u542b\u8db3\u591f\u7684\u6574\u9875\u5199\u5165\uff0c\u56e0\u6b64\u5fc5\u987b\u5728\u4e3b\u5e93\u4e0a\u542f\u7528<code class=\"varname\">full_page_writes</code>\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u6bcf\u5f53<span class=\"application\">pg_basebackup</span>\u6267\u884c\u57fa\u7840\u5907\u4efd\u65f6\uff0c\u670d\u52a1\u5668\u7684<code class=\"structname\">pg_stat_progress_basebackup</code>\u89c6\u56fe\u90fd\u4f1a\u62a5\u544a\u5907\u4efd\u8fdb\u5ea6\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/19/progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING\" title=\"27.4.7.\u00a0\u57fa\u7840\u5907\u4efd\u8fdb\u5ea6\u62a5\u544a\">\u7b2c\u00a027.4.7\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u8f93\u51fa\u7684\u4f4d\u7f6e\u548c\u683c\u5f0f\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>directory</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u5199\u5165\u8f93\u51fa\u7684\u76ee\u6807\u76ee\u5f55\u3002\u5982\u679c\u8be5\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u521b\u5efa\u5b83\uff08\u4ee5\u53ca\u6240\u6709\u7f3a\u5931\u7684\u7236\u76ee\u5f55\uff09\u3002\u5982\u679c\u8be5\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002</p>\n<p lang=\"zh\">\u5f53\u5907\u4efd\u91c7\u7528 tar \u683c\u5f0f\u65f6\uff0c\u76ee\u6807\u76ee\u5f55\u53ef\u4ee5\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff08\u77ed\u6a2a\u7ebf\uff09\uff0c\u4ece\u800c\u5c06 tar \u6587\u4ef6\u5199\u5230<code class=\"literal\">stdout</code>\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u662f\u5fc5\u9700\u7684\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>format</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--format=<em class=\"replaceable\"><code>format</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u9009\u62e9\u8f93\u51fa\u683c\u5f0f\u3002<em class=\"replaceable\"><code>format</code></em>\u53ef\u4ee5\u662f\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">p</code><br/></span><span class=\"term\"><code class=\"literal\">plain</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u5199\u4e3a\u666e\u901a\u6587\u4ef6\uff0c\u5176\u5e03\u5c40\u4e0e\u6e90\u670d\u52a1\u5668\u7684\u6570\u636e\u76ee\u5f55\u548c\u8868\u7a7a\u95f4\u76f8\u540c\u3002\u5f53\u96c6\u7c07\u6ca1\u6709\u989d\u5916\u8868\u7a7a\u95f4\u65f6\uff0c\u6574\u4e2a\u6570\u636e\u5e93\u90fd\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u3002\u5982\u679c\u96c6\u7c07\u5305\u542b\u989d\u5916\u8868\u7a7a\u95f4\uff0c\u5219\u4e3b\u6570\u636e\u76ee\u5f55\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\uff0c\u800c\u5176\u4ed6\u6240\u6709\u8868\u7a7a\u95f4\u90fd\u4f1a\u653e\u5728\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u76f8\u540c\u7684\u7edd\u5bf9\u8def\u5f84\u4e2d\u3002\uff08\u5982\u9700\u6539\u53d8\u8fd9\u4e00\u70b9\uff0c\u89c1<code class=\"option\">--tablespace-mapping</code>\u3002\uff09</p>\n<p lang=\"zh\">\u8fd9\u662f\u9ed8\u8ba4\u683c\u5f0f\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">t</code><br/></span><span class=\"term\"><code class=\"literal\">tar</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u5199\u4e3a\u76ee\u6807\u76ee\u5f55\u4e2d\u7684 tar \u6587\u4ef6\u3002\u4e3b\u6570\u636e\u76ee\u5f55\u7684\u5185\u5bb9\u4f1a\u5199\u5165\u540d\u4e3a<code class=\"filename\">base.tar</code>\u7684\u6587\u4ef6\u4e2d\uff0c\u800c\u6bcf\u4e2a\u5176\u4ed6\u8868\u7a7a\u95f4\u90fd\u4f1a\u5199\u5165\u4e00\u4e2a\u4ee5\u8be5\u8868\u7a7a\u95f4 OID \u547d\u540d\u7684\u72ec\u7acb tar \u6587\u4ef6\u4e2d\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u76ee\u6807\u76ee\u5f55\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff08\u77ed\u6a2a\u7ebf\uff09\uff0ctar \u5185\u5bb9\u5c06\u5199\u5165\u6807\u51c6\u8f93\u51fa\uff0c\u9002\u5408\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u4f8b\u5982<span class=\"productname\">gzip</span>\u3002\u53ea\u6709\u5f53\u96c6\u7c07\u6ca1\u6709\u989d\u5916\u8868\u7a7a\u95f4\u4e14\u672a\u4f7f\u7528 WAL \u6d41\u5f0f\u4f20\u8f93\u65f6\uff0c\u624d\u5141\u8bb8\u8fd9\u6837\u505a\u3002</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-i <em class=\"replaceable\"><code>old_manifest_file</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--incremental=<em class=\"replaceable\"><code>old_manifest_file</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6267\u884c<a class=\"link\" href=\"/docs/19/continuous-archiving.html#BACKUP-INCREMENTAL-BACKUP\" title=\"25.3.3.\u00a0\u8fdb\u884c\u589e\u91cf\u5907\u4efd\">\u589e\u91cf\u5907\u4efd</a>\u3002\u5fc5\u987b\u63d0\u4f9b\u53c2\u8003\u5907\u4efd\u7684\u5907\u4efd\u6e05\u5355\uff1b\u8be5\u6587\u4ef6\u5c06\u88ab\u4e0a\u4f20\u5230\u670d\u52a1\u5668\uff0c\u968f\u540e\u670d\u52a1\u5668\u4f1a\u8fd4\u56de\u6240\u8bf7\u6c42\u7684\u589e\u91cf\u5907\u4efd\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code><br/></span><span class=\"term\"><code class=\"option\">--write-recovery-conf</code></span></dt>\n<dd>\n<p lang=\"zh\">\u521b\u5efa<a class=\"link\" href=\"/docs/19/warm-standby.html#FILE-STANDBY-SIGNAL\"><code class=\"filename\">standby.signal</code></a> <a class=\"indexterm\" id=\"id-1.9.4.10.6.2.1.4.3.1.2\" name=\"id-1.9.4.10.6.2.1.4.3.1.2\"></a>\u6587\u4ef6\uff0c\u5e76\u5c06\u8fde\u63a5\u8bbe\u7f6e\u8ffd\u52a0\u5230\u76ee\u6807\u76ee\u5f55\u4e2d\u7684<code class=\"filename\">postgresql.auto.conf</code>\u6587\u4ef6\u4e2d\uff08\u5982\u679c\u4f7f\u7528 tar \u683c\u5f0f\uff0c\u5219\u8ffd\u52a0\u5230\u57fa\u7840\u5f52\u6863\u6587\u4ef6\u5185\uff09\u3002\u8fd9\u6837\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u5229\u7528\u5907\u4efd\u7ed3\u679c\u642d\u5efa\u5907\u5e93\u3002</p>\n<p lang=\"zh\"><code class=\"filename\">postgresql.auto.conf</code>\u6587\u4ef6\u5c06\u8bb0\u5f55\u8fde\u63a5\u8bbe\u7f6e\uff0c\u4ee5\u53ca\uff08\u5982\u679c\u6307\u5b9a\uff09<span class=\"application\">pg_basebackup</span>\u6b63\u5728\u4f7f\u7528\u7684\u590d\u5236\u69fd\uff0c\u4ee5\u4fbf\u540e\u7eed\u7684\u6d41\u590d\u5236\u548c<a class=\"link\" href=\"/docs/19/logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS-SYNCHRONIZATION\" title=\"47.2.3.\u00a0\u590d\u5236\u69fd\u540c\u6b65\">\u903b\u8f91\u590d\u5236\u69fd\u540c\u6b65</a>\u4f7f\u7528\u76f8\u540c\u7684\u8bbe\u7f6e\u3002\u53ea\u6709\u5f53 dbname \u5728\u8fde\u63a5\u5b57\u7b26\u4e32\u6216<a class=\"link\" href=\"/docs/19/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u73af\u5883\u53d8\u91cf</a>\u4e2d\u88ab\u663e\u5f0f\u6307\u5b9a\u65f6\uff0c\u624d\u4f1a\u8bb0\u5f55 dbname\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t <em class=\"replaceable\"><code>target</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--target=<em class=\"replaceable\"><code>target</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u793a\u670d\u52a1\u5668\u5c06\u57fa\u7840\u5907\u4efd\u653e\u5230\u54ea\u91cc\u3002\u9ed8\u8ba4\u76ee\u6807\u662f<code class=\"literal\">client</code>\uff0c\u8868\u793a\u5907\u4efd\u5e94\u53d1\u9001\u5230\u8fd0\u884c<span class=\"application\">pg_basebackup</span>\u7684\u90a3\u53f0\u673a\u5668\u3002\u5982\u679c\u76ee\u6807\u6539\u4e3a<code class=\"literal\">server:/some/path</code>\uff0c\u5219\u5907\u4efd\u4f1a\u5b58\u50a8\u5728\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684<code class=\"literal\">/some/path</code>\u76ee\u5f55\u4e2d\u3002\u5c06\u5907\u4efd\u5b58\u50a8\u5728\u670d\u52a1\u5668\u4e0a\u9700\u8981\u8d85\u7ea7\u7528\u6237\u6743\u9650\uff0c\u6216\u62e5\u6709<code class=\"literal\">pg_write_server_files</code>\u89d2\u8272\u7684\u6743\u9650\u3002\u5982\u679c\u76ee\u6807\u8bbe\u7f6e\u4e3a<code class=\"literal\">blackhole</code>\uff0c\u5219\u5185\u5bb9\u4f1a\u88ab\u4e22\u5f03\uff0c\u4e0d\u4f1a\u5b58\u50a8\u5230\u4efb\u4f55\u5730\u65b9\u3002\u8fd9\u53ea\u5e94\u7528\u4e8e\u6d4b\u8bd5\u76ee\u7684\uff0c\u56e0\u4e3a\u6700\u7ec8\u4e0d\u4f1a\u5f97\u5230\u5b9e\u9645\u5907\u4efd\u3002</p>\n<p lang=\"zh\">\u7531\u4e8e WAL \u6d41\u5f0f\u4f20\u8f93\u662f\u7531<span class=\"application\">pg_basebackup</span>\u800c\u4e0d\u662f\u670d\u52a1\u5668\u5b9e\u73b0\u7684\uff0c\u56e0\u6b64\u6b64\u9009\u9879\u4e0d\u80fd\u4e0e<code class=\"literal\">-Xstream</code>\u4e00\u8d77\u4f7f\u7528\u3002\u7531\u4e8e\u540e\u8005\u662f\u9ed8\u8ba4\u503c\uff0c\u6240\u4ee5\u6307\u5b9a\u6b64\u9009\u9879\u65f6\uff0c\u8fd8\u5fc5\u987b\u540c\u65f6\u6307\u5b9a<code class=\"literal\">-Xfetch</code>\u6216<code class=\"literal\">-Xnone</code>\u4e4b\u4e00\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>olddir</code></em>=<em class=\"replaceable\"><code>newdir</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--tablespace-mapping=<em class=\"replaceable\"><code>olddir</code></em>=<em class=\"replaceable\"><code>newdir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u671f\u95f4\uff0c\u5c06\u76ee\u5f55<em class=\"replaceable\"><code>olddir</code></em>\u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230<em class=\"replaceable\"><code>newdir</code></em>\u3002\u8981\u4f7f\u6b64\u9009\u9879\u751f\u6548\uff0c<em class=\"replaceable\"><code>olddir</code></em>\u5fc5\u987b\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u5b9a\u4e49\u7684\u8be5\u8868\u7a7a\u95f4\u8def\u5f84\u5b8c\u5168\u4e00\u81f4\u3002\uff08\u4f46\u5982\u679c\u6e90\u670d\u52a1\u5668\u4e0a\u5728<em class=\"replaceable\"><code>olddir</code></em>\u4e2d\u6ca1\u6709\u8868\u7a7a\u95f4\uff0c\u4e5f\u4e0d\u7b97\u9519\u8bef\u3002\uff09\u4e0e\u6b64\u540c\u65f6\uff0c<em class=\"replaceable\"><code>newdir</code></em>\u662f\u63a5\u6536\u4e3b\u673a\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u4e00\u4e2a\u76ee\u5f55\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c<em class=\"replaceable\"><code>newdir</code></em>\u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002<em class=\"replaceable\"><code>olddir</code></em>\u548c<em class=\"replaceable\"><code>newdir</code></em>\u90fd\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u5982\u679c\u4efb\u4e00\u8def\u5f84\u4e2d\u9700\u8981\u5305\u542b\u7b49\u53f7\uff08<code class=\"literal\">=</code>\uff09\uff0c\u8bf7\u5728\u5176\u524d\u9762\u52a0\u4e0a\u53cd\u659c\u6760\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u4ee5\u5904\u7406\u591a\u4e2a\u8868\u7a7a\u95f4\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u91cd\u5b9a\u4f4d\u8868\u7a7a\u95f4\uff0c\u4e3b\u6570\u636e\u76ee\u5f55\u4e2d\u7684\u7b26\u53f7\u94fe\u63a5\u5c06\u88ab\u66f4\u65b0\u4e3a\u6307\u5411\u65b0\u4f4d\u7f6e\u3002\u56e0\u6b64\uff0c\u65b0\u6570\u636e\u76ee\u5f55\u5df2\u53ef\u76f4\u63a5\u7528\u4e8e\u542f\u52a8\u4e00\u4e2a\u6240\u6709\u8868\u7a7a\u95f4\u90fd\u4f4d\u4e8e\u66f4\u65b0\u540e\u4f4d\u7f6e\u7684\u65b0\u670d\u52a1\u5668\u5b9e\u4f8b\u3002</p>\n<p lang=\"zh\">\u76ee\u524d\uff0c\u6b64\u9009\u9879\u4ec5\u9002\u7528\u4e8e\u666e\u901a\u6587\u4ef6\u8f93\u51fa\u683c\u5f0f\uff1b\u5982\u679c\u9009\u62e9\u4e86 tar \u683c\u5f0f\uff0c\u5219\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--waldir=<em class=\"replaceable\"><code>waldir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5199\u5165 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cWAL \u6587\u4ef6\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u7684<code class=\"filename\">pg_wal</code>\u5b50\u76ee\u5f55\u4e2d\uff0c\u4f46\u6b64\u9009\u9879\u53ef\u7528\u4e8e\u5c06\u5176\u653e\u5728\u5176\u4ed6\u4f4d\u7f6e\u3002<em class=\"replaceable\"><code>waldir</code></em>\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c<em class=\"replaceable\"><code>waldir</code></em>\u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002\u53ea\u6709\u5f53\u5907\u4efd\u91c7\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u624d\u80fd\u6307\u5b9a\u6b64\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-X <em class=\"replaceable\"><code>method</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--wal-method=<em class=\"replaceable\"><code>method</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u4e2d\u5305\u542b\u6240\u9700\u7684 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u3002\u8fd9\u5c06\u5305\u62ec\u5907\u4efd\u671f\u95f4\u751f\u6210\u7684\u6240\u6709\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u9664\u975e\u6307\u5b9a\u65b9\u6cd5<code class=\"literal\">none</code>\uff0c\u5426\u5219\u5c31\u53ef\u4ee5\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u542f\u52a8 postmaster\uff0c\u800c\u65e0\u9700\u67e5\u9605 WAL \u5f52\u6863\uff0c\u4ece\u800c\u4f7f\u8f93\u51fa\u6210\u4e3a\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u5907\u4efd\u3002</p>\n<p lang=\"zh\">\u652f\u6301\u4ee5\u4e0b\u7528\u4e8e\u6536\u96c6\u9884\u5199\u5f0f\u65e5\u5fd7\u7684<em class=\"replaceable\"><code>method</code></em>\u503c\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">n</code><br/></span><span class=\"term\"><code class=\"literal\">none</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u5728\u5907\u4efd\u4e2d\u5305\u542b\u9884\u5199\u5f0f\u65e5\u5fd7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">f</code><br/></span><span class=\"term\"><code class=\"literal\">fetch</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u7ed3\u675f\u65f6\u6536\u96c6\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u3002\u56e0\u6b64\uff0c\u6e90\u670d\u52a1\u5668\u7684<a class=\"xref\" href=\"/docs/19/runtime-config-replication.html#GUC-WAL-KEEP-SIZE\">wal_keep_size</a>\u53c2\u6570\u5fc5\u987b\u8bbe\u7f6e\u5f97\u8db3\u591f\u9ad8\uff0c\u4ee5\u786e\u4fdd\u5728\u5907\u4efd\u7ed3\u675f\u524d\u4e0d\u4f1a\u79fb\u9664\u6240\u9700\u7684\u65e5\u5fd7\u6570\u636e\u3002\u5982\u679c\u5728\u4f20\u8f93\u8fd9\u4e9b\u6570\u636e\u4e4b\u524d\u5b83\u4eec\u5df2\u7ecf\u88ab\u56de\u6536\uff0c\u5219\u5907\u4efd\u4f1a\u5931\u8d25\u5e76\u4e14\u65e0\u6cd5\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u4f1a\u5305\u542b\u5728<code class=\"filename\">base.tar</code>\u6587\u4ef6\u4e2d\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">s</code><br/></span><span class=\"term\"><code class=\"literal\">stream</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u6267\u884c\u5907\u4efd\u7684\u540c\u65f6\u6d41\u5f0f\u4f20\u8f93\u9884\u5199\u5f0f\u65e5\u5fd7\u6570\u636e\u3002\u6b64\u65b9\u6cd5\u4f1a\u5411\u670d\u52a1\u5668\u6253\u5f00\u7b2c\u4e8c\u4e2a\u8fde\u63a5\uff0c\u5e76\u5728\u6267\u884c\u5907\u4efd\u65f6\u5e76\u884c\u5f00\u59cb\u6d41\u5f0f\u4f20\u8f93\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u56e0\u6b64\uff0c\u5b83\u9700\u8981\u4e24\u4e2a\u590d\u5236\u8fde\u63a5\uff0c\u800c\u4e0d\u53ea\u662f\u4e00\u4e2a\u3002\u53ea\u8981\u5ba2\u6237\u7aef\u80fd\u591f\u8ddf\u4e0a\u9884\u5199\u5f0f\u65e5\u5fd7\u6570\u636e\uff0c\u4f7f\u7528\u6b64\u65b9\u6cd5\u5c31\u4e0d\u9700\u8981\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u989d\u5916\u4fdd\u7559\u9884\u5199\u5f0f\u65e5\u5fd7\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u4f1a\u5199\u5165\u4e00\u4e2a\u540d\u4e3a<code class=\"filename\">pg_wal.tar</code>\u7684\u72ec\u7acb\u6587\u4ef6\u4e2d\uff08\u5982\u679c\u670d\u52a1\u5668\u7248\u672c\u65e9\u4e8e 10\uff0c\u5219\u6587\u4ef6\u540d\u4e3a<code class=\"filename\">pg_xlog.tar</code>\uff09\u3002</p>\n<p lang=\"zh\">\u8fd9\u662f\u9ed8\u8ba4\u503c\u3002</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-z</code><br/></span><span class=\"term\"><code class=\"option\">--gzip</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u4f7f\u7528\u9ed8\u8ba4\u538b\u7f29\u7ea7\u522b\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0<code class=\"filename\">.gz</code>\u540e\u7f00\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-Z <em class=\"replaceable\"><code>level</code></em></code><br/></span><span class=\"term\"><code class=\"option\">-Z [{client|server}-]<em class=\"replaceable\"><code>method</code></em>[:<em class=\"replaceable\"><code>detail</code></em>]</code><br/></span><span class=\"term\"><code class=\"option\">--compress=<em class=\"replaceable\"><code>level</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--compress=[{client|server}-]<em class=\"replaceable\"><code>method</code></em>[:<em class=\"replaceable\"><code>detail</code></em>]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bf7\u6c42\u5bf9\u5907\u4efd\u8fdb\u884c\u538b\u7f29\u3002\u5982\u679c\u5305\u542b<code class=\"literal\">client</code>\u6216<code class=\"literal\">server</code>\uff0c\u5219\u6307\u5b9a\u538b\u7f29\u6267\u884c\u7684\u4f4d\u7f6e\u3002\u5728\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4f1a\u51cf\u5c11\u4f20\u8f93\u5e26\u5bbd\u5360\u7528\uff0c\u4f46\u4f1a\u589e\u52a0\u670d\u52a1\u5668 CPU \u6d88\u8017\u3002\u9ed8\u8ba4\u503c\u662f<code class=\"literal\">client</code>\uff0c\u4f46\u4f7f\u7528<code class=\"literal\">--target</code>\u65f6\u9664\u5916\uff1b\u6b64\u65f6\u5907\u4efd\u4e0d\u4f1a\u53d1\u9001\u5230\u5ba2\u6237\u7aef\uff0c\u56e0\u6b64\u53ea\u6709\u670d\u52a1\u5668\u7aef\u538b\u7f29\u624d\u6709\u610f\u4e49\u3002\u4f7f\u7528\u9ed8\u8ba4\u7684<code class=\"literal\">-Xstream</code>\u65f6\uff0c\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4e0d\u4f1a\u5e94\u7528\u4e8e WAL\u3002\u82e5\u8981\u538b\u7f29 WAL\uff0c\u8bf7\u4f7f\u7528\u5ba2\u6237\u7aef\u538b\u7f29\uff0c\u6216\u8005\u6307\u5b9a<code class=\"literal\">-Xfetch</code>\u3002</p>\n<p lang=\"zh\">\u538b\u7f29\u65b9\u6cd5\u53ef\u4ee5\u8bbe\u7f6e\u4e3a<code class=\"literal\">gzip</code>\u3001<code class=\"literal\">lz4</code>\u3001<code class=\"literal\">zstd</code>\u3001<code class=\"literal\">none</code>\uff08\u4e0d\u538b\u7f29\uff09\uff0c\u4e5f\u53ef\u4ee5\u76f4\u63a5\u6307\u5b9a\u4e00\u4e2a\u6574\u6570\uff080 \u8868\u793a\u4e0d\u538b\u7f29\uff0c\u5927\u4e8e 0 \u8868\u793a<code class=\"literal\">gzip</code>\uff09\u3002\u8fd8\u53ef\u4ee5\u9009\u62e9\u6027\u5730\u6307\u5b9a\u538b\u7f29\u7ec6\u8282\u5b57\u7b26\u4e32\u3002\u5982\u679c\u7ec6\u8282\u5b57\u7b26\u4e32\u662f\u6574\u6570\uff0c\u5219\u8868\u793a\u538b\u7f29\u7ea7\u522b\uff1b\u5426\u5219\uff0c\u5b83\u5e94\u4e3a\u9017\u53f7\u5206\u9694\u7684\u9879\u76ee\u5217\u8868\uff0c\u6bcf\u9879\u7684\u5f62\u5f0f\u4e3a<em class=\"replaceable\"><code>keyword</code></em>\u6216<em class=\"replaceable\"><code>keyword=value</code></em>\u3002\u76ee\u524d\u652f\u6301\u7684\u5173\u952e\u5b57\u6709<code class=\"literal\">level</code>\u3001<code class=\"literal\">long</code>\u548c<code class=\"literal\">workers</code>\u3002\u5f53\u538b\u7f29\u65b9\u6cd5\u4ee5\u7eaf\u6574\u6570\u5f62\u5f0f\u6307\u5b9a\u65f6\uff0c\u4e0d\u80fd\u518d\u4f7f\u7528\u7ec6\u8282\u5b57\u7b26\u4e32\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u538b\u7f29\u7ea7\u522b\uff0c\u5c06\u4f7f\u7528\u9ed8\u8ba4\u7ea7\u522b\u3002\u5982\u679c\u53ea\u6307\u5b9a\u7ea7\u522b\u800c\u672a\u6307\u5b9a\u7b97\u6cd5\uff0c\u5219\u7ea7\u522b\u5927\u4e8e 0 \u65f6\u4f7f\u7528 gzip \u538b\u7f29\uff0c\u7ea7\u522b\u4e3a 0 \u65f6\u4e0d\u538b\u7f29\u3002</p>\n<p lang=\"zh\">\u5f53 tar \u683c\u5f0f\u914d\u5408<code class=\"literal\">gzip</code>\u3001<code class=\"literal\">lz4</code>\u6216<code class=\"literal\">zstd</code>\u4f7f\u7528\u65f6\uff0c\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u5206\u522b\u81ea\u52a8\u52a0\u4e0a<code class=\"filename\">.gz</code>\u3001<code class=\"filename\">.lz4</code>\u6216<code class=\"filename\">.zst</code>\u540e\u7f00\u3002\u4f7f\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u4e0d\u80fd\u6307\u5b9a\u5ba2\u6237\u7aef\u538b\u7f29\uff0c\u4f46\u4ecd\u53ef\u4ee5\u8bf7\u6c42\u670d\u52a1\u5668\u7aef\u538b\u7f29\u3002\u8fd9\u6837\u505a\u65f6\uff0c\u670d\u52a1\u5668\u4f1a\u5148\u538b\u7f29\u5907\u4efd\u518d\u4f20\u8f93\uff0c\u800c\u5ba2\u6237\u7aef\u4f1a\u5bf9\u5176\u8fdb\u884c\u89e3\u538b\u5e76\u63d0\u53d6\u3002</p>\n<p lang=\"zh\">\u5f53\u6b64\u9009\u9879\u4e0e<code class=\"literal\">-Xstream</code>\u7ec4\u5408\u4f7f\u7528\u65f6\uff0c\u5982\u679c\u9009\u62e9\u4e86\u5ba2\u6237\u7aef gzip \u538b\u7f29\uff0c\u5219<code class=\"literal\">pg_wal.tar</code>\u4f1a\u4f7f\u7528<code class=\"literal\">gzip</code>\u538b\u7f29\uff1b\u4f46\u5982\u679c\u9009\u62e9\u4e86\u5176\u4ed6\u538b\u7f29\u7b97\u6cd5\uff0c\u6216\u8005\u9009\u62e9\u4e86\u670d\u52a1\u5668\u7aef\u538b\u7f29\uff0c\u5219\u4e0d\u4f1a\u88ab\u538b\u7f29\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u5907\u4efd\u7684\u751f\u6210\u548c\u7a0b\u5e8f\u7684\u8c03\u7528\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-c {fast|spread}</code><br/></span><span class=\"term\"><code class=\"option\">--checkpoint={fast|spread}</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u68c0\u67e5\u70b9\u6a21\u5f0f\u8bbe\u7f6e\u4e3a fast \u6216 spread\uff08\u89c1<a class=\"xref\" href=\"/docs/19/continuous-archiving.html#BACKUP-LOWLEVEL-BASE-BACKUP\" title=\"25.3.4.\u00a0\u4f7f\u7528\u4f4e\u7ea7 API \u8fdb\u884c\u57fa\u7840\u5907\u4efd\">\u7b2c\u00a025.3.4\u00a0\u8282</a>\uff09\u3002\u9ed8\u8ba4\u503c\u4e3a spread\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--create-slot</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728\u5f00\u59cb\u5907\u4efd\u4e4b\u524d\uff0c\u5e94\u521b\u5efa\u7531<code class=\"literal\">--slot</code>\u9009\u9879\u6307\u5b9a\u540d\u79f0\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u8be5\u69fd\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u9519\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>label</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--label=<em class=\"replaceable\"><code>label</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5907\u4efd\u6807\u7b7e\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u503c<span class=\"quote\">\u201c<span class=\"quote\"><code class=\"literal\">pg_basebackup base backup</code></span>\u201d</span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-clean</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53<code class=\"command\">pg_basebackup</code>\u56e0\u9519\u8bef\u4e2d\u6b62\u65f6\uff0c\u5b83\u4f1a\u5220\u9664\u5728\u53d1\u73b0\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u76ee\u5f55\uff08\u4f8b\u5982\u76ee\u6807\u76ee\u5f55\u548c\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\uff09\u3002\u6b64\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u5f88\u6709\u5e2e\u52a9\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u65e0\u8bba\u662f\u5426\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u8868\u7a7a\u95f4\u76ee\u5f55\u90fd\u4e0d\u4f1a\u88ab\u6e05\u7406\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N</code><br/></span><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">pg_basebackup</code>\u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u88ab\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f1a\u4f7f<code class=\"command\">pg_basebackup</code>\u4e0d\u7ecf\u7b49\u5f85\u5c31\u76f4\u63a5\u8fd4\u56de\uff0c\u56e0\u6b64\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u968f\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u57fa\u7840\u5907\u4efd\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u5408\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P</code><br/></span><span class=\"term\"><code class=\"option\">--progress</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528\u8fdb\u5ea6\u62a5\u544a\u3002\u6253\u5f00\u6b64\u9009\u9879\u540e\uff0c\u4f1a\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u7ed9\u51fa\u4e00\u4e2a\u8fd1\u4f3c\u7684\u8fdb\u5ea6\u62a5\u544a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u53d1\u751f\u53d8\u5316\uff0c\u56e0\u6b64\u8fd9\u53ea\u662f\u8fd1\u4f3c\u503c\uff0c\u6700\u7ec8\u672a\u5fc5\u6070\u597d\u7ed3\u675f\u5728<code class=\"literal\">100%</code>\u3002\u7279\u522b\u662f\u5f53\u5907\u4efd\u4e2d\u5305\u542b WAL \u65f6\uff0c\u603b\u6570\u636e\u91cf\u65e0\u6cd5\u9884\u5148\u4f30\u8ba1\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u65e6\u8fdb\u5ea6\u8d85\u8fc7\u4e0d\u542b WAL \u65f6\u7684\u603b\u4f30\u8ba1\u503c\uff0c\u4f30\u8ba1\u76ee\u6807\u5927\u5c0f\u5c31\u4f1a\u7ee7\u7eed\u589e\u52a0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r <em class=\"replaceable\"><code>rate</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--max-rate=<em class=\"replaceable\"><code>rate</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u4ece\u6e90\u670d\u52a1\u5668\u6536\u96c6\u6570\u636e\u65f6\u5141\u8bb8\u7684\u6700\u5927\u4f20\u8f93\u901f\u7387\u3002\u8fd9\u6709\u52a9\u4e8e\u9650\u5236<span class=\"application\">pg_basebackup</span>\u5bf9\u670d\u52a1\u5668\u7684\u5f71\u54cd\u3002\u53d6\u503c\u5355\u4f4d\u4e3a\u6bcf\u79d2\u5343\u5b57\u8282\u3002\u4f7f\u7528\u540e\u7f00<code class=\"literal\">M</code>\u8868\u793a\u6bcf\u79d2\u5146\u5b57\u8282\u3002\u4e5f\u63a5\u53d7\u540e\u7f00<code class=\"literal\">k</code>\uff0c\u4f46\u6ca1\u6709\u5b9e\u9645\u5f71\u54cd\u3002\u6709\u6548\u53d6\u503c\u8303\u56f4\u4e3a\u6bcf\u79d2 32 \u5343\u5b57\u8282\u5230\u6bcf\u79d2 1024 \u5146\u5b57\u8282\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u59cb\u7ec8\u5f71\u54cd\u6570\u636e\u76ee\u5f55\u7684\u4f20\u8f93\u3002\u53ea\u6709\u5f53\u6536\u96c6\u65b9\u6cd5\u4e3a<code class=\"literal\">fetch</code>\u65f6\uff0cWAL \u6587\u4ef6\u7684\u4f20\u8f93\u624d\u4f1a\u53d7\u5230\u5f71\u54cd\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>slotname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--slot=<em class=\"replaceable\"><code>slotname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u53ea\u80fd\u4e0e<code class=\"literal\">-X stream</code>\u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u4f1a\u4f7f WAL \u6d41\u5f0f\u4f20\u8f93\u4f7f\u7528\u6307\u5b9a\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u6b64\u57fa\u7840\u5907\u4efd\u6253\u7b97\u7528\u4f5c\u4f7f\u7528\u590d\u5236\u69fd\u7684\u6d41\u590d\u5236\u5907\u5e93\uff0c\u90a3\u4e48\u8be5\u5907\u5e93\u5e94\u5c06\u540c\u4e00\u4e2a\u590d\u5236\u69fd\u540d\u79f0\u7528\u4f5c<a class=\"xref\" href=\"/docs/19/runtime-config-replication.html#GUC-PRIMARY-SLOT-NAME\">primary_slot_name</a>\u7684\u503c\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u4e3b\u5e93\u5728\u57fa\u7840\u5907\u4efd\u7ed3\u675f\u4e0e\u65b0\u5907\u5e93\u5f00\u59cb\u6d41\u590d\u5236\u4e4b\u95f4\u7684\u8fd9\u6bb5\u65f6\u95f4\u5185\uff0c\u4e0d\u4f1a\u79fb\u9664\u4efb\u4f55\u5fc5\u9700\u7684 WAL \u6570\u636e\u3002</p>\n<p lang=\"zh\">\u6307\u5b9a\u7684\u590d\u5236\u69fd\u5fc5\u987b\u5df2\u7ecf\u5b58\u5728\uff0c\u9664\u975e\u8fd8\u540c\u65f6\u4f7f\u7528\u4e86<code class=\"option\">-C</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5e76\u4e14\u670d\u52a1\u5668\u652f\u6301\u4e34\u65f6\u590d\u5236\u69fd\uff0810 \u53ca\u4ee5\u4e0a\u7248\u672c\uff09\uff0c\u5219\u4f1a\u81ea\u52a8\u4f7f\u7528\u4e34\u65f6\u590d\u5236\u69fd\u8fdb\u884c WAL \u6d41\u5f0f\u4f20\u8f93\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--sync-method=<em class=\"replaceable\"><code>method</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u4e3a<code class=\"literal\">fsync</code>\uff08\u9ed8\u8ba4\uff09\u65f6\uff0c<code class=\"command\">pg_basebackup</code>\u4f1a\u9012\u5f52\u6253\u5f00\u5e76\u540c\u6b65\u5907\u4efd\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3002\u4f7f\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u67e5\u627e\u6587\u4ef6\u4f1a\u8ddf\u968f WAL \u76ee\u5f55\u548c\u5404\u5df2\u914d\u7f6e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u3002</p>\n<p lang=\"zh\">\u5728 Linux \u4e0a\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528<code class=\"literal\">syncfs</code>\uff0c\u8ba9\u64cd\u4f5c\u7cfb\u7edf\u540c\u6b65\u5305\u542b\u5907\u4efd\u76ee\u5f55\u7684\u6574\u4e2a\u6587\u4ef6\u7cfb\u7edf\u3002\u4f7f\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c<code class=\"command\">pg_basebackup</code>\u8fd8\u4f1a\u540c\u6b65\u5305\u542b WAL \u6587\u4ef6\u548c\u5404\u8868\u7a7a\u95f4\u7684\u6587\u4ef6\u7cfb\u7edf\u3002\u5173\u4e8e\u4f7f\u7528<code class=\"literal\">syncfs</code>\u65f6\u9700\u8981\u6ce8\u610f\u7684\u4e8b\u9879\uff0c\u89c1<a class=\"xref\" href=\"/docs/19/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\">recovery_init_sync_method</a>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--no-sync</code>\u65f6\uff0c\u6b64\u9009\u9879\u65e0\u6548\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\u3002\u5b83\u4f1a\u5728\u542f\u52a8\u548c\u5173\u95ed\u8fc7\u7a0b\u4e2d\u8f93\u51fa\u4e00\u4e9b\u989d\u5916\u6b65\u9aa4\uff1b\u5982\u679c\u540c\u65f6\u542f\u7528\u4e86\u8fdb\u5ea6\u62a5\u544a\uff0c\u8fd8\u4f1a\u663e\u793a\u5f53\u524d\u6b63\u5728\u5904\u7406\u7684\u786e\u5207\u6587\u4ef6\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--manifest-checksums=<em class=\"replaceable\"><code>algorithm</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u5e94\u7528\u5230\u5907\u4efd\u6e05\u5355\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u7684\u6821\u9a8c\u548c\u7b97\u6cd5\u3002\u76ee\u524d\u53ef\u7528\u7684\u7b97\u6cd5\u6709<code class=\"literal\">NONE</code>\u3001<code class=\"literal\">CRC32C</code>\u3001<code class=\"literal\">SHA224</code>\u3001<code class=\"literal\">SHA256</code>\u3001<code class=\"literal\">SHA384</code>\u548c<code class=\"literal\">SHA512</code>\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">CRC32C</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">NONE</code>\uff0c\u5907\u4efd\u6e05\u5355\u5c06\u4e0d\u5305\u542b\u4efb\u4f55\u6821\u9a8c\u548c\u3002\u5426\u5219\uff0c\u5b83\u5c06\u5305\u542b\u4f7f\u7528\u6307\u5b9a\u7b97\u6cd5\u4e3a\u5907\u4efd\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u8ba1\u7b97\u7684\u6821\u9a8c\u548c\u3002\u6b64\u5916\uff0c\u6e05\u5355\u59cb\u7ec8\u4f1a\u5305\u542b\u5176\u81ea\u8eab\u5185\u5bb9\u7684<code class=\"literal\">SHA256</code>\u6821\u9a8c\u548c\u3002<code class=\"literal\">SHA</code>\u7b97\u6cd5\u660e\u663e\u6bd4<code class=\"literal\">CRC32C</code>\u66f4\u8017\u8d39 CPU\uff0c\u56e0\u6b64\u9009\u62e9\u5176\u4e2d\u4e00\u79cd\u53ef\u80fd\u4f1a\u589e\u52a0\u5b8c\u6210\u5907\u4efd\u6240\u9700\u7684\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u5e0c\u671b\u9a8c\u8bc1\u5907\u4efd\u672a\u88ab\u7be1\u6539\u7684\u7528\u6237\uff0c\u4f7f\u7528 SHA hash \u51fd\u6570\u53ef\u4ee5\u4e3a\u6bcf\u4e2a\u6587\u4ef6\u63d0\u4f9b\u5177\u6709\u5bc6\u7801\u5b66\u5b89\u5168\u6027\u7684\u6458\u8981\uff1b\u800c CRC-32C \u7b97\u6cd5\u63d0\u4f9b\u7684\u6821\u9a8c\u548c\u8ba1\u7b97\u901f\u5ea6\u8981\u5feb\u5f97\u591a\uff0c\u867d\u7136\u5b83\u5f88\u9002\u5408\u53d1\u73b0\u7531\u4e8e\u610f\u5916\u6539\u52a8\u9020\u6210\u7684\u9519\u8bef\uff0c\u4f46\u5e76\u4e0d\u80fd\u62b5\u5fa1\u6076\u610f\u4fee\u6539\u3002\u8bf7\u6ce8\u610f\uff0c\u8981\u60f3\u5bf9\u80fd\u591f\u8bbf\u95ee\u5907\u4efd\u7684\u653b\u51fb\u8005\u5f62\u6210\u9632\u62a4\uff0c\u5907\u4efd\u6e05\u5355\u5c31\u9700\u8981\u5b89\u5168\u5730\u4fdd\u5b58\u5728\u5176\u4ed6\u5730\u65b9\uff0c\u6216\u8005\u4ee5\u5176\u4ed6\u65b9\u5f0f\u786e\u8ba4\u81ea\u5907\u4efd\u5b8c\u6210\u540e\u672a\u88ab\u4fee\u6539\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528<a class=\"xref\" href=\"/docs/19/app-pgverifybackup.html\" title=\"pg_verifybackup\"><span class=\"refentrytitle\"><span class=\"application\">pg_verifybackup</span></span></a>\u6839\u636e\u5907\u4efd\u6e05\u5355\u68c0\u67e5\u5907\u4efd\u7684\u5b8c\u6574\u6027\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--manifest-force-encode</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f3a\u5236\u5c06\u5907\u4efd\u6e05\u5355\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u540d\u7f16\u7801\u4e3a\u5341\u516d\u8fdb\u5236\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u5bf9\u975e UTF8 \u6587\u4ef6\u540d\u8fdb\u884c\u5341\u516d\u8fdb\u5236\u7f16\u7801\u3002\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u8bfb\u53d6\u5907\u4efd\u6e05\u5355\u6587\u4ef6\u7684\u5de5\u5177\u662f\u5426\u80fd\u6b63\u786e\u5904\u7406\u8fd9\u79cd\u60c5\u51b5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-estimate-size</code></span></dt>\n<dd>\n<p lang=\"zh\">\u7981\u6b62\u670d\u52a1\u5668\u4f30\u7b97\u5c06\u8981\u6d41\u5f0f\u4f20\u8f93\u7684\u5907\u4efd\u6570\u636e\u603b\u91cf\uff0c\u56e0\u6b64 pg_stat_progress_basebackup \u89c6\u56fe\u4e2d\u7684 backup_total \u5217\u59cb\u7ec8\u4e3a NULL\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5907\u4efd\u4f1a\u5148\u679a\u4e3e\u6574\u4e2a\u6570\u636e\u5e93\u7684\u5927\u5c0f\uff0c\u7136\u540e\u518d\u56de\u8fc7\u5934\u6765\u53d1\u9001\u5b9e\u9645\u5185\u5bb9\u3002\u8fd9\u53ef\u80fd\u4f1a\u8ba9\u5907\u4efd\u8017\u65f6\u7565\u957f\uff0c\u7279\u522b\u662f\u5728\u53d1\u9001\u7b2c\u4e00\u6279\u6570\u636e\u4e4b\u524d\u6240\u9700\u65f6\u95f4\u4f1a\u66f4\u4e45\u3002\u5982\u679c\u8fd9\u79cd\u4f30\u7b97\u8017\u65f6\u8fc7\u957f\uff0c\u6b64\u9009\u9879\u5c31\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u5b83\u53ef\u4ee5\u907f\u514d\u8fd9\u6bb5\u4f30\u7b97\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--progress</code>\u65f6\uff0c\u4e0d\u5141\u8bb8\u4f7f\u7528\u6b64\u9009\u9879\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-manifest</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7981\u6b62\u751f\u6210\u5907\u4efd\u6e05\u5355\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u670d\u52a1\u5668\u5c06\u751f\u6210\u5e76\u53d1\u9001\u4e00\u4e2a\u5907\u4efd\u6e05\u5355\uff0c\u53ef\u4f7f\u7528<a class=\"xref\" href=\"/docs/19/app-pgverifybackup.html\" title=\"pg_verifybackup\"><span class=\"refentrytitle\"><span class=\"application\">pg_verifybackup</span></span></a>\u8fdb\u884c\u9a8c\u8bc1\u3002\u8be5\u6e05\u5355\u5217\u51fa\u4e86\u5907\u4efd\u4e2d\u7684\u6bcf\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u4e0d\u5305\u62ec\u53ef\u80fd\u5305\u542b\u5728\u5176\u4e2d\u7684\u4efb\u4f55 WAL \u6587\u4ef6\u3002\u5b83\u8fd8\u4f1a\u4fdd\u5b58\u6bcf\u4e2a\u6587\u4ef6\u7684\u5927\u5c0f\u3001\u6700\u540e\u4fee\u6539\u65f6\u95f4\u4ee5\u53ca\u53ef\u9009\u7684\u6821\u9a8c\u548c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-slot</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9632\u6b62\u4e3a\u5907\u4efd\u521b\u5efa\u4e34\u65f6\u590d\u5236\u69fd\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u9009\u62e9\u4e86 WAL \u6d41\u5f0f\u4f20\u8f93\uff0c\u4f46\u6ca1\u6709\u4f7f\u7528<code class=\"option\">-S</code>\u9009\u9879\u7ed9\u51fa\u69fd\u540d\uff0c\u90a3\u4e48\u4f1a\u521b\u5efa\u4e00\u4e2a\u4e34\u65f6\u590d\u5236\u69fd\uff08\u5982\u679c\u6e90\u670d\u52a1\u5668\u652f\u6301\uff09\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7684\u4e3b\u8981\u76ee\u7684\u662f\u5728\u670d\u52a1\u5668\u6ca1\u6709\u7a7a\u95f2\u590d\u5236\u69fd\u65f6\uff0c\u4ecd\u7136\u5141\u8bb8\u6267\u884c\u57fa\u7840\u5907\u4efd\u3002\u51e0\u4e4e\u603b\u662f\u9996\u9009\u4f7f\u7528\u590d\u5236\u69fd\uff0c\u56e0\u4e3a\u5b83\u80fd\u9632\u6b62\u670d\u52a1\u5668\u5728\u5907\u4efd\u671f\u95f4\u79fb\u9664\u6240\u9700\u7684 WAL\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-verify-checksums</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u83b7\u53d6\u57fa\u7840\u5907\u4efd\u7684\u670d\u52a1\u5668\u542f\u7528\u4e86\u6821\u9a8c\u548c\uff0c\u5219\u7981\u7528\u5bf9\u8fd9\u4e9b\u6821\u9a8c\u548c\u7684\u9a8c\u8bc1\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f1a\u9a8c\u8bc1\u6821\u9a8c\u548c\uff1b\u6821\u9a8c\u548c\u9a8c\u8bc1\u5931\u8d25\u5c06\u5bfc\u81f4\u975e\u96f6\u9000\u51fa\u72b6\u6001\u3002\u4e0d\u8fc7\uff0c\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u57fa\u7840\u5907\u4efd\u4e0d\u4f1a\u88ab\u5220\u9664\uff0c\u5c31\u50cf\u4f7f\u7528\u4e86<code class=\"option\">--no-clean</code>\u4e00\u6837\u3002\u6821\u9a8c\u548c\u9a8c\u8bc1\u5931\u8d25\u4e5f\u4f1a\u5728<a class=\"link\" href=\"/docs/19/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW\" title=\"27.2.19.\u00a0pg_stat_database\"><code class=\"structname\">pg_stat_database</code></a>\u89c6\u56fe\u4e2d\u62a5\u544a\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u5230\u6e90\u670d\u52a1\u5668\u7684\u8fde\u63a5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>connstr</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>connstr</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ee5<a class=\"link\" href=\"/docs/19/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u7684\u5f62\u5f0f\u6307\u5b9a\u7528\u4e8e\u8fde\u63a5\u670d\u52a1\u5668\u7684\u53c2\u6570\uff1b\u8fd9\u4e9b\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u76f8\u4e92\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u51fa\u4e8e\u4e0e\u5176\u4ed6\u5ba2\u6237\u7aef\u5e94\u7528\u4fdd\u6301\u4e00\u81f4\u7684\u8003\u8651\uff0c\u6b64\u9009\u9879\u540d\u4e3a<code class=\"literal\">--dbname</code>\uff1b\u4f46\u7531\u4e8e<span class=\"application\">pg_basebackup</span>\u5e76\u4e0d\u8fde\u63a5\u5230\u96c6\u7c07\u4e2d\u7684\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u7684\u6570\u636e\u5e93\u540d\u4f1a\u88ab\u670d\u52a1\u5668\u5ffd\u7565\u3002\u4e0d\u8fc7\uff0c\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u63d0\u4f9b\u7684\u6570\u636e\u5e93\u540d\u4f1a\u8986\u76d6\u9ed8\u8ba4\u6570\u636e\u5e93\u540d\uff08<code class=\"literal\">replication</code>\uff09\uff0c\u4ece\u800c\u7528\u4e8e\u5728<code class=\"filename\">~/.pgpass</code>\u4e2d\u67e5\u627e\u590d\u5236\u8fde\u63a5\u7684\u5bc6\u7801\u3002\u7c7b\u4f3c\u5730\uff0c\u8fde\u63a5<span class=\"productname\">PostgreSQL</span>\u65f6\u4f7f\u7528\u7684\u4e2d\u95f4\u4ef6\u6216\u4ee3\u7406\uff0c\u4e5f\u53ef\u80fd\u51fa\u4e8e\u8fde\u63a5\u8def\u7531\u7b49\u76ee\u7684\u4f7f\u7528\u8be5\u540d\u79f0\u3002\u8be5\u6570\u636e\u5e93\u540d\u4e5f\u53ef\u4f9b<a class=\"link\" href=\"/docs/19/logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS-SYNCHRONIZATION\" title=\"47.2.3.\u00a0\u590d\u5236\u69fd\u540c\u6b65\">\u903b\u8f91\u590d\u5236\u69fd\u540c\u6b65</a>\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea<code class=\"envar\">PGHOST</code>\u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff1b\u5426\u5219\u4f1a\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u6240\u4f7f\u7528\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u4f7f\u7528<code class=\"envar\">PGPORT</code>\u73af\u5883\u53d8\u91cf\u4e2d\u7684\u503c\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u786e\u5b9a\u7684\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s <em class=\"replaceable\"><code>interval</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--status-interval=<em class=\"replaceable\"><code>interval</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u53d1\u9001\u56de\u6e90\u670d\u52a1\u5668\u7684\u72b6\u6001\u5305\u4e4b\u95f4\u76f8\u9694\u7684\u79d2\u6570\u3002\u8f83\u5c0f\u7684\u503c\u53ef\u4ee5\u8ba9\u670d\u52a1\u5668\u7aef\u5bf9\u5907\u4efd\u8fdb\u5ea6\u7684\u76d1\u63a7\u66f4\u7cbe\u786e\u3002\u503c\u4e3a\u96f6\u65f6\u4f1a\u5b8c\u5168\u7981\u7528\u5468\u671f\u6027\u72b6\u6001\u66f4\u65b0\uff0c\u4e0d\u8fc7\u5f53\u670d\u52a1\u5668\u8bf7\u6c42\u65f6\u4ecd\u4f1a\u53d1\u9001\u66f4\u65b0\uff0c\u4ee5\u907f\u514d\u56e0\u8d85\u65f6\u800c\u65ad\u5f00\u8fde\u63a5\u3002\u9ed8\u8ba4\u503c\u662f 10 \u79d2\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7981\u6b62\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\uff08\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff09\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u6b64\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u79cd\u573a\u666f\u4e0b\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236<span class=\"application\">pg_basebackup</span>\u5728\u8fde\u63a5\u6e90\u670d\u52a1\u5668\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7edd\u975e\u5fc5\u9700\uff0c\u56e0\u4e3a\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u81ea\u52a8\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\u6765\u53d1\u73b0\u670d\u52a1\u5668\u9700\u8981\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u8f93\u5165<code class=\"option\">-W</code>\u4ee5\u907f\u514d\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u662f\u503c\u5f97\u7684\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5176\u4ed6\u9009\u9879\u4e5f\u53ef\u7528\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa<span class=\"application\">pg_basebackup</span>\u7684\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"application\">pg_basebackup</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6<span class=\"productname\">PostgreSQL</span>\u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528<span class=\"application\">libpq</span>\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/19/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.15\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\">\u73af\u5883\u53d8\u91cf<code class=\"envar\">PG_COLOR</code>\u6307\u5b9a\u662f\u5426\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a<code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c<code class=\"literal\">never</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u5728\u5907\u4efd\u5f00\u59cb\u65f6\uff0c\u9700\u8981\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u6267\u884c\u4e00\u6b21\u68c0\u67e5\u70b9\u3002\u8fd9\u53ef\u80fd\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\uff08\u5c24\u5176\u662f\u5728\u672a\u4f7f\u7528<code class=\"literal\">--checkpoint=fast</code>\u9009\u9879\u65f6\uff09\uff1b\u5728\u6b64\u671f\u95f4\uff0c<span class=\"application\">pg_basebackup</span>\u770b\u8d77\u6765\u4f1a\u5904\u4e8e\u7a7a\u95f2\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u5907\u4efd\u5c06\u5305\u62ec\u6570\u636e\u76ee\u5f55\u548c\u8868\u7a7a\u95f4\u4e2d\u7684\u6240\u6709\u6587\u4ef6\uff0c\u5305\u62ec\u914d\u7f6e\u6587\u4ef6\u4ee5\u53ca\u7b2c\u4e09\u65b9\u653e\u5728\u8fd9\u4e9b\u76ee\u5f55\u4e2d\u7684\u4efb\u4f55\u989d\u5916\u6587\u4ef6\uff0c\u4f46\u7531 PostgreSQL \u7ba1\u7406\u7684\u67d0\u4e9b\u4e34\u65f6\u6587\u4ef6\u548c\u64cd\u4f5c\u7cfb\u7edf\u6587\u4ef6\u9664\u5916\u3002\u4e0d\u8fc7\uff0c\u53ea\u6709\u666e\u901a\u6587\u4ef6\u548c\u76ee\u5f55\u4f1a\u88ab\u590d\u5236\uff0c\u4f46\u7528\u4e8e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u4f1a\u88ab\u4fdd\u7559\u3002\u6307\u5411 PostgreSQL \u5df2\u77e5\u7684\u67d0\u4e9b\u76ee\u5f55\u7684\u7b26\u53f7\u94fe\u63a5\u4f1a\u88ab\u590d\u5236\u4e3a\u7a7a\u76ee\u5f55\u3002\u5176\u4ed6\u7b26\u53f7\u94fe\u63a5\u548c\u7279\u6b8a\u8bbe\u5907\u6587\u4ef6\u5219\u4f1a\u88ab\u8df3\u8fc7\u3002\u5177\u4f53\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/19/protocol-replication.html\" title=\"54.4.\u00a0\u6d41\u590d\u5236\u534f\u8bae\">\u7b2c\u00a054.4\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5728\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u4e2d\uff0c\u9664\u975e\u4f7f\u7528\u4e86<code class=\"literal\">--tablespace-mapping</code>\u9009\u9879\uff0c\u5426\u5219\u8868\u7a7a\u95f4\u4f1a\u5907\u4efd\u5230\u5176\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u7684\u76f8\u540c\u8def\u5f84\u3002\u5982\u679c\u4e0d\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u90a3\u4e48\u5f53\u8868\u7a7a\u95f4\u6b63\u5728\u4f7f\u7528\u65f6\uff0c\u5c31\u65e0\u6cd5\u5728\u4e0e\u670d\u52a1\u5668\u76f8\u540c\u7684\u4e3b\u673a\u4e0a\u6267\u884c\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u7684\u57fa\u7840\u5907\u4efd\uff0c\u56e0\u4e3a\u5907\u4efd\u5c06\u4e0d\u5f97\u4e0d\u5199\u5165\u4e0e\u539f\u59cb\u8868\u7a7a\u95f4\u76f8\u540c\u7684\u76ee\u5f55\u4f4d\u7f6e\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u7528\u6237\u9700\u8981\u5728\u542f\u52a8\u4f7f\u7528\u8fd9\u4e9b\u6570\u636e\u7684 PostgreSQL \u670d\u52a1\u5668\u4e4b\u524d\uff0c\u81ea\u884c\u89e3\u5f00\u6bcf\u4e2a tar \u6587\u4ef6\u3002\u5982\u679c\u5b58\u5728\u989d\u5916\u7684\u8868\u7a7a\u95f4\uff0c\u5fc5\u987b\u5c06\u5bf9\u5e94\u7684 tar \u6587\u4ef6\u89e3\u538b\u5230\u6b63\u786e\u4f4d\u7f6e\u3002\u6b64\u65f6\uff0c\u670d\u52a1\u5668\u4f1a\u6839\u636e base.tar \u4e2d tablespace_map \u6587\u4ef6\u7684\u5185\u5bb9\uff0c\u4e3a\u8fd9\u4e9b\u8868\u7a7a\u95f4\u521b\u5efa\u7b26\u53f7\u94fe\u63a5\u3002</p>\n<p lang=\"zh\">pg_basebackup \u53ef\u4e0e\u76f8\u540c\u6216\u66f4\u65e9\u4e3b\u8981\u7248\u672c\u7684\u670d\u52a1\u5668\u914d\u5408\u4f7f\u7528\uff0c\u6700\u4f4e\u652f\u6301 9.1\u3002\u4e0d\u8fc7\uff0cWAL \u6d41\u5f0f\u4f20\u8f93\u6a21\u5f0f\uff08-X stream\uff09\u53ea\u9002\u7528\u4e8e 9.3 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\uff0ctar \u683c\u5f0f\uff08--format=tar\uff09\u53ea\u9002\u7528\u4e8e 9.5 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\uff0c\u589e\u91cf\u5907\u4efd\uff08--incremental\uff09\u53ea\u9002\u7528\u4e8e 17 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6e90\u96c6\u7c07\u542f\u7528\u4e86\u6570\u636e\u6587\u4ef6\u7684\u7ec4\u6743\u9650\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u4fdd\u7559\u8fd9\u4e9b\u7ec4\u6743\u9650\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.9\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u8981\u4e3a\u670d\u52a1\u5668<code class=\"literal\">mydbserver</code>\u521b\u5efa\u4e00\u4e2a\u57fa\u7840\u5907\u4efd\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5230\u672c\u5730\u76ee\u5f55<code class=\"filename\">/usr/local/pgsql/data</code>\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -h mydbserver -D /usr/local/pgsql/data</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u672c\u5730\u670d\u52a1\u5668\u521b\u5efa\u4e00\u4e2a\u5907\u4efd\uff0c\u4e3a\u6bcf\u4e2a\u8868\u7a7a\u95f4\u5404\u751f\u6210\u4e00\u4e2a\u538b\u7f29\u7684 tar \u6587\u4ef6\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5728\u76ee\u5f55<code class=\"filename\">backup</code>\u4e2d\uff0c\u540c\u65f6\u5728\u8fd0\u884c\u671f\u95f4\u663e\u793a\u8fdb\u5ea6\u62a5\u544a\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup -Ft -z -P</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u4e00\u4e2a\u4ec5\u5305\u542b\u5355\u4e2a\u8868\u7a7a\u95f4\u7684\u672c\u5730\u6570\u636e\u5e93\u521b\u5efa\u5907\u4efd\uff0c\u5e76\u4f7f\u7528<span class=\"productname\">bzip2</span>\u8fdb\u884c\u538b\u7f29\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D - -Ft -X fetch | bzip2 &gt; backup.tar.bz2</code></strong>\n</pre>\n<p lang=\"zh\">\uff08\u5982\u679c\u8be5\u6570\u636e\u5e93\u4e2d\u6709\u591a\u4e2a\u8868\u7a7a\u95f4\uff0c\u6b64\u547d\u4ee4\u5c06\u5931\u8d25\u3002\uff09</p>\n<p lang=\"zh\">\u8981\u521b\u5efa\u4e00\u4e2a\u672c\u5730\u6570\u636e\u5e93\u7684\u5907\u4efd\uff0c\u5e76\u5c06\u4f4d\u4e8e<code class=\"filename\">/opt/ts</code>\u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230<code class=\"filename\">./backup/ts</code>\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup/data -T /opt/ts=$(pwd)/backup/ts</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u672c\u5730\u670d\u52a1\u5668\u521b\u5efa\u4e00\u4e2a\u5907\u4efd\uff0c\u4e3a\u6bcf\u4e2a\u8868\u7a7a\u95f4\u751f\u6210\u4e00\u4e2a tar \u6587\u4ef6\uff0c\u5e76\u4f7f\u7528<span class=\"application\">gzip</span>\u4ee5 9 \u7ea7\u538b\u7f29\u540e\u5b58\u50a8\u5230\u76ee\u5f55<code class=\"filename\">backup</code>\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup -Ft --compress=gzip:9</code></strong>\n</pre>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.10\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/19/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/19/progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING\" title=\"27.4.7.\u00a0Base Backup Progress Reporting\">Section\u00a027.4.7</a></span>\n</div>\n</div></div>", "manual_path": "app-pgbasebackup.html", "localization": {"status": "complete", "sources": [{"url": "/docs/19/app-pgbasebackup.html", "method": "same-major semantic node", "sha256": "79e09fba6b4fc18b52f8dddc5ff4c025c5af7dadd9511d18620efa9fd7a2ecff", "language": "zh", "matched_nodes": ["#APP-PGBASEBACKUP/div[2]/p[1]", "#APP-PGBASEBACKUP/div[3]/h2[0]", "#APP-PGBASEBACKUP/div[4]/div[8]/ul[0]/li[0]", "#APP-PGBASEBACKUP/div[4]/div[8]/ul[0]/li[1]", "#APP-PGBASEBACKUP/div[4]/div[8]/ul[0]/li[2]", "#APP-PGBASEBACKUP/div[4]/div[8]/ul[0]/li[3]", "#APP-PGBASEBACKUP/div[4]/p[1]", "#APP-PGBASEBACKUP/div[4]/p[2]", "#APP-PGBASEBACKUP/div[4]/p[3]", "#APP-PGBASEBACKUP/div[4]/p[4]", "#APP-PGBASEBACKUP/div[4]/p[5]", "#APP-PGBASEBACKUP/div[4]/p[6]", "#APP-PGBASEBACKUP/div[4]/p[7]", "#APP-PGBASEBACKUP/div[4]/p[9]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[3]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[5]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[5]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[17]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[19]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[19]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[19]/p[3]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[19]/p[4]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[3]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[7]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[7]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[17]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[17]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[17]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[19]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[21]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[21]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[21]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[21]/p[3]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[23]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[25]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[25]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[27]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[29]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[29]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[29]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[31]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[31]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[7]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[7]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[7]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[8]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[8]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/p[3]", "#APP-PGBASEBACKUP/div[5]/p[5]", "#APP-PGBASEBACKUP/div[5]/p[7]", "#APP-PGBASEBACKUP/div[6]/h2[0]", "#APP-PGBASEBACKUP/div[6]/p[1]", "#APP-PGBASEBACKUP/div[6]/p[2]", "#APP-PGBASEBACKUP/div[7]/h2[0]", "#APP-PGBASEBACKUP/div[7]/p[1]", "#APP-PGBASEBACKUP/div[7]/p[2]", "#APP-PGBASEBACKUP/div[7]/p[3]", "#APP-PGBASEBACKUP/div[7]/p[6]", "#APP-PGBASEBACKUP/div[8]/h2[0]", "#APP-PGBASEBACKUP/div[8]/p[10]", "#APP-PGBASEBACKUP/div[8]/p[1]", "#APP-PGBASEBACKUP/div[8]/p[3]", "#APP-PGBASEBACKUP/div[8]/p[5]", "#APP-PGBASEBACKUP/div[8]/p[7]", "#APP-PGBASEBACKUP/div[8]/p[8]", "#APP-PGBASEBACKUP/div[9]/h2[0]"]}], "language": "zh", "original_text": {"/versions/19/description/0": "pg_basebackup \u2014 take a base backup of a PostgreSQL cluster", "/versions/19/facts/0/label": "Documented executable", "/versions/19/facts/1/label": "Executable version", "/versions/19/facts/2/label": "Reference inventory", "/versions/19/facts/2/value": "Client applications", "/versions/19/facts/3/label": "Option definition groups", "/versions/19/tables/0/title": "Documented options", "/versions/19/related/0/label": "libpq connection parameters", "/versions/19/tables/0/rows/0/summary": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty.", "/versions/19/tables/0/rows/1/summary": "Selects the format for the output. format can be one of the following:", "/versions/19/tables/0/rows/2/summary": "Performs an incremental backup . The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup.", "/versions/19/tables/0/rows/3/summary": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup.", "/versions/19/tables/0/rows/4/summary": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup.", "/versions/19/tables/0/rows/5/summary": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces.", "/versions/19/tables/0/rows/6/summary": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format.", "/versions/19/tables/0/rows/7/summary": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup.", "/versions/19/tables/0/rows/8/summary": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "/versions/19/tables/0/rows/9/summary": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch .", "/versions/19/tables/0/columns/0/label": "Option and arguments", "/versions/19/tables/0/columns/1/label": "Description", "/versions/19/tables/0/rows/10/summary": "Sets checkpoint mode to fast or spread (see Section 25.3.4 ). The default is spread.", "/versions/19/tables/0/rows/11/summary": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists.", "/versions/19/tables/0/rows/12/summary": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used.", "/versions/19/tables/0/rows/13/summary": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging.", "/versions/19/tables/0/rows/14/summary": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.", "/versions/19/tables/0/rows/15/summary": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.", "/versions/19/tables/0/rows/16/summary": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second.", "/versions/19/tables/0/rows/17/summary": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby.", "/versions/19/tables/0/rows/18/summary": "When set to fsync , which is the default, pg_basebackup will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace.", "/versions/19/tables/0/rows/19/summary": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.", "/versions/19/tables/0/rows/20/summary": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C .", "/versions/19/tables/0/rows/21/summary": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case.", "/versions/19/tables/0/rows/22/summary": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL .", "/versions/19/tables/0/rows/23/summary": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file.", "/versions/19/tables/0/rows/24/summary": "Prevents the creation of a temporary replication slot for the backup.", "/versions/19/tables/0/rows/25/summary": "Disables verification of checksums, if they are enabled on the server the base backup is taken from.", "/versions/19/tables/0/rows/26/summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "/versions/19/tables/0/rows/27/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "/versions/19/tables/0/rows/28/summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "/versions/19/tables/0/rows/29/summary": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds.", "/versions/19/tables/0/rows/30/summary": "Specifies the user name to connect as.", "/versions/19/tables/0/rows/31/summary": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/19/tables/0/rows/32/summary": "Forces pg_basebackup to prompt for a password before connecting to the source server.", "/versions/19/tables/0/rows/33/summary": "Prints the pg_basebackup version and exits.", "/versions/19/tables/0/rows/34/summary": "Shows help about pg_basebackup command line arguments, and exits."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "5a9c73a6897b7a7560d6f64fd9229767ef254c53051dff69f3922d13fba18a9c"}, "comparison_data": {"options": [{"names": ["-D directory", "--pgdata= directory"], "signature": "-D directory --pgdata= directory", "description": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty. When the backup is in tar format, the target directory may be specified as - (dash), causing the tar file to be written to stdout . This option is required."}, {"names": ["-F format", "--format= format"], "signature": "-F format --format= format", "description": "Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the source server's data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory's contents will be written to a file named base.tar , and each other tablespace will be written to a separate tar file named after that tablespace's OID. If the target directory is specified as - (dash), the tar contents will be written to standard output, suitable for piping to (for example) gzip . This is only allowed if the cluster has no additional tablespaces and WAL streaming is not used."}, {"names": ["-i old_manifest_file", "--incremental= old_manifest_file"], "signature": "-i old_manifest_file --incremental= old_manifest_file", "description": "Performs an incremental backup . The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup."}, {"names": ["-R", "--write-recovery-conf"], "signature": "-R --write-recovery-conf", "description": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup. The postgresql.auto.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that streaming replication and logical replication slot synchronization will use the same settings later on. The dbname will be recorded only if the dbname was specified explicitly in the connection string or environment variable ."}, {"names": ["-t target", "--target= target"], "signature": "-t target --target= target", "description": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup. Since WAL streaming is implemented by pg_basebackup rather than by the server, this option cannot be used together with -Xstream . Since that is the default, when this option is specified, you must also specify either -Xfetch or -Xnone ."}, {"names": ["-T olddir = newdir", "--tablespace-mapping= olddir = newdir"], "signature": "-T olddir = newdir --tablespace-mapping= olddir = newdir", "description": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected."}, {"names": ["--waldir= waldir"], "signature": "--waldir= waldir", "description": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format."}, {"names": ["-X method", "--wal-method= method"], "signature": "-X method --wal-method= method", "description": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup. The following method s for collecting the write-ahead logs are supported: n none Don't include write-ahead logs in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the source server's wal_keep_size parameter to be set high enough that the required log data is not removed before the end of the backup. If the required log data has been recycled before it's time to transfer it, the backup will fail and be unusable. When tar format is used, the write-ahead log files will be included in the base.tar file. s stream Stream write-ahead log data while the backup is being taken. This method will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will require two replication connections not just one. As long as the client can keep up with the write-ahead log data, using this method requires no extra write-ahead logs to be saved on the source server. When tar format is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default."}, {"names": ["-z", "--gzip"], "signature": "-z --gzip", "description": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-Z level", "-Z [{client|server}-] method [: detail ]", "--compress= level", "--compress=[{client|server}-] method [: detail ]"], "signature": "-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]", "description": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch . The compression method can be set to gzip , lz4 , zstd , none for no compression or an integer (no compression if 0, gzip if greater than 0). A compression detail string can optionally be specified. If the detail string is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form keyword or keyword=value . Currently, the supported keywords are level , long , and workers . The detail string cannot be used when the compression method is specified as a plain integer. If no compression level is specified, the default compression level will be used. If only a level is specified without mentioning an algorithm, gzip compression will be used if the level is greater than 0, and no compression will be used if the level is 0. When the tar format is used with gzip , lz4 , or zstd , the suffix .gz , .lz4 , or .zst , respectively, will be automatically added to all tar filenames. When the plain format is used, client-side compression may not be specified, but it is still possible to request server-side compression. If this is done, the server will compress the backup for transmission, and the client will decompress and extract it. When this option is used in combination with -Xstream , pg_wal.tar will be compressed using gzip if client-side gzip compression is selected, but will not be compressed if any other compression algorithm is selected, or if server-side compression is selected."}, {"names": ["-c {fast|spread}", "--checkpoint={fast|spread}"], "signature": "-c {fast|spread} --checkpoint={fast|spread}", "description": "Sets checkpoint mode to fast or spread (see Section 25.3.4 ). The default is spread."}, {"names": ["-C", "--create-slot"], "signature": "-C --create-slot", "description": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists."}, {"names": ["-l label", "--label= label"], "signature": "-l label --label= label", "description": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used."}, {"names": ["-n", "--no-clean"], "signature": "-n --no-clean", "description": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way."}, {"names": ["-N", "--no-sync"], "signature": "-N --no-sync", "description": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."}, {"names": ["-P", "--progress"], "signature": "-P --progress", "description": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL."}, {"names": ["-r rate", "--max-rate= rate"], "signature": "-r rate --max-rate= rate", "description": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch ."}, {"names": ["-S slotname", "--slot= slotname"], "signature": "-S slotname --slot= slotname", "description": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby. The specified replication slot has to exist unless the option -C is also used. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming."}, {"names": ["--sync-method= method"], "signature": "--sync-method= method", "description": "When set to fsync , which is the default, pg_basebackup will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace. On Linux, syncfs may be used instead to ask the operating system to synchronize the whole file system that contains the backup directory. When the plain format is used, pg_basebackup will also synchronize the file systems that contain the WAL files and each tablespace. See recovery_init_sync_method for information about the caveats to be aware of when using syncfs . This option has no effect when --no-sync is used."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."}, {"names": ["--manifest-checksums= algorithm"], "signature": "--manifest-checksums= algorithm", "description": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C . If NONE is selected, the backup manifest will not contain any checksums. Otherwise, it will contain a checksum of each file in the backup using the specified algorithm. In addition, the manifest will always contain a SHA256 checksum of its own contents. The SHA algorithms are significantly more CPU-intensive than CRC32C , so selecting one of them may increase the time required to complete the backup. Using a SHA hash function provides a cryptographically secure digest of each file for users who wish to verify that the backup has not been tampered with, while the CRC-32C algorithm provides a checksum that is much faster to calculate; it is good at catching errors due to accidental changes but is not resistant to malicious modifications. Note that, to be useful against an adversary who has access to the backup, the backup manifest would need to be stored securely elsewhere or otherwise verified not to have been modified since the backup was taken. pg_verifybackup can be used to check the integrity of a backup against the backup manifest."}, {"names": ["--manifest-force-encode"], "signature": "--manifest-force-encode", "description": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case."}, {"names": ["--no-estimate-size"], "signature": "--no-estimate-size", "description": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL . Without this option, the backup will start by enumerating the size of the entire database, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent. This option is useful to avoid such estimation time if it's too long. This option is not allowed when using --progress ."}, {"names": ["--no-manifest"], "signature": "--no-manifest", "description": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file."}, {"names": ["--no-slot"], "signature": "--no-slot", "description": "Prevents the creation of a temporary replication slot for the backup. By default, if log streaming is selected but no slot name is given with the -S option, then a temporary replication slot is created (if supported by the source server). The main purpose of this option is to allow taking a base backup when the server has no free replication slots. Using a replication slot is almost always preferred, because it prevents needed WAL from being removed by the server during the backup."}, {"names": ["--no-verify-checksums"], "signature": "--no-verify-checksums", "description": "Disables verification of checksums, if they are enabled on the server the base backup is taken from. By default, checksums are verified and checksum failures will result in a non-zero exit status. However, the base backup will not be removed in such a case, as if the --no-clean option had been used. Checksum verification failures will also be reported in the pg_stat_database view."}, {"names": ["-d connstr", "--dbname= connstr"], "signature": "-d connstr --dbname= connstr", "description": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. This option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, any database name included in the connection string will be ignored by the server. However, a database name supplied that way overrides the default database name ( replication ) for purposes of looking up the replication connection's password in ~/.pgpass . Similarly, middleware or proxies used in connecting to PostgreSQL might utilize the name for purposes such as connection routing. The database name can also be used by logical replication slot synchronization ."}, {"names": ["-h host", "--host= host"], "signature": "-h host --host= host", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-s interval", "--status-interval= interval"], "signature": "-s interval --status-interval= interval", "description": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Specifies the user name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Forces pg_basebackup to prompt for a password before connecting to the source server. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Prints the pg_basebackup version and exits."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Shows help about pg_basebackup command line arguments, and exits."}], "synopsis": ["pg_basebackup [ option ...]"], "environment": []}, "comparison_hash": "0b9d45700823d646b3b9768e4659fe4e693f0bd75c42184c1e47a39fdde2b788", "manual_language": "zh"}, "20": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_basebackup"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "20devel"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "35"}], "tables": [{"key": "options", "rows": [{"summary": "\u8bbe\u7f6e\u5199\u5165\u8f93\u51fa\u7684\u76ee\u6807\u76ee\u5f55\u3002\u5982\u679c\u8be5\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c pg_basebackup \u4f1a\u521b\u5efa\u5b83\uff08\u4ee5\u53ca\u6240\u6709\u7f3a\u5931\u7684\u7236\u76ee\u5f55\uff09\u3002\u5982\u679c\u8be5\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-D directory --pgdata= directory"}}, {"summary": "\u9009\u62e9\u8f93\u51fa\u683c\u5f0f\u3002 format \u53ef\u4ee5\u662f\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-F format --format= format"}}, {"summary": "\u6267\u884c \u589e\u91cf\u5907\u4efd \u3002\u5fc5\u987b\u63d0\u4f9b\u53c2\u8003\u5907\u4efd\u7684\u5907\u4efd\u6e05\u5355\uff1b\u8be5\u6587\u4ef6\u5c06\u88ab\u4e0a\u4f20\u5230\u670d\u52a1\u5668\uff0c\u968f\u540e\u670d\u52a1\u5668\u4f1a\u8fd4\u56de\u6240\u8bf7\u6c42\u7684\u589e\u91cf\u5907\u4efd\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-i old_manifest_file --incremental= old_manifest_file"}}, {"summary": "\u521b\u5efa standby.signal \u6587\u4ef6\uff0c\u5e76\u5c06\u8fde\u63a5\u8bbe\u7f6e\u8ffd\u52a0\u5230\u76ee\u6807\u76ee\u5f55\u4e2d\u7684 postgresql.auto.conf \u6587\u4ef6\u4e2d\uff08\u5982\u679c\u4f7f\u7528 tar \u683c\u5f0f\uff0c\u5219\u8ffd\u52a0\u5230\u57fa\u7840\u5f52\u6863\u6587\u4ef6\u5185\uff09\u3002\u8fd9\u6837\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u5229\u7528\u5907\u4efd\u7ed3\u679c\u642d\u5efa\u5907\u5e93\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-R --write-recovery-conf"}}, {"summary": "\u6307\u793a\u670d\u52a1\u5668\u5c06\u57fa\u7840\u5907\u4efd\u653e\u5230\u54ea\u91cc\u3002\u9ed8\u8ba4\u76ee\u6807\u662f client \uff0c\u8868\u793a\u5907\u4efd\u5e94\u53d1\u9001\u5230\u8fd0\u884c pg_basebackup \u7684\u90a3\u53f0\u673a\u5668\u3002\u5982\u679c\u76ee\u6807\u6539\u4e3a server:/some/path \uff0c\u5219\u5907\u4efd\u4f1a\u5b58\u50a8\u5728\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684 /some/path \u76ee\u5f55\u4e2d\u3002\u5c06\u5907\u4efd\u5b58\u50a8\u5728\u670d\u52a1\u5668\u4e0a\u9700\u8981\u8d85\u7ea7\u7528\u6237\u6743\u9650\uff0c\u6216\u62e5\u6709 pg_write_server_files \u89d2\u8272\u7684\u6743\u9650\u3002\u5982\u679c\u76ee\u6807\u8bbe\u7f6e\u4e3a blackhole \uff0c\u5219\u5185\u5bb9\u4f1a\u88ab\u4e22\u5f03\uff0c\u4e0d\u4f1a\u5b58\u50a8\u5230\u4efb\u4f55\u5730\u65b9\u3002\u8fd9\u53ea\u5e94\u7528\u4e8e\u6d4b\u8bd5\u76ee\u7684\uff0c\u56e0\u4e3a\u6700\u7ec8\u4e0d\u4f1a\u5f97\u5230\u5b9e\u9645\u5907\u4efd\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-t target --target= target"}}, {"summary": "\u5728\u5907\u4efd\u671f\u95f4\uff0c\u5c06\u76ee\u5f55 olddir \u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230 newdir \u3002\u8981\u4f7f\u6b64\u9009\u9879\u751f\u6548\uff0c olddir \u5fc5\u987b\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u5b9a\u4e49\u7684\u8be5\u8868\u7a7a\u95f4\u8def\u5f84\u5b8c\u5168\u4e00\u81f4\u3002\uff08\u4f46\u5982\u679c\u6e90\u670d\u52a1\u5668\u4e0a\u5728 olddir \u4e2d\u6ca1\u6709\u8868\u7a7a\u95f4\uff0c\u4e5f\u4e0d\u7b97\u9519\u8bef\u3002\uff09\u4e0e\u6b64\u540c\u65f6\uff0c newdir \u662f\u63a5\u6536\u4e3b\u673a\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u4e00\u4e2a\u76ee\u5f55\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c newdir \u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002 olddir \u548c newdir \u90fd\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u5982\u679c\u4efb\u4e00\u8def\u5f84\u4e2d\u9700\u8981\u5305\u542b\u7b49\u53f7\uff08 = \uff09\uff0c\u8bf7\u5728\u5176\u524d\u9762\u52a0\u4e0a\u53cd\u659c\u6760\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u4ee5\u5904\u7406\u591a\u4e2a\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-T olddir = newdir --tablespace-mapping= olddir = newdir"}}, {"summary": "\u8bbe\u7f6e\u5199\u5165 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cWAL \u6587\u4ef6\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u7684 pg_wal \u5b50\u76ee\u5f55\u4e2d\uff0c\u4f46\u6b64\u9009\u9879\u53ef\u7528\u4e8e\u5c06\u5176\u653e\u5728\u5176\u4ed6\u4f4d\u7f6e\u3002 waldir \u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c waldir \u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002\u53ea\u6709\u5f53\u5907\u4efd\u91c7\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u624d\u80fd\u6307\u5b9a\u6b64\u9009\u9879\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "--waldir= waldir"}}, {"summary": "\u5728\u5907\u4efd\u4e2d\u5305\u542b\u6240\u9700\u7684 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u3002\u8fd9\u5c06\u5305\u62ec\u5907\u4efd\u671f\u95f4\u751f\u6210\u7684\u6240\u6709\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u9664\u975e\u6307\u5b9a\u65b9\u6cd5 none \uff0c\u5426\u5219\u5c31\u53ef\u4ee5\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u542f\u52a8 postmaster\uff0c\u800c\u65e0\u9700\u67e5\u9605 WAL \u5f52\u6863\uff0c\u4ece\u800c\u4f7f\u8f93\u51fa\u6210\u4e3a\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u5907\u4efd\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-X method --wal-method= method"}}, {"summary": "\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u4f7f\u7528\u9ed8\u8ba4\u538b\u7f29\u7ea7\u522b\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0 .gz \u540e\u7f00\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-z --gzip"}}, {"summary": "\u8bf7\u6c42\u5bf9\u5907\u4efd\u8fdb\u884c\u538b\u7f29\u3002\u5982\u679c\u5305\u542b client \u6216 server \uff0c\u5219\u6307\u5b9a\u538b\u7f29\u6267\u884c\u7684\u4f4d\u7f6e\u3002\u5728\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4f1a\u51cf\u5c11\u4f20\u8f93\u5e26\u5bbd\u5360\u7528\uff0c\u4f46\u4f1a\u589e\u52a0\u670d\u52a1\u5668 CPU \u6d88\u8017\u3002\u9ed8\u8ba4\u503c\u662f client \uff0c\u4f46\u4f7f\u7528 --target \u65f6\u9664\u5916\uff1b\u6b64\u65f6\u5907\u4efd\u4e0d\u4f1a\u53d1\u9001\u5230\u5ba2\u6237\u7aef\uff0c\u56e0\u6b64\u53ea\u6709\u670d\u52a1\u5668\u7aef\u538b\u7f29\u624d\u6709\u610f\u4e49\u3002\u4f7f\u7528\u9ed8\u8ba4\u7684 -Xstream \u65f6\uff0c\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4e0d\u4f1a\u5e94\u7528\u4e8e WAL\u3002\u82e5\u8981\u538b\u7f29 WAL\uff0c\u8bf7\u4f7f\u7528\u5ba2\u6237\u7aef\u538b\u7f29\uff0c\u6216\u8005\u6307\u5b9a -Xfetch \u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]"}}, {"summary": "\u5c06\u68c0\u67e5\u70b9\u6a21\u5f0f\u8bbe\u7f6e\u4e3a fast \u6216 spread\uff08\u89c1 \u7b2c 25.3.4 \u8282 \uff09\u3002\u9ed8\u8ba4\u503c\u4e3a spread\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-c {fast|spread} --checkpoint={fast|spread}"}}, {"summary": "\u6307\u5b9a\u5728\u5f00\u59cb\u5907\u4efd\u4e4b\u524d\uff0c\u5e94\u521b\u5efa\u7531 --slot \u9009\u9879\u6307\u5b9a\u540d\u79f0\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u8be5\u69fd\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u9519\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-C --create-slot"}}, {"summary": "\u8bbe\u7f6e\u5907\u4efd\u6807\u7b7e\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u503c \u201c pg_basebackup base backup \u201d \u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-l label --label= label"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53 pg_basebackup \u56e0\u9519\u8bef\u4e2d\u6b62\u65f6\uff0c\u5b83\u4f1a\u5220\u9664\u5728\u53d1\u73b0\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u76ee\u5f55\uff08\u4f8b\u5982\u76ee\u6807\u76ee\u5f55\u548c\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\uff09\u3002\u6b64\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u5f88\u6709\u5e2e\u52a9\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-n --no-clean"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_basebackup \u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u88ab\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f1a\u4f7f pg_basebackup \u4e0d\u7ecf\u7b49\u5f85\u5c31\u76f4\u63a5\u8fd4\u56de\uff0c\u56e0\u6b64\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u968f\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u57fa\u7840\u5907\u4efd\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u5408\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-N --no-sync"}}, {"summary": "\u542f\u7528\u8fdb\u5ea6\u62a5\u544a\u3002\u6253\u5f00\u6b64\u9009\u9879\u540e\uff0c\u4f1a\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u7ed9\u51fa\u4e00\u4e2a\u8fd1\u4f3c\u7684\u8fdb\u5ea6\u62a5\u544a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u53d1\u751f\u53d8\u5316\uff0c\u56e0\u6b64\u8fd9\u53ea\u662f\u8fd1\u4f3c\u503c\uff0c\u6700\u7ec8\u672a\u5fc5\u6070\u597d\u7ed3\u675f\u5728 100% \u3002\u7279\u522b\u662f\u5f53\u5907\u4efd\u4e2d\u5305\u542b WAL \u65f6\uff0c\u603b\u6570\u636e\u91cf\u65e0\u6cd5\u9884\u5148\u4f30\u8ba1\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u65e6\u8fdb\u5ea6\u8d85\u8fc7\u4e0d\u542b WAL \u65f6\u7684\u603b\u4f30\u8ba1\u503c\uff0c\u4f30\u8ba1\u76ee\u6807\u5927\u5c0f\u5c31\u4f1a\u7ee7\u7eed\u589e\u52a0\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-P --progress"}}, {"summary": "\u8bbe\u7f6e\u4ece\u6e90\u670d\u52a1\u5668\u6536\u96c6\u6570\u636e\u65f6\u5141\u8bb8\u7684\u6700\u5927\u4f20\u8f93\u901f\u7387\u3002\u8fd9\u6709\u52a9\u4e8e\u9650\u5236 pg_basebackup \u5bf9\u670d\u52a1\u5668\u7684\u5f71\u54cd\u3002\u53d6\u503c\u5355\u4f4d\u4e3a\u6bcf\u79d2\u5343\u5b57\u8282\u3002\u4f7f\u7528\u540e\u7f00 M \u8868\u793a\u6bcf\u79d2\u5146\u5b57\u8282\u3002\u4e5f\u63a5\u53d7\u540e\u7f00 k \uff0c\u4f46\u6ca1\u6709\u5b9e\u9645\u5f71\u54cd\u3002\u6709\u6548\u53d6\u503c\u8303\u56f4\u4e3a\u6bcf\u79d2 32 \u5343\u5b57\u8282\u5230\u6bcf\u79d2 1024 \u5146\u5b57\u8282\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-r rate --max-rate= rate"}}, {"summary": "\u6b64\u9009\u9879\u53ea\u80fd\u4e0e -X stream \u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u4f1a\u4f7f WAL \u6d41\u5f0f\u4f20\u8f93\u4f7f\u7528\u6307\u5b9a\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u6b64\u57fa\u7840\u5907\u4efd\u6253\u7b97\u7528\u4f5c\u4f7f\u7528\u590d\u5236\u69fd\u7684\u6d41\u590d\u5236\u5907\u5e93\uff0c\u90a3\u4e48\u8be5\u5907\u5e93\u5e94\u5c06\u540c\u4e00\u4e2a\u590d\u5236\u69fd\u540d\u79f0\u7528\u4f5c primary_slot_name \u7684\u503c\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u4e3b\u5e93\u5728\u57fa\u7840\u5907\u4efd\u7ed3\u675f\u4e0e\u65b0\u5907\u5e93\u5f00\u59cb\u6d41\u590d\u5236\u4e4b\u95f4\u7684\u8fd9\u6bb5\u65f6\u95f4\u5185\uff0c\u4e0d\u4f1a\u79fb\u9664\u4efb\u4f55\u5fc5\u9700\u7684 WAL \u6570\u636e\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-S slotname --slot= slotname"}}, {"summary": "\u8bbe\u7f6e\u4e3a fsync \uff08\u9ed8\u8ba4\uff09\u65f6\uff0c pg_basebackup \u4f1a\u9012\u5f52\u6253\u5f00\u5e76\u540c\u6b65\u5907\u4efd\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3002\u4f7f\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u67e5\u627e\u6587\u4ef6\u4f1a\u8ddf\u968f WAL \u76ee\u5f55\u548c\u5404\u5df2\u914d\u7f6e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "--sync-method= method"}}, {"summary": "\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\u3002\u5b83\u4f1a\u5728\u542f\u52a8\u548c\u5173\u95ed\u8fc7\u7a0b\u4e2d\u8f93\u51fa\u4e00\u4e9b\u989d\u5916\u6b65\u9aa4\uff1b\u5982\u679c\u540c\u65f6\u542f\u7528\u4e86\u8fdb\u5ea6\u62a5\u544a\uff0c\u8fd8\u4f1a\u663e\u793a\u5f53\u524d\u6b63\u5728\u5904\u7406\u7684\u786e\u5207\u6587\u4ef6\u540d\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-v --verbose"}}, {"summary": "\u6307\u5b9a\u5e94\u7528\u5230\u5907\u4efd\u6e05\u5355\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u7684\u6821\u9a8c\u548c\u7b97\u6cd5\u3002\u76ee\u524d\u53ef\u7528\u7684\u7b97\u6cd5\u6709 NONE \u3001 CRC32C \u3001 SHA224 \u3001 SHA256 \u3001 SHA384 \u548c SHA512 \u3002\u9ed8\u8ba4\u503c\u4e3a CRC32C \u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "--manifest-checksums= algorithm"}}, {"summary": "\u5f3a\u5236\u5c06\u5907\u4efd\u6e05\u5355\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u540d\u7f16\u7801\u4e3a\u5341\u516d\u8fdb\u5236\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u5bf9\u975e UTF8 \u6587\u4ef6\u540d\u8fdb\u884c\u5341\u516d\u8fdb\u5236\u7f16\u7801\u3002\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u8bfb\u53d6\u5907\u4efd\u6e05\u5355\u6587\u4ef6\u7684\u5de5\u5177\u662f\u5426\u80fd\u6b63\u786e\u5904\u7406\u8fd9\u79cd\u60c5\u51b5\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "--manifest-force-encode"}}, {"summary": "\u7981\u6b62\u670d\u52a1\u5668\u4f30\u7b97\u5c06\u8981\u6d41\u5f0f\u4f20\u8f93\u7684\u5907\u4efd\u6570\u636e\u603b\u91cf\uff0c\u56e0\u6b64 pg_stat_progress_basebackup \u89c6\u56fe\u4e2d\u7684 backup_total \u5217\u59cb\u7ec8\u4e3a NULL\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "--no-estimate-size"}}, {"summary": "\u7981\u6b62\u751f\u6210\u5907\u4efd\u6e05\u5355\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u670d\u52a1\u5668\u5c06\u751f\u6210\u5e76\u53d1\u9001\u4e00\u4e2a\u5907\u4efd\u6e05\u5355\uff0c\u53ef\u4f7f\u7528 pg_verifybackup \u8fdb\u884c\u9a8c\u8bc1\u3002\u8be5\u6e05\u5355\u5217\u51fa\u4e86\u5907\u4efd\u4e2d\u7684\u6bcf\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u4e0d\u5305\u62ec\u53ef\u80fd\u5305\u542b\u5728\u5176\u4e2d\u7684\u4efb\u4f55 WAL \u6587\u4ef6\u3002\u5b83\u8fd8\u4f1a\u4fdd\u5b58\u6bcf\u4e2a\u6587\u4ef6\u7684\u5927\u5c0f\u3001\u6700\u540e\u4fee\u6539\u65f6\u95f4\u4ee5\u53ca\u53ef\u9009\u7684\u6821\u9a8c\u548c\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "--no-manifest"}}, {"summary": "\u9632\u6b62\u4e3a\u5907\u4efd\u521b\u5efa\u4e34\u65f6\u590d\u5236\u69fd\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "--no-slot"}}, {"summary": "\u5982\u679c\u83b7\u53d6\u57fa\u7840\u5907\u4efd\u7684\u670d\u52a1\u5668\u542f\u7528\u4e86\u6821\u9a8c\u548c\uff0c\u5219\u7981\u7528\u5bf9\u8fd9\u4e9b\u6821\u9a8c\u548c\u7684\u9a8c\u8bc1\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "--no-verify-checksums"}}, {"summary": "\u4ee5 \u8fde\u63a5\u5b57\u7b26\u4e32 \u7684\u5f62\u5f0f\u6307\u5b9a\u7528\u4e8e\u8fde\u63a5\u670d\u52a1\u5668\u7684\u53c2\u6570\uff1b\u8fd9\u4e9b\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u76f8\u4e92\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-d connstr --dbname= connstr"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGHOST \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff1b\u5426\u5219\u4f1a\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-h host --host= host"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u6240\u4f7f\u7528\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u4e2d\u7684\u503c\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u786e\u5b9a\u7684\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-p port --port= port"}}, {"summary": "\u6307\u5b9a\u53d1\u9001\u56de\u6e90\u670d\u52a1\u5668\u7684\u72b6\u6001\u5305\u4e4b\u95f4\u76f8\u9694\u7684\u79d2\u6570\u3002\u8f83\u5c0f\u7684\u503c\u53ef\u4ee5\u8ba9\u670d\u52a1\u5668\u7aef\u5bf9\u5907\u4efd\u8fdb\u5ea6\u7684\u76d1\u63a7\u66f4\u7cbe\u786e\u3002\u503c\u4e3a\u96f6\u65f6\u4f1a\u5b8c\u5168\u7981\u7528\u5468\u671f\u6027\u72b6\u6001\u66f4\u65b0\uff0c\u4e0d\u8fc7\u5f53\u670d\u52a1\u5668\u8bf7\u6c42\u65f6\u4ecd\u4f1a\u53d1\u9001\u66f4\u65b0\uff0c\u4ee5\u907f\u514d\u56e0\u8d85\u65f6\u800c\u65ad\u5f00\u8fde\u63a5\u3002\u9ed8\u8ba4\u503c\u662f 10 \u79d2\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-s interval --status-interval= interval"}}, {"summary": "\u6307\u5b9a\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-U username --username= username"}}, {"summary": "\u7981\u6b62\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\uff08\u4f8b\u5982 .pgpass \u6587\u4ef6\uff09\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u6b64\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u79cd\u573a\u666f\u4e0b\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 pg_basebackup \u5728\u8fde\u63a5\u6e90\u670d\u52a1\u5668\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-W --password"}}, {"summary": "\u8f93\u51fa pg_basebackup \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-V --version"}}, {"summary": "\u663e\u793a pg_basebackup \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/devel/app-pgbasebackup.html", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}], "options": [{"names": ["-D directory", "--pgdata= directory"], "summary": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty.", "signature": "-D directory --pgdata= directory", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty. When the backup is in tar format, the target directory may be specified as - (dash), causing the tar file to be written to stdout . This option is required."}, {"names": ["-F format", "--format= format"], "summary": "Selects the format for the output. format can be one of the following:", "signature": "-F format --format= format", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the source server's data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory's contents will be written to a file named base.tar , and each other tablespace will be written to a separate tar file named after that tablespace's OID. If the target directory is specified as - (dash), the tar contents will be written to standard output, suitable for piping to (for example) gzip . This is only allowed if the cluster has no additional tablespaces and WAL streaming is not used."}, {"names": ["-i old_manifest_file", "--incremental= old_manifest_file"], "summary": "Performs an incremental backup . The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup.", "signature": "-i old_manifest_file --incremental= old_manifest_file", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Performs an incremental backup . The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup."}, {"names": ["-R", "--write-recovery-conf"], "summary": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup.", "signature": "-R --write-recovery-conf", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup. The postgresql.auto.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that streaming replication and logical replication slot synchronization will use the same settings later on. The dbname will be recorded only if the dbname was specified explicitly in the connection string or environment variable ."}, {"names": ["-t target", "--target= target"], "summary": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup.", "signature": "-t target --target= target", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup. Since WAL streaming is implemented by pg_basebackup rather than by the server, this option cannot be used together with -Xstream . Since that is the default, when this option is specified, you must also specify either -Xfetch or -Xnone ."}, {"names": ["-T olddir = newdir", "--tablespace-mapping= olddir = newdir"], "summary": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces.", "signature": "-T olddir = newdir --tablespace-mapping= olddir = newdir", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected."}, {"names": ["--waldir= waldir"], "summary": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format.", "signature": "--waldir= waldir", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format."}, {"names": ["-X method", "--wal-method= method"], "summary": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup.", "signature": "-X method --wal-method= method", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup. The following method s for collecting the write-ahead logs are supported: n none Don't include write-ahead logs in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the source server's wal_keep_size parameter to be set high enough that the required log data is not removed before the end of the backup. If the required log data has been recycled before it's time to transfer it, the backup will fail and be unusable. When tar format is used, the write-ahead log files will be included in the base.tar file. s stream Stream write-ahead log data while the backup is being taken. This method will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will require two replication connections not just one. As long as the client can keep up with the write-ahead log data, using this method requires no extra write-ahead logs to be saved on the source server. When tar format is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default."}, {"names": ["-z", "--gzip"], "summary": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "signature": "-z --gzip", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-Z level", "-Z [{client|server}-] method [: detail ]", "--compress= level", "--compress=[{client|server}-] method [: detail ]"], "summary": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch .", "signature": "-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch . The compression method can be set to gzip , lz4 , zstd , none for no compression or an integer (no compression if 0, gzip if greater than 0). A compression detail string can optionally be specified. If the detail string is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form keyword or keyword=value . Currently, the supported keywords are level , long , and workers . The detail string cannot be used when the compression method is specified as a plain integer. If no compression level is specified, the default compression level will be used. If only a level is specified without mentioning an algorithm, gzip compression will be used if the level is greater than 0, and no compression will be used if the level is 0. When the tar format is used with gzip , lz4 , or zstd , the suffix .gz , .lz4 , or .zst , respectively, will be automatically added to all tar filenames. When the plain format is used, client-side compression may not be specified, but it is still possible to request server-side compression. If this is done, the server will compress the backup for transmission, and the client will decompress and extract it. When this option is used in combination with -Xstream , pg_wal.tar will be compressed using gzip if client-side gzip compression is selected, but will not be compressed if any other compression algorithm is selected, or if server-side compression is selected."}, {"names": ["-c {fast|spread}", "--checkpoint={fast|spread}"], "summary": "Sets checkpoint mode to fast or spread (see Section 25.3.4 ). The default is spread.", "signature": "-c {fast|spread} --checkpoint={fast|spread}", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Sets checkpoint mode to fast or spread (see Section 25.3.4 ). The default is spread."}, {"names": ["-C", "--create-slot"], "summary": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists.", "signature": "-C --create-slot", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists."}, {"names": ["-l label", "--label= label"], "summary": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used.", "signature": "-l label --label= label", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used."}, {"names": ["-n", "--no-clean"], "summary": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging.", "signature": "-n --no-clean", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way."}, {"names": ["-N", "--no-sync"], "summary": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.", "signature": "-N --no-sync", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."}, {"names": ["-P", "--progress"], "summary": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.", "signature": "-P --progress", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL."}, {"names": ["-r rate", "--max-rate= rate"], "summary": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second.", "signature": "-r rate --max-rate= rate", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch ."}, {"names": ["-S slotname", "--slot= slotname"], "summary": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby.", "signature": "-S slotname --slot= slotname", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby. The specified replication slot has to exist unless the option -C is also used. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming."}, {"names": ["--sync-method= method"], "summary": "When set to fsync , which is the default, pg_basebackup will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace.", "signature": "--sync-method= method", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "When set to fsync , which is the default, pg_basebackup will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace. On Linux, syncfs may be used instead to ask the operating system to synchronize the whole file system that contains the backup directory. When the plain format is used, pg_basebackup will also synchronize the file systems that contain the WAL files and each tablespace. See recovery_init_sync_method for information about the caveats to be aware of when using syncfs . This option has no effect when --no-sync is used."}, {"names": ["-v", "--verbose"], "summary": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.", "signature": "-v --verbose", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."}, {"names": ["--manifest-checksums= algorithm"], "summary": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C .", "signature": "--manifest-checksums= algorithm", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C . If NONE is selected, the backup manifest will not contain any checksums. Otherwise, it will contain a checksum of each file in the backup using the specified algorithm. In addition, the manifest will always contain a SHA256 checksum of its own contents. The SHA algorithms are significantly more CPU-intensive than CRC32C , so selecting one of them may increase the time required to complete the backup. Using a SHA hash function provides a cryptographically secure digest of each file for users who wish to verify that the backup has not been tampered with, while the CRC-32C algorithm provides a checksum that is much faster to calculate; it is good at catching errors due to accidental changes but is not resistant to malicious modifications. Note that, to be useful against an adversary who has access to the backup, the backup manifest would need to be stored securely elsewhere or otherwise verified not to have been modified since the backup was taken. pg_verifybackup can be used to check the integrity of a backup against the backup manifest."}, {"names": ["--manifest-force-encode"], "summary": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case.", "signature": "--manifest-force-encode", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case."}, {"names": ["--no-estimate-size"], "summary": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL .", "signature": "--no-estimate-size", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL . Without this option, the backup will start by enumerating the size of the entire database, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent. This option is useful to avoid such estimation time if it's too long. This option is not allowed when using --progress ."}, {"names": ["--no-manifest"], "summary": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file.", "signature": "--no-manifest", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file."}, {"names": ["--no-slot"], "summary": "Prevents the creation of a temporary replication slot for the backup.", "signature": "--no-slot", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Prevents the creation of a temporary replication slot for the backup. By default, if log streaming is selected but no slot name is given with the -S option, then a temporary replication slot is created (if supported by the source server). The main purpose of this option is to allow taking a base backup when the server has no free replication slots. Using a replication slot is almost always preferred, because it prevents needed WAL from being removed by the server during the backup."}, {"names": ["--no-verify-checksums"], "summary": "Disables verification of checksums, if they are enabled on the server the base backup is taken from.", "signature": "--no-verify-checksums", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Disables verification of checksums, if they are enabled on the server the base backup is taken from. By default, checksums are verified and checksum failures will result in a non-zero exit status. However, the base backup will not be removed in such a case, as if the --no-clean option had been used. Checksum verification failures will also be reported in the pg_stat_database view. Checksums must be enabled on the server for the duration of the base backup in order to be verified. If checksums are in the process of being enabled when the base backup starts then checksum verification is disabled for the base backup."}, {"names": ["-d connstr", "--dbname= connstr"], "summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": "-d connstr --dbname= connstr", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. This option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, any database name included in the connection string will be ignored by the server. However, a database name supplied that way overrides the default database name ( replication ) for purposes of looking up the replication connection's password in ~/.pgpass . Similarly, middleware or proxies used in connecting to PostgreSQL might utilize the name for purposes such as connection routing. The database name can also be used by logical replication slot synchronization ."}, {"names": ["-h host", "--host= host"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "signature": "-h host --host= host", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "signature": "-p port --port= port", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-s interval", "--status-interval= interval"], "summary": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds.", "signature": "-s interval --status-interval= interval", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds."}, {"names": ["-U username", "--username= username"], "summary": "Specifies the user name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Specifies the user name to connect as."}, {"names": ["-w", "--no-password"], "summary": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "summary": "Forces pg_basebackup to prompt for a password before connecting to the source server.", "signature": "-W --password", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Forces pg_basebackup to prompt for a password before connecting to the source server. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["-V", "--version"], "summary": "Prints the pg_basebackup version and exits.", "signature": "-V --version", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Prints the pg_basebackup version and exits."}, {"names": ["-?", "--help"], "summary": "Shows help about pg_basebackup command line arguments, and exits.", "signature": "-? --help", "source_url": "/docs/devel/app-pgbasebackup.html", "description": "Shows help about pg_basebackup command line arguments, and exits."}], "related": [{"url": "/wiki/conn/?v=20", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/snapshot/dev/postgresql-snapshot.tar.bz2", "label": "20devel", "major": "20", "channel": "devel", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/20/postgresql-20-A4.pdf", "bytes": 16030631, "pages": 3052, "sha256": "bd5d82c0ce38fc18f92a0447818a91a193a261776bca1c37564bf9a683e177d0", "built_at": "2026-09-28"}, "US": {"url": "/files/documentation/pdf/20/postgresql-20-US.pdf", "bytes": 15936613, "pages": 3223, "sha256": "d97d9e0db479a02f4234b175f50fcad70c3661619afc8d6df9b9437882e3c299", "built_at": "2026-09-28"}}, "tree": "0", "index": "index.html", "major": "20", "pages": 1156, "release": "20devel", "source_url": "https://ftp.postgresql.org/pub/snapshot/dev/postgresql-snapshot.tar.bz2", "svg_assets": 6, "source_mode": "en SGML built with pinned official archive", "source_sha256": "4d3346909b201ac1648232cf290462a7070c119326f56196f1f0253ed80fae41", "source_snapshot_utc": "26-Sep-2026 20:22"}, "revision": "2eba5e0fd4c3bffb2803247b6cd537878e9d6ee5a6dfbe3c50ece8b421b80918", "evidence_kind": "English manual and source declarations", "source_sha256": "4d3346909b201ac1648232cf290462a7070c119326f56196f1f0253ed80fae41"}, "sources": [{"url": "https://pg.center/docs/devel/app-pgbasebackup.html", "file": "app-pgbasebackup.html", "label": "20devel English manual \u00b7 app-pgbasebackup.html", "anchor": "", "sha256": "8e8e29426743c0dc0a2c14166d80fb67f95bf1c3536f3fd8de25fe091dab5c8b", "language": "en", "original_url": "/docs/devel/app-pgbasebackup.html"}, {"url": "https://pg.center/docs/devel/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "a6c7ba748fa1d9feac5bb7cde41d1d36a1f4c26d5963e07fb103d02918b2a8ca", "language": "en", "original_url": "/docs/devel/reference-client.html"}], "sections": [], "synopsis": ["pg_basebackup [ option ...]"], "signature": "pg_basebackup [ option ...]", "description": ["pg_basebackup \u2014 \u83b7\u53d6 PostgreSQL \u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd"], "environment": [], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGBASEBACKUP\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_basebackup</span></span></h2>\n<p lang=\"zh\">pg_basebackup \u2014 \u83b7\u53d6<span class=\"productname\">PostgreSQL</span>\u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.10.4.1\"><code class=\"command\">pg_basebackup</code> [<em class=\"replaceable\"><code>option</code></em>...]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u7528\u4e8e\u83b7\u53d6\u6b63\u5728\u8fd0\u884c\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd\u3002\u5907\u4efd\u8fc7\u7a0b\u4e0d\u4f1a\u5f71\u54cd\u6570\u636e\u5e93\u7684\u5176\u4ed6\u5ba2\u6237\u7aef\uff0c\u5e76\u4e14\u8be5\u5907\u4efd\u65e2\u53ef\u7528\u4e8e\u65f6\u95f4\u70b9\u6062\u590d\uff08\u89c1<a class=\"xref\" href=\"/docs/devel/continuous-archiving.html\" title=\"25.3.\u00a0\u6301\u7eed\u5f52\u6863\u548c\u65f6\u95f4\u70b9\u6062\u590d\uff08PITR\uff09\">\u7b2c\u00a025.3\u00a0\u8282</a>\uff09\uff0c\u4e5f\u53ef\u7528\u4f5c\u65e5\u5fd7\u4f20\u9001\u6216\u6d41\u590d\u5236\u5907\u5e93\u7684\u8d77\u70b9\uff08\u89c1<a class=\"xref\" href=\"/docs/devel/warm-standby.html\" title=\"26.2.\u00a0\u65e5\u5fd7\u4f20\u9001\u5907\u5e93\">\u7b2c\u00a026.2\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u65e2\u53ef\u4ee5\u6267\u884c\u5b8c\u6574\u57fa\u7840\u5907\u4efd\uff0c\u4e5f\u53ef\u4ee5\u6267\u884c\u589e\u91cf\u57fa\u7840\u5907\u4efd\u3002\u6267\u884c\u5b8c\u6574\u5907\u4efd\u65f6\uff0c\u5b83\u4f1a\u7cbe\u786e\u590d\u5236\u6570\u636e\u5e93\u96c6\u7c07\u7684\u6587\u4ef6\u3002\u6267\u884c\u589e\u91cf\u5907\u4efd\u65f6\uff0c\u539f\u672c\u4f1a\u5305\u542b\u5728\u5b8c\u6574\u5907\u4efd\u4e2d\u7684\u67d0\u4e9b\u6587\u4ef6\uff0c\u53ef\u80fd\u4f1a\u88ab\u8fd9\u4e9b\u6587\u4ef6\u7684\u589e\u91cf\u7248\u672c\u66ff\u4ee3\uff0c\u5176\u4e2d\u4ec5\u5305\u542b\u81ea\u53c2\u8003\u5907\u4efd\u4ee5\u6765\u88ab\u4fee\u6539\u8fc7\u7684\u5757\u3002\u589e\u91cf\u5907\u4efd\u4e0d\u80fd\u76f4\u63a5\u4f7f\u7528\uff1b\u5fc5\u987b\u5148\u4f7f\u7528<a class=\"xref\" href=\"/docs/devel/app-pgcombinebackup.html\" title=\"pg_combinebackup\"><span class=\"refentrytitle\"><span class=\"application\">pg_combinebackup</span></span></a>\u5c06\u5176\u4e0e\u5b83\u6240\u4f9d\u8d56\u7684\u5148\u524d\u5907\u4efd\u5408\u5e76\u3002\u5173\u4e8e\u589e\u91cf\u5907\u4efd\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u89c1<a class=\"xref\" href=\"/docs/devel/continuous-archiving.html#BACKUP-INCREMENTAL-BACKUP\" title=\"25.3.3.\u00a0\u8fdb\u884c\u589e\u91cf\u5907\u4efd\">\u7b2c\u00a025.3.3\u00a0\u8282</a>\uff1b\u5173\u4e8e\u4ece\u5907\u4efd\u6062\u590d\u7684\u6b65\u9aa4\uff0c\u89c1<a class=\"xref\" href=\"/docs/devel/continuous-archiving.html#BACKUP-PITR-RECOVERY\" title=\"25.3.5.\u00a0\u4f7f\u7528\u6301\u7eed\u5f52\u6863\u5907\u4efd\u8fdb\u884c\u6062\u590d\">\u7b2c\u00a025.3.5\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5728\u4efb\u4f55\u6a21\u5f0f\u4e0b\uff0c<span class=\"application\">pg_basebackup</span>\u90fd\u4f1a\u786e\u4fdd\u670d\u52a1\u5668\u81ea\u52a8\u8fdb\u5165\u548c\u9000\u51fa\u5907\u4efd\u6a21\u5f0f\u3002\u5907\u4efd\u59cb\u7ec8\u9488\u5bf9\u6574\u4e2a\u6570\u636e\u5e93\u96c6\u7c07\uff1b\u4e0d\u53ef\u80fd\u53ea\u5907\u4efd\u5355\u4e2a\u6570\u636e\u5e93\u6216\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u5bf9\u4e8e\u9009\u62e9\u6027\u5907\u4efd\uff0c\u5fc5\u987b\u4f7f\u7528\u8bf8\u5982<a class=\"xref\" href=\"/docs/devel/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>\u4e4b\u7c7b\u7684\u5176\u4ed6\u5de5\u5177\u3002</p>\n<p lang=\"zh\">\u5907\u4efd\u662f\u901a\u8fc7\u4e00\u4e2a\u4f7f\u7528\u590d\u5236\u534f\u8bae\u7684\u5e38\u89c4<span class=\"productname\">PostgreSQL</span>\u8fde\u63a5\u8fdb\u884c\u7684\u3002\u5efa\u7acb\u8be5\u8fde\u63a5\u6240\u4f7f\u7528\u7684\u7528\u6237 ID \u5fc5\u987b\u5177\u6709<code class=\"literal\">REPLICATION</code>\u6743\u9650\uff08\u89c1<a class=\"xref\" href=\"/docs/devel/role-attributes.html\" title=\"21.2.\u00a0\u89d2\u8272\u5c5e\u6027\">\u7b2c\u00a021.2\u00a0\u8282</a>\uff09\uff0c\u6216\u8005\u662f\u8d85\u7ea7\u7528\u6237\uff0c\u5e76\u4e14<a class=\"link\" href=\"/docs/devel/auth-pg-hba-conf.html\" title=\"20.1.\u00a0pg_hba.conf \u6587\u4ef6\"><code class=\"filename\">pg_hba.conf</code></a>\u5fc5\u987b\u5141\u8bb8\u8be5\u590d\u5236\u8fde\u63a5\u3002\u670d\u52a1\u5668\u8fd8\u5fc5\u987b\u5c06<a class=\"xref\" href=\"/docs/devel/runtime-config-replication.html#GUC-MAX-WAL-SENDERS\">max_wal_senders</a>\u8bbe\u7f6e\u5f97\u8db3\u591f\u9ad8\uff0c\u4ee5\u4fbf\u81f3\u5c11\u63d0\u4f9b\u4e00\u4e2a\u7528\u4e8e\u5907\u4efd\u7684 WAL \u53d1\u9001\u8fdb\u7a0b\uff0c\u5e76\u5728\u4f7f\u7528 WAL \u6d41\u5f0f\u4f20\u8f93\u65f6\u518d\u63d0\u4f9b\u4e00\u4e2a WAL \u53d1\u9001\u8fdb\u7a0b\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u540c\u65f6\u8fd0\u884c\u591a\u4e2a<code class=\"command\">pg_basebackup</code>\uff0c\u4f46\u4ece\u6027\u80fd\u89d2\u5ea6\u6765\u770b\uff0c\u901a\u5e38\u6700\u597d\u53ea\u6267\u884c\u4e00\u6b21\u5907\u4efd\uff0c\u7136\u540e\u590d\u5236\u5176\u7ed3\u679c\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u4e0d\u4ec5\u53ef\u4ee5\u4ece\u4e3b\u5e93\u83b7\u53d6\u57fa\u7840\u5907\u4efd\uff0c\u4e5f\u53ef\u4ee5\u4ece\u5907\u5e93\u83b7\u53d6\u3002\u8981\u4ece\u5907\u5e93\u83b7\u53d6\u5907\u4efd\uff0c\u9700\u8981\u5c06\u5907\u5e93\u914d\u7f6e\u4e3a\u80fd\u591f\u63a5\u53d7\u590d\u5236\u8fde\u63a5\uff08\u5373\u8bbe\u7f6e<code class=\"varname\">max_wal_senders</code>\u548c<a class=\"xref\" href=\"/docs/devel/runtime-config-replication.html#GUC-HOT-STANDBY\">hot_standby</a>\uff0c\u5e76\u9002\u5f53\u5730\u914d\u7f6e\u5176<code class=\"filename\">pg_hba.conf</code>\uff09\u3002\u8fd8\u9700\u8981\u5728\u4e3b\u5e93\u4e0a\u542f\u7528<a class=\"xref\" href=\"/docs/devel/runtime-config-wal.html#GUC-FULL-PAGE-WRITES\">full_page_writes</a>\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u4ece\u5907\u5e93\u83b7\u53d6\u5907\u4efd\u5b58\u5728\u4e00\u4e9b\u9650\u5236\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5907\u4efd\u5386\u53f2\u6587\u4ef6\u4e0d\u4f1a\u5728\u88ab\u5907\u4efd\u7684\u6570\u636e\u5e93\u96c6\u7c07\u4e2d\u521b\u5efa\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">pg_basebackup</span>\u65e0\u6cd5\u5f3a\u5236\u5907\u5e93\u5728\u5907\u4efd\u7ed3\u675f\u65f6\u5207\u6362\u5230\u65b0\u7684 WAL \u6587\u4ef6\u3002\u5f53\u4f7f\u7528<code class=\"literal\">-X none</code>\u65f6\uff0c\u5982\u679c\u4e3b\u5e93\u4e0a\u7684\u5199\u5165\u6d3b\u52a8\u8f83\u5c11\uff0c<span class=\"application\">pg_basebackup</span>\u53ef\u80fd\u9700\u8981\u957f\u65f6\u95f4\u7b49\u5f85\uff0c\u76f4\u5230\u5907\u4efd\u6240\u9700\u7684\u6700\u540e\u4e00\u4e2a WAL \u6587\u4ef6\u88ab\u5207\u6362\u5e76\u5f52\u6863\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5728\u4e3b\u5e93\u4e0a\u8fd0\u884c<code class=\"function\">pg_switch_wal</code>\uff0c\u4ee5\u7acb\u5373\u89e6\u53d1 WAL \u6587\u4ef6\u5207\u6362\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5982\u679c\u5907\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u88ab\u63d0\u5347\u4e3a\u4e3b\u5e93\uff0c\u5219\u5907\u4efd\u4f1a\u5931\u8d25\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5907\u4efd\u6240\u9700\u7684\u6240\u6709 WAL \u8bb0\u5f55\u90fd\u5fc5\u987b\u5305\u542b\u8db3\u591f\u7684\u6574\u9875\u5199\u5165\uff0c\u56e0\u6b64\u5fc5\u987b\u5728\u4e3b\u5e93\u4e0a\u542f\u7528<code class=\"varname\">full_page_writes</code>\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u6bcf\u5f53<span class=\"application\">pg_basebackup</span>\u6267\u884c\u57fa\u7840\u5907\u4efd\u65f6\uff0c\u670d\u52a1\u5668\u7684<code class=\"structname\">pg_stat_progress_basebackup</code>\u89c6\u56fe\u90fd\u4f1a\u62a5\u544a\u5907\u4efd\u8fdb\u5ea6\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/devel/progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING\" title=\"27.4.7.\u00a0\u57fa\u7840\u5907\u4efd\u8fdb\u5ea6\u62a5\u544a\">\u7b2c\u00a027.4.7\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u8f93\u51fa\u7684\u4f4d\u7f6e\u548c\u683c\u5f0f\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>directory</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u5199\u5165\u8f93\u51fa\u7684\u76ee\u6807\u76ee\u5f55\u3002\u5982\u679c\u8be5\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u521b\u5efa\u5b83\uff08\u4ee5\u53ca\u6240\u6709\u7f3a\u5931\u7684\u7236\u76ee\u5f55\uff09\u3002\u5982\u679c\u8be5\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002</p>\n<p lang=\"zh\">\u5f53\u5907\u4efd\u91c7\u7528 tar \u683c\u5f0f\u65f6\uff0c\u76ee\u6807\u76ee\u5f55\u53ef\u4ee5\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff08\u77ed\u6a2a\u7ebf\uff09\uff0c\u4ece\u800c\u5c06 tar \u6587\u4ef6\u5199\u5230<code class=\"literal\">stdout</code>\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u662f\u5fc5\u9700\u7684\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>format</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--format=<em class=\"replaceable\"><code>format</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u9009\u62e9\u8f93\u51fa\u683c\u5f0f\u3002<em class=\"replaceable\"><code>format</code></em>\u53ef\u4ee5\u662f\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">p</code><br/></span><span class=\"term\"><code class=\"literal\">plain</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u5199\u4e3a\u666e\u901a\u6587\u4ef6\uff0c\u5176\u5e03\u5c40\u4e0e\u6e90\u670d\u52a1\u5668\u7684\u6570\u636e\u76ee\u5f55\u548c\u8868\u7a7a\u95f4\u76f8\u540c\u3002\u5f53\u96c6\u7c07\u6ca1\u6709\u989d\u5916\u8868\u7a7a\u95f4\u65f6\uff0c\u6574\u4e2a\u6570\u636e\u5e93\u90fd\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u3002\u5982\u679c\u96c6\u7c07\u5305\u542b\u989d\u5916\u8868\u7a7a\u95f4\uff0c\u5219\u4e3b\u6570\u636e\u76ee\u5f55\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\uff0c\u800c\u5176\u4ed6\u6240\u6709\u8868\u7a7a\u95f4\u90fd\u4f1a\u653e\u5728\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u76f8\u540c\u7684\u7edd\u5bf9\u8def\u5f84\u4e2d\u3002\uff08\u5982\u9700\u6539\u53d8\u8fd9\u4e00\u70b9\uff0c\u89c1<code class=\"option\">--tablespace-mapping</code>\u3002\uff09</p>\n<p lang=\"zh\">\u8fd9\u662f\u9ed8\u8ba4\u683c\u5f0f\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">t</code><br/></span><span class=\"term\"><code class=\"literal\">tar</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u5199\u4e3a\u76ee\u6807\u76ee\u5f55\u4e2d\u7684 tar \u6587\u4ef6\u3002\u4e3b\u6570\u636e\u76ee\u5f55\u7684\u5185\u5bb9\u4f1a\u5199\u5165\u540d\u4e3a<code class=\"filename\">base.tar</code>\u7684\u6587\u4ef6\u4e2d\uff0c\u800c\u6bcf\u4e2a\u5176\u4ed6\u8868\u7a7a\u95f4\u90fd\u4f1a\u5199\u5165\u4e00\u4e2a\u4ee5\u8be5\u8868\u7a7a\u95f4 OID \u547d\u540d\u7684\u72ec\u7acb tar \u6587\u4ef6\u4e2d\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u76ee\u6807\u76ee\u5f55\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff08\u77ed\u6a2a\u7ebf\uff09\uff0ctar \u5185\u5bb9\u5c06\u5199\u5165\u6807\u51c6\u8f93\u51fa\uff0c\u9002\u5408\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u4f8b\u5982<span class=\"productname\">gzip</span>\u3002\u53ea\u6709\u5f53\u96c6\u7c07\u6ca1\u6709\u989d\u5916\u8868\u7a7a\u95f4\u4e14\u672a\u4f7f\u7528 WAL \u6d41\u5f0f\u4f20\u8f93\u65f6\uff0c\u624d\u5141\u8bb8\u8fd9\u6837\u505a\u3002</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-i <em class=\"replaceable\"><code>old_manifest_file</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--incremental=<em class=\"replaceable\"><code>old_manifest_file</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6267\u884c<a class=\"link\" href=\"/docs/devel/continuous-archiving.html#BACKUP-INCREMENTAL-BACKUP\" title=\"25.3.3.\u00a0\u8fdb\u884c\u589e\u91cf\u5907\u4efd\">\u589e\u91cf\u5907\u4efd</a>\u3002\u5fc5\u987b\u63d0\u4f9b\u53c2\u8003\u5907\u4efd\u7684\u5907\u4efd\u6e05\u5355\uff1b\u8be5\u6587\u4ef6\u5c06\u88ab\u4e0a\u4f20\u5230\u670d\u52a1\u5668\uff0c\u968f\u540e\u670d\u52a1\u5668\u4f1a\u8fd4\u56de\u6240\u8bf7\u6c42\u7684\u589e\u91cf\u5907\u4efd\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code><br/></span><span class=\"term\"><code class=\"option\">--write-recovery-conf</code></span></dt>\n<dd>\n<p lang=\"zh\">\u521b\u5efa<a class=\"link\" href=\"/docs/devel/warm-standby.html#FILE-STANDBY-SIGNAL\"><code class=\"filename\">standby.signal</code></a> <a class=\"indexterm\" id=\"id-1.9.4.10.6.2.1.4.3.1.2\" name=\"id-1.9.4.10.6.2.1.4.3.1.2\"></a>\u6587\u4ef6\uff0c\u5e76\u5c06\u8fde\u63a5\u8bbe\u7f6e\u8ffd\u52a0\u5230\u76ee\u6807\u76ee\u5f55\u4e2d\u7684<code class=\"filename\">postgresql.auto.conf</code>\u6587\u4ef6\u4e2d\uff08\u5982\u679c\u4f7f\u7528 tar \u683c\u5f0f\uff0c\u5219\u8ffd\u52a0\u5230\u57fa\u7840\u5f52\u6863\u6587\u4ef6\u5185\uff09\u3002\u8fd9\u6837\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u5229\u7528\u5907\u4efd\u7ed3\u679c\u642d\u5efa\u5907\u5e93\u3002</p>\n<p lang=\"zh\"><code class=\"filename\">postgresql.auto.conf</code>\u6587\u4ef6\u5c06\u8bb0\u5f55\u8fde\u63a5\u8bbe\u7f6e\uff0c\u4ee5\u53ca\uff08\u5982\u679c\u6307\u5b9a\uff09<span class=\"application\">pg_basebackup</span>\u6b63\u5728\u4f7f\u7528\u7684\u590d\u5236\u69fd\uff0c\u4ee5\u4fbf\u540e\u7eed\u7684\u6d41\u590d\u5236\u548c<a class=\"link\" href=\"/docs/devel/logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS-SYNCHRONIZATION\" title=\"47.2.3.\u00a0\u590d\u5236\u69fd\u540c\u6b65\">\u903b\u8f91\u590d\u5236\u69fd\u540c\u6b65</a>\u4f7f\u7528\u76f8\u540c\u7684\u8bbe\u7f6e\u3002\u53ea\u6709\u5f53 dbname \u5728\u8fde\u63a5\u5b57\u7b26\u4e32\u6216<a class=\"link\" href=\"/docs/devel/libpq-envars.html\" title=\"32.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u73af\u5883\u53d8\u91cf</a>\u4e2d\u88ab\u663e\u5f0f\u6307\u5b9a\u65f6\uff0c\u624d\u4f1a\u8bb0\u5f55 dbname\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t <em class=\"replaceable\"><code>target</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--target=<em class=\"replaceable\"><code>target</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u793a\u670d\u52a1\u5668\u5c06\u57fa\u7840\u5907\u4efd\u653e\u5230\u54ea\u91cc\u3002\u9ed8\u8ba4\u76ee\u6807\u662f<code class=\"literal\">client</code>\uff0c\u8868\u793a\u5907\u4efd\u5e94\u53d1\u9001\u5230\u8fd0\u884c<span class=\"application\">pg_basebackup</span>\u7684\u90a3\u53f0\u673a\u5668\u3002\u5982\u679c\u76ee\u6807\u6539\u4e3a<code class=\"literal\">server:/some/path</code>\uff0c\u5219\u5907\u4efd\u4f1a\u5b58\u50a8\u5728\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684<code class=\"literal\">/some/path</code>\u76ee\u5f55\u4e2d\u3002\u5c06\u5907\u4efd\u5b58\u50a8\u5728\u670d\u52a1\u5668\u4e0a\u9700\u8981\u8d85\u7ea7\u7528\u6237\u6743\u9650\uff0c\u6216\u62e5\u6709<code class=\"literal\">pg_write_server_files</code>\u89d2\u8272\u7684\u6743\u9650\u3002\u5982\u679c\u76ee\u6807\u8bbe\u7f6e\u4e3a<code class=\"literal\">blackhole</code>\uff0c\u5219\u5185\u5bb9\u4f1a\u88ab\u4e22\u5f03\uff0c\u4e0d\u4f1a\u5b58\u50a8\u5230\u4efb\u4f55\u5730\u65b9\u3002\u8fd9\u53ea\u5e94\u7528\u4e8e\u6d4b\u8bd5\u76ee\u7684\uff0c\u56e0\u4e3a\u6700\u7ec8\u4e0d\u4f1a\u5f97\u5230\u5b9e\u9645\u5907\u4efd\u3002</p>\n<p lang=\"zh\">\u7531\u4e8e WAL \u6d41\u5f0f\u4f20\u8f93\u662f\u7531<span class=\"application\">pg_basebackup</span>\u800c\u4e0d\u662f\u670d\u52a1\u5668\u5b9e\u73b0\u7684\uff0c\u56e0\u6b64\u6b64\u9009\u9879\u4e0d\u80fd\u4e0e<code class=\"literal\">-Xstream</code>\u4e00\u8d77\u4f7f\u7528\u3002\u7531\u4e8e\u540e\u8005\u662f\u9ed8\u8ba4\u503c\uff0c\u6240\u4ee5\u6307\u5b9a\u6b64\u9009\u9879\u65f6\uff0c\u8fd8\u5fc5\u987b\u540c\u65f6\u6307\u5b9a<code class=\"literal\">-Xfetch</code>\u6216<code class=\"literal\">-Xnone</code>\u4e4b\u4e00\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>olddir</code></em>=<em class=\"replaceable\"><code>newdir</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--tablespace-mapping=<em class=\"replaceable\"><code>olddir</code></em>=<em class=\"replaceable\"><code>newdir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u671f\u95f4\uff0c\u5c06\u76ee\u5f55<em class=\"replaceable\"><code>olddir</code></em>\u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230<em class=\"replaceable\"><code>newdir</code></em>\u3002\u8981\u4f7f\u6b64\u9009\u9879\u751f\u6548\uff0c<em class=\"replaceable\"><code>olddir</code></em>\u5fc5\u987b\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u5b9a\u4e49\u7684\u8be5\u8868\u7a7a\u95f4\u8def\u5f84\u5b8c\u5168\u4e00\u81f4\u3002\uff08\u4f46\u5982\u679c\u6e90\u670d\u52a1\u5668\u4e0a\u5728<em class=\"replaceable\"><code>olddir</code></em>\u4e2d\u6ca1\u6709\u8868\u7a7a\u95f4\uff0c\u4e5f\u4e0d\u7b97\u9519\u8bef\u3002\uff09\u4e0e\u6b64\u540c\u65f6\uff0c<em class=\"replaceable\"><code>newdir</code></em>\u662f\u63a5\u6536\u4e3b\u673a\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u4e00\u4e2a\u76ee\u5f55\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c<em class=\"replaceable\"><code>newdir</code></em>\u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002<em class=\"replaceable\"><code>olddir</code></em>\u548c<em class=\"replaceable\"><code>newdir</code></em>\u90fd\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u5982\u679c\u4efb\u4e00\u8def\u5f84\u4e2d\u9700\u8981\u5305\u542b\u7b49\u53f7\uff08<code class=\"literal\">=</code>\uff09\uff0c\u8bf7\u5728\u5176\u524d\u9762\u52a0\u4e0a\u53cd\u659c\u6760\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u4ee5\u5904\u7406\u591a\u4e2a\u8868\u7a7a\u95f4\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u91cd\u5b9a\u4f4d\u8868\u7a7a\u95f4\uff0c\u4e3b\u6570\u636e\u76ee\u5f55\u4e2d\u7684\u7b26\u53f7\u94fe\u63a5\u5c06\u88ab\u66f4\u65b0\u4e3a\u6307\u5411\u65b0\u4f4d\u7f6e\u3002\u56e0\u6b64\uff0c\u65b0\u6570\u636e\u76ee\u5f55\u5df2\u53ef\u76f4\u63a5\u7528\u4e8e\u542f\u52a8\u4e00\u4e2a\u6240\u6709\u8868\u7a7a\u95f4\u90fd\u4f4d\u4e8e\u66f4\u65b0\u540e\u4f4d\u7f6e\u7684\u65b0\u670d\u52a1\u5668\u5b9e\u4f8b\u3002</p>\n<p lang=\"zh\">\u76ee\u524d\uff0c\u6b64\u9009\u9879\u4ec5\u9002\u7528\u4e8e\u666e\u901a\u6587\u4ef6\u8f93\u51fa\u683c\u5f0f\uff1b\u5982\u679c\u9009\u62e9\u4e86 tar \u683c\u5f0f\uff0c\u5219\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--waldir=<em class=\"replaceable\"><code>waldir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5199\u5165 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cWAL \u6587\u4ef6\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u7684<code class=\"filename\">pg_wal</code>\u5b50\u76ee\u5f55\u4e2d\uff0c\u4f46\u6b64\u9009\u9879\u53ef\u7528\u4e8e\u5c06\u5176\u653e\u5728\u5176\u4ed6\u4f4d\u7f6e\u3002<em class=\"replaceable\"><code>waldir</code></em>\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c<em class=\"replaceable\"><code>waldir</code></em>\u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002\u53ea\u6709\u5f53\u5907\u4efd\u91c7\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u624d\u80fd\u6307\u5b9a\u6b64\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-X <em class=\"replaceable\"><code>method</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--wal-method=<em class=\"replaceable\"><code>method</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u4e2d\u5305\u542b\u6240\u9700\u7684 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u3002\u8fd9\u5c06\u5305\u62ec\u5907\u4efd\u671f\u95f4\u751f\u6210\u7684\u6240\u6709\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u9664\u975e\u6307\u5b9a\u65b9\u6cd5<code class=\"literal\">none</code>\uff0c\u5426\u5219\u5c31\u53ef\u4ee5\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u542f\u52a8 postmaster\uff0c\u800c\u65e0\u9700\u67e5\u9605 WAL \u5f52\u6863\uff0c\u4ece\u800c\u4f7f\u8f93\u51fa\u6210\u4e3a\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u5907\u4efd\u3002</p>\n<p lang=\"zh\">\u652f\u6301\u4ee5\u4e0b\u7528\u4e8e\u6536\u96c6\u9884\u5199\u5f0f\u65e5\u5fd7\u7684<em class=\"replaceable\"><code>method</code></em>\u503c\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">n</code><br/></span><span class=\"term\"><code class=\"literal\">none</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u5728\u5907\u4efd\u4e2d\u5305\u542b\u9884\u5199\u5f0f\u65e5\u5fd7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">f</code><br/></span><span class=\"term\"><code class=\"literal\">fetch</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u7ed3\u675f\u65f6\u6536\u96c6\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u3002\u56e0\u6b64\uff0c\u6e90\u670d\u52a1\u5668\u7684<a class=\"xref\" href=\"/docs/devel/runtime-config-replication.html#GUC-WAL-KEEP-SIZE\">wal_keep_size</a>\u53c2\u6570\u5fc5\u987b\u8bbe\u7f6e\u5f97\u8db3\u591f\u9ad8\uff0c\u4ee5\u786e\u4fdd\u5728\u5907\u4efd\u7ed3\u675f\u524d\u4e0d\u4f1a\u79fb\u9664\u6240\u9700\u7684\u65e5\u5fd7\u6570\u636e\u3002\u5982\u679c\u5728\u4f20\u8f93\u8fd9\u4e9b\u6570\u636e\u4e4b\u524d\u5b83\u4eec\u5df2\u7ecf\u88ab\u56de\u6536\uff0c\u5219\u5907\u4efd\u4f1a\u5931\u8d25\u5e76\u4e14\u65e0\u6cd5\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u4f1a\u5305\u542b\u5728<code class=\"filename\">base.tar</code>\u6587\u4ef6\u4e2d\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">s</code><br/></span><span class=\"term\"><code class=\"literal\">stream</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u6267\u884c\u5907\u4efd\u7684\u540c\u65f6\u6d41\u5f0f\u4f20\u8f93\u9884\u5199\u5f0f\u65e5\u5fd7\u6570\u636e\u3002\u6b64\u65b9\u6cd5\u4f1a\u5411\u670d\u52a1\u5668\u6253\u5f00\u7b2c\u4e8c\u4e2a\u8fde\u63a5\uff0c\u5e76\u5728\u6267\u884c\u5907\u4efd\u65f6\u5e76\u884c\u5f00\u59cb\u6d41\u5f0f\u4f20\u8f93\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u56e0\u6b64\uff0c\u5b83\u9700\u8981\u4e24\u4e2a\u590d\u5236\u8fde\u63a5\uff0c\u800c\u4e0d\u53ea\u662f\u4e00\u4e2a\u3002\u53ea\u8981\u5ba2\u6237\u7aef\u80fd\u591f\u8ddf\u4e0a\u9884\u5199\u5f0f\u65e5\u5fd7\u6570\u636e\uff0c\u4f7f\u7528\u6b64\u65b9\u6cd5\u5c31\u4e0d\u9700\u8981\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u989d\u5916\u4fdd\u7559\u9884\u5199\u5f0f\u65e5\u5fd7\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u4f1a\u5199\u5165\u4e00\u4e2a\u540d\u4e3a<code class=\"filename\">pg_wal.tar</code>\u7684\u72ec\u7acb\u6587\u4ef6\u4e2d\uff08\u5982\u679c\u670d\u52a1\u5668\u7248\u672c\u65e9\u4e8e 10\uff0c\u5219\u6587\u4ef6\u540d\u4e3a<code class=\"filename\">pg_xlog.tar</code>\uff09\u3002</p>\n<p lang=\"zh\">\u8fd9\u662f\u9ed8\u8ba4\u503c\u3002</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-z</code><br/></span><span class=\"term\"><code class=\"option\">--gzip</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u4f7f\u7528\u9ed8\u8ba4\u538b\u7f29\u7ea7\u522b\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0<code class=\"filename\">.gz</code>\u540e\u7f00\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-Z <em class=\"replaceable\"><code>level</code></em></code><br/></span><span class=\"term\"><code class=\"option\">-Z [{client|server}-]<em class=\"replaceable\"><code>method</code></em>[:<em class=\"replaceable\"><code>detail</code></em>]</code><br/></span><span class=\"term\"><code class=\"option\">--compress=<em class=\"replaceable\"><code>level</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--compress=[{client|server}-]<em class=\"replaceable\"><code>method</code></em>[:<em class=\"replaceable\"><code>detail</code></em>]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bf7\u6c42\u5bf9\u5907\u4efd\u8fdb\u884c\u538b\u7f29\u3002\u5982\u679c\u5305\u542b<code class=\"literal\">client</code>\u6216<code class=\"literal\">server</code>\uff0c\u5219\u6307\u5b9a\u538b\u7f29\u6267\u884c\u7684\u4f4d\u7f6e\u3002\u5728\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4f1a\u51cf\u5c11\u4f20\u8f93\u5e26\u5bbd\u5360\u7528\uff0c\u4f46\u4f1a\u589e\u52a0\u670d\u52a1\u5668 CPU \u6d88\u8017\u3002\u9ed8\u8ba4\u503c\u662f<code class=\"literal\">client</code>\uff0c\u4f46\u4f7f\u7528<code class=\"literal\">--target</code>\u65f6\u9664\u5916\uff1b\u6b64\u65f6\u5907\u4efd\u4e0d\u4f1a\u53d1\u9001\u5230\u5ba2\u6237\u7aef\uff0c\u56e0\u6b64\u53ea\u6709\u670d\u52a1\u5668\u7aef\u538b\u7f29\u624d\u6709\u610f\u4e49\u3002\u4f7f\u7528\u9ed8\u8ba4\u7684<code class=\"literal\">-Xstream</code>\u65f6\uff0c\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4e0d\u4f1a\u5e94\u7528\u4e8e WAL\u3002\u82e5\u8981\u538b\u7f29 WAL\uff0c\u8bf7\u4f7f\u7528\u5ba2\u6237\u7aef\u538b\u7f29\uff0c\u6216\u8005\u6307\u5b9a<code class=\"literal\">-Xfetch</code>\u3002</p>\n<p lang=\"zh\">\u538b\u7f29\u65b9\u6cd5\u53ef\u4ee5\u8bbe\u7f6e\u4e3a<code class=\"literal\">gzip</code>\u3001<code class=\"literal\">lz4</code>\u3001<code class=\"literal\">zstd</code>\u3001<code class=\"literal\">none</code>\uff08\u4e0d\u538b\u7f29\uff09\uff0c\u4e5f\u53ef\u4ee5\u76f4\u63a5\u6307\u5b9a\u4e00\u4e2a\u6574\u6570\uff080 \u8868\u793a\u4e0d\u538b\u7f29\uff0c\u5927\u4e8e 0 \u8868\u793a<code class=\"literal\">gzip</code>\uff09\u3002\u8fd8\u53ef\u4ee5\u9009\u62e9\u6027\u5730\u6307\u5b9a\u538b\u7f29\u7ec6\u8282\u5b57\u7b26\u4e32\u3002\u5982\u679c\u7ec6\u8282\u5b57\u7b26\u4e32\u662f\u6574\u6570\uff0c\u5219\u8868\u793a\u538b\u7f29\u7ea7\u522b\uff1b\u5426\u5219\uff0c\u5b83\u5e94\u4e3a\u9017\u53f7\u5206\u9694\u7684\u9879\u76ee\u5217\u8868\uff0c\u6bcf\u9879\u7684\u5f62\u5f0f\u4e3a<em class=\"replaceable\"><code>keyword</code></em>\u6216<em class=\"replaceable\"><code>keyword=value</code></em>\u3002\u76ee\u524d\u652f\u6301\u7684\u5173\u952e\u5b57\u6709<code class=\"literal\">level</code>\u3001<code class=\"literal\">long</code>\u548c<code class=\"literal\">workers</code>\u3002\u5f53\u538b\u7f29\u65b9\u6cd5\u4ee5\u7eaf\u6574\u6570\u5f62\u5f0f\u6307\u5b9a\u65f6\uff0c\u4e0d\u80fd\u518d\u4f7f\u7528\u7ec6\u8282\u5b57\u7b26\u4e32\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u538b\u7f29\u7ea7\u522b\uff0c\u5c06\u4f7f\u7528\u9ed8\u8ba4\u7ea7\u522b\u3002\u5982\u679c\u53ea\u6307\u5b9a\u7ea7\u522b\u800c\u672a\u6307\u5b9a\u7b97\u6cd5\uff0c\u5219\u7ea7\u522b\u5927\u4e8e 0 \u65f6\u4f7f\u7528 gzip \u538b\u7f29\uff0c\u7ea7\u522b\u4e3a 0 \u65f6\u4e0d\u538b\u7f29\u3002</p>\n<p lang=\"zh\">\u5f53 tar \u683c\u5f0f\u914d\u5408<code class=\"literal\">gzip</code>\u3001<code class=\"literal\">lz4</code>\u6216<code class=\"literal\">zstd</code>\u4f7f\u7528\u65f6\uff0c\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u5206\u522b\u81ea\u52a8\u52a0\u4e0a<code class=\"filename\">.gz</code>\u3001<code class=\"filename\">.lz4</code>\u6216<code class=\"filename\">.zst</code>\u540e\u7f00\u3002\u4f7f\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u4e0d\u80fd\u6307\u5b9a\u5ba2\u6237\u7aef\u538b\u7f29\uff0c\u4f46\u4ecd\u53ef\u4ee5\u8bf7\u6c42\u670d\u52a1\u5668\u7aef\u538b\u7f29\u3002\u8fd9\u6837\u505a\u65f6\uff0c\u670d\u52a1\u5668\u4f1a\u5148\u538b\u7f29\u5907\u4efd\u518d\u4f20\u8f93\uff0c\u800c\u5ba2\u6237\u7aef\u4f1a\u5bf9\u5176\u8fdb\u884c\u89e3\u538b\u5e76\u63d0\u53d6\u3002</p>\n<p lang=\"zh\">\u5f53\u6b64\u9009\u9879\u4e0e<code class=\"literal\">-Xstream</code>\u7ec4\u5408\u4f7f\u7528\u65f6\uff0c\u5982\u679c\u9009\u62e9\u4e86\u5ba2\u6237\u7aef gzip \u538b\u7f29\uff0c\u5219<code class=\"literal\">pg_wal.tar</code>\u4f1a\u4f7f\u7528<code class=\"literal\">gzip</code>\u538b\u7f29\uff1b\u4f46\u5982\u679c\u9009\u62e9\u4e86\u5176\u4ed6\u538b\u7f29\u7b97\u6cd5\uff0c\u6216\u8005\u9009\u62e9\u4e86\u670d\u52a1\u5668\u7aef\u538b\u7f29\uff0c\u5219\u4e0d\u4f1a\u88ab\u538b\u7f29\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u5907\u4efd\u7684\u751f\u6210\u548c\u7a0b\u5e8f\u7684\u8c03\u7528\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-c {fast|spread}</code><br/></span><span class=\"term\"><code class=\"option\">--checkpoint={fast|spread}</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u68c0\u67e5\u70b9\u6a21\u5f0f\u8bbe\u7f6e\u4e3a fast \u6216 spread\uff08\u89c1<a class=\"xref\" href=\"/docs/devel/continuous-archiving.html#BACKUP-LOWLEVEL-BASE-BACKUP\" title=\"25.3.4.\u00a0\u4f7f\u7528\u4f4e\u7ea7 API \u8fdb\u884c\u57fa\u7840\u5907\u4efd\">\u7b2c\u00a025.3.4\u00a0\u8282</a>\uff09\u3002\u9ed8\u8ba4\u503c\u4e3a spread\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--create-slot</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728\u5f00\u59cb\u5907\u4efd\u4e4b\u524d\uff0c\u5e94\u521b\u5efa\u7531<code class=\"literal\">--slot</code>\u9009\u9879\u6307\u5b9a\u540d\u79f0\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u8be5\u69fd\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u9519\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>label</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--label=<em class=\"replaceable\"><code>label</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5907\u4efd\u6807\u7b7e\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u503c<span class=\"quote\">\u201c<span class=\"quote\"><code class=\"literal\">pg_basebackup base backup</code></span>\u201d</span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-clean</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53<code class=\"command\">pg_basebackup</code>\u56e0\u9519\u8bef\u4e2d\u6b62\u65f6\uff0c\u5b83\u4f1a\u5220\u9664\u5728\u53d1\u73b0\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u76ee\u5f55\uff08\u4f8b\u5982\u76ee\u6807\u76ee\u5f55\u548c\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\uff09\u3002\u6b64\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u5f88\u6709\u5e2e\u52a9\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u65e0\u8bba\u662f\u5426\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u8868\u7a7a\u95f4\u76ee\u5f55\u90fd\u4e0d\u4f1a\u88ab\u6e05\u7406\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N</code><br/></span><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">pg_basebackup</code>\u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u88ab\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f1a\u4f7f<code class=\"command\">pg_basebackup</code>\u4e0d\u7ecf\u7b49\u5f85\u5c31\u76f4\u63a5\u8fd4\u56de\uff0c\u56e0\u6b64\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u968f\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u57fa\u7840\u5907\u4efd\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u5408\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P</code><br/></span><span class=\"term\"><code class=\"option\">--progress</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528\u8fdb\u5ea6\u62a5\u544a\u3002\u6253\u5f00\u6b64\u9009\u9879\u540e\uff0c\u4f1a\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u7ed9\u51fa\u4e00\u4e2a\u8fd1\u4f3c\u7684\u8fdb\u5ea6\u62a5\u544a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u53d1\u751f\u53d8\u5316\uff0c\u56e0\u6b64\u8fd9\u53ea\u662f\u8fd1\u4f3c\u503c\uff0c\u6700\u7ec8\u672a\u5fc5\u6070\u597d\u7ed3\u675f\u5728<code class=\"literal\">100%</code>\u3002\u7279\u522b\u662f\u5f53\u5907\u4efd\u4e2d\u5305\u542b WAL \u65f6\uff0c\u603b\u6570\u636e\u91cf\u65e0\u6cd5\u9884\u5148\u4f30\u8ba1\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u65e6\u8fdb\u5ea6\u8d85\u8fc7\u4e0d\u542b WAL \u65f6\u7684\u603b\u4f30\u8ba1\u503c\uff0c\u4f30\u8ba1\u76ee\u6807\u5927\u5c0f\u5c31\u4f1a\u7ee7\u7eed\u589e\u52a0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r <em class=\"replaceable\"><code>rate</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--max-rate=<em class=\"replaceable\"><code>rate</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u4ece\u6e90\u670d\u52a1\u5668\u6536\u96c6\u6570\u636e\u65f6\u5141\u8bb8\u7684\u6700\u5927\u4f20\u8f93\u901f\u7387\u3002\u8fd9\u6709\u52a9\u4e8e\u9650\u5236<span class=\"application\">pg_basebackup</span>\u5bf9\u670d\u52a1\u5668\u7684\u5f71\u54cd\u3002\u53d6\u503c\u5355\u4f4d\u4e3a\u6bcf\u79d2\u5343\u5b57\u8282\u3002\u4f7f\u7528\u540e\u7f00<code class=\"literal\">M</code>\u8868\u793a\u6bcf\u79d2\u5146\u5b57\u8282\u3002\u4e5f\u63a5\u53d7\u540e\u7f00<code class=\"literal\">k</code>\uff0c\u4f46\u6ca1\u6709\u5b9e\u9645\u5f71\u54cd\u3002\u6709\u6548\u53d6\u503c\u8303\u56f4\u4e3a\u6bcf\u79d2 32 \u5343\u5b57\u8282\u5230\u6bcf\u79d2 1024 \u5146\u5b57\u8282\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u59cb\u7ec8\u5f71\u54cd\u6570\u636e\u76ee\u5f55\u7684\u4f20\u8f93\u3002\u53ea\u6709\u5f53\u6536\u96c6\u65b9\u6cd5\u4e3a<code class=\"literal\">fetch</code>\u65f6\uff0cWAL \u6587\u4ef6\u7684\u4f20\u8f93\u624d\u4f1a\u53d7\u5230\u5f71\u54cd\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>slotname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--slot=<em class=\"replaceable\"><code>slotname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u53ea\u80fd\u4e0e<code class=\"literal\">-X stream</code>\u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u4f1a\u4f7f WAL \u6d41\u5f0f\u4f20\u8f93\u4f7f\u7528\u6307\u5b9a\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u6b64\u57fa\u7840\u5907\u4efd\u6253\u7b97\u7528\u4f5c\u4f7f\u7528\u590d\u5236\u69fd\u7684\u6d41\u590d\u5236\u5907\u5e93\uff0c\u90a3\u4e48\u8be5\u5907\u5e93\u5e94\u5c06\u540c\u4e00\u4e2a\u590d\u5236\u69fd\u540d\u79f0\u7528\u4f5c<a class=\"xref\" href=\"/docs/devel/runtime-config-replication.html#GUC-PRIMARY-SLOT-NAME\">primary_slot_name</a>\u7684\u503c\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u4e3b\u5e93\u5728\u57fa\u7840\u5907\u4efd\u7ed3\u675f\u4e0e\u65b0\u5907\u5e93\u5f00\u59cb\u6d41\u590d\u5236\u4e4b\u95f4\u7684\u8fd9\u6bb5\u65f6\u95f4\u5185\uff0c\u4e0d\u4f1a\u79fb\u9664\u4efb\u4f55\u5fc5\u9700\u7684 WAL \u6570\u636e\u3002</p>\n<p lang=\"zh\">\u6307\u5b9a\u7684\u590d\u5236\u69fd\u5fc5\u987b\u5df2\u7ecf\u5b58\u5728\uff0c\u9664\u975e\u8fd8\u540c\u65f6\u4f7f\u7528\u4e86<code class=\"option\">-C</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5e76\u4e14\u670d\u52a1\u5668\u652f\u6301\u4e34\u65f6\u590d\u5236\u69fd\uff0810 \u53ca\u4ee5\u4e0a\u7248\u672c\uff09\uff0c\u5219\u4f1a\u81ea\u52a8\u4f7f\u7528\u4e34\u65f6\u590d\u5236\u69fd\u8fdb\u884c WAL \u6d41\u5f0f\u4f20\u8f93\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--sync-method=<em class=\"replaceable\"><code>method</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u4e3a<code class=\"literal\">fsync</code>\uff08\u9ed8\u8ba4\uff09\u65f6\uff0c<code class=\"command\">pg_basebackup</code>\u4f1a\u9012\u5f52\u6253\u5f00\u5e76\u540c\u6b65\u5907\u4efd\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3002\u4f7f\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u67e5\u627e\u6587\u4ef6\u4f1a\u8ddf\u968f WAL \u76ee\u5f55\u548c\u5404\u5df2\u914d\u7f6e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u3002</p>\n<p lang=\"zh\">\u5728 Linux \u4e0a\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528<code class=\"literal\">syncfs</code>\uff0c\u8ba9\u64cd\u4f5c\u7cfb\u7edf\u540c\u6b65\u5305\u542b\u5907\u4efd\u76ee\u5f55\u7684\u6574\u4e2a\u6587\u4ef6\u7cfb\u7edf\u3002\u4f7f\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c<code class=\"command\">pg_basebackup</code>\u8fd8\u4f1a\u540c\u6b65\u5305\u542b WAL \u6587\u4ef6\u548c\u5404\u8868\u7a7a\u95f4\u7684\u6587\u4ef6\u7cfb\u7edf\u3002\u5173\u4e8e\u4f7f\u7528<code class=\"literal\">syncfs</code>\u65f6\u9700\u8981\u6ce8\u610f\u7684\u4e8b\u9879\uff0c\u89c1<a class=\"xref\" href=\"/docs/devel/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\">recovery_init_sync_method</a>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--no-sync</code>\u65f6\uff0c\u6b64\u9009\u9879\u65e0\u6548\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\u3002\u5b83\u4f1a\u5728\u542f\u52a8\u548c\u5173\u95ed\u8fc7\u7a0b\u4e2d\u8f93\u51fa\u4e00\u4e9b\u989d\u5916\u6b65\u9aa4\uff1b\u5982\u679c\u540c\u65f6\u542f\u7528\u4e86\u8fdb\u5ea6\u62a5\u544a\uff0c\u8fd8\u4f1a\u663e\u793a\u5f53\u524d\u6b63\u5728\u5904\u7406\u7684\u786e\u5207\u6587\u4ef6\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--manifest-checksums=<em class=\"replaceable\"><code>algorithm</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u5e94\u7528\u5230\u5907\u4efd\u6e05\u5355\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u7684\u6821\u9a8c\u548c\u7b97\u6cd5\u3002\u76ee\u524d\u53ef\u7528\u7684\u7b97\u6cd5\u6709<code class=\"literal\">NONE</code>\u3001<code class=\"literal\">CRC32C</code>\u3001<code class=\"literal\">SHA224</code>\u3001<code class=\"literal\">SHA256</code>\u3001<code class=\"literal\">SHA384</code>\u548c<code class=\"literal\">SHA512</code>\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">CRC32C</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">NONE</code>\uff0c\u5907\u4efd\u6e05\u5355\u5c06\u4e0d\u5305\u542b\u4efb\u4f55\u6821\u9a8c\u548c\u3002\u5426\u5219\uff0c\u5b83\u5c06\u5305\u542b\u4f7f\u7528\u6307\u5b9a\u7b97\u6cd5\u4e3a\u5907\u4efd\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u8ba1\u7b97\u7684\u6821\u9a8c\u548c\u3002\u6b64\u5916\uff0c\u6e05\u5355\u59cb\u7ec8\u4f1a\u5305\u542b\u5176\u81ea\u8eab\u5185\u5bb9\u7684<code class=\"literal\">SHA256</code>\u6821\u9a8c\u548c\u3002<code class=\"literal\">SHA</code>\u7b97\u6cd5\u660e\u663e\u6bd4<code class=\"literal\">CRC32C</code>\u66f4\u8017\u8d39 CPU\uff0c\u56e0\u6b64\u9009\u62e9\u5176\u4e2d\u4e00\u79cd\u53ef\u80fd\u4f1a\u589e\u52a0\u5b8c\u6210\u5907\u4efd\u6240\u9700\u7684\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u5e0c\u671b\u9a8c\u8bc1\u5907\u4efd\u672a\u88ab\u7be1\u6539\u7684\u7528\u6237\uff0c\u4f7f\u7528 SHA hash \u51fd\u6570\u53ef\u4ee5\u4e3a\u6bcf\u4e2a\u6587\u4ef6\u63d0\u4f9b\u5177\u6709\u5bc6\u7801\u5b66\u5b89\u5168\u6027\u7684\u6458\u8981\uff1b\u800c CRC-32C \u7b97\u6cd5\u63d0\u4f9b\u7684\u6821\u9a8c\u548c\u8ba1\u7b97\u901f\u5ea6\u8981\u5feb\u5f97\u591a\uff0c\u867d\u7136\u5b83\u5f88\u9002\u5408\u53d1\u73b0\u7531\u4e8e\u610f\u5916\u6539\u52a8\u9020\u6210\u7684\u9519\u8bef\uff0c\u4f46\u5e76\u4e0d\u80fd\u62b5\u5fa1\u6076\u610f\u4fee\u6539\u3002\u8bf7\u6ce8\u610f\uff0c\u8981\u60f3\u5bf9\u80fd\u591f\u8bbf\u95ee\u5907\u4efd\u7684\u653b\u51fb\u8005\u5f62\u6210\u9632\u62a4\uff0c\u5907\u4efd\u6e05\u5355\u5c31\u9700\u8981\u5b89\u5168\u5730\u4fdd\u5b58\u5728\u5176\u4ed6\u5730\u65b9\uff0c\u6216\u8005\u4ee5\u5176\u4ed6\u65b9\u5f0f\u786e\u8ba4\u81ea\u5907\u4efd\u5b8c\u6210\u540e\u672a\u88ab\u4fee\u6539\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528<a class=\"xref\" href=\"/docs/devel/app-pgverifybackup.html\" title=\"pg_verifybackup\"><span class=\"refentrytitle\"><span class=\"application\">pg_verifybackup</span></span></a>\u6839\u636e\u5907\u4efd\u6e05\u5355\u68c0\u67e5\u5907\u4efd\u7684\u5b8c\u6574\u6027\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--manifest-force-encode</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f3a\u5236\u5c06\u5907\u4efd\u6e05\u5355\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u540d\u7f16\u7801\u4e3a\u5341\u516d\u8fdb\u5236\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u5bf9\u975e UTF8 \u6587\u4ef6\u540d\u8fdb\u884c\u5341\u516d\u8fdb\u5236\u7f16\u7801\u3002\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u8bfb\u53d6\u5907\u4efd\u6e05\u5355\u6587\u4ef6\u7684\u5de5\u5177\u662f\u5426\u80fd\u6b63\u786e\u5904\u7406\u8fd9\u79cd\u60c5\u51b5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-estimate-size</code></span></dt>\n<dd>\n<p lang=\"zh\">\u7981\u6b62\u670d\u52a1\u5668\u4f30\u7b97\u5c06\u8981\u6d41\u5f0f\u4f20\u8f93\u7684\u5907\u4efd\u6570\u636e\u603b\u91cf\uff0c\u56e0\u6b64 pg_stat_progress_basebackup \u89c6\u56fe\u4e2d\u7684 backup_total \u5217\u59cb\u7ec8\u4e3a NULL\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5907\u4efd\u4f1a\u5148\u679a\u4e3e\u6574\u4e2a\u6570\u636e\u5e93\u7684\u5927\u5c0f\uff0c\u7136\u540e\u518d\u56de\u8fc7\u5934\u6765\u53d1\u9001\u5b9e\u9645\u5185\u5bb9\u3002\u8fd9\u53ef\u80fd\u4f1a\u8ba9\u5907\u4efd\u8017\u65f6\u7565\u957f\uff0c\u7279\u522b\u662f\u5728\u53d1\u9001\u7b2c\u4e00\u6279\u6570\u636e\u4e4b\u524d\u6240\u9700\u65f6\u95f4\u4f1a\u66f4\u4e45\u3002\u5982\u679c\u8fd9\u79cd\u4f30\u7b97\u8017\u65f6\u8fc7\u957f\uff0c\u6b64\u9009\u9879\u5c31\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u5b83\u53ef\u4ee5\u907f\u514d\u8fd9\u6bb5\u4f30\u7b97\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--progress</code>\u65f6\uff0c\u4e0d\u5141\u8bb8\u4f7f\u7528\u6b64\u9009\u9879\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-manifest</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7981\u6b62\u751f\u6210\u5907\u4efd\u6e05\u5355\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u670d\u52a1\u5668\u5c06\u751f\u6210\u5e76\u53d1\u9001\u4e00\u4e2a\u5907\u4efd\u6e05\u5355\uff0c\u53ef\u4f7f\u7528<a class=\"xref\" href=\"/docs/devel/app-pgverifybackup.html\" title=\"pg_verifybackup\"><span class=\"refentrytitle\"><span class=\"application\">pg_verifybackup</span></span></a>\u8fdb\u884c\u9a8c\u8bc1\u3002\u8be5\u6e05\u5355\u5217\u51fa\u4e86\u5907\u4efd\u4e2d\u7684\u6bcf\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u4e0d\u5305\u62ec\u53ef\u80fd\u5305\u542b\u5728\u5176\u4e2d\u7684\u4efb\u4f55 WAL \u6587\u4ef6\u3002\u5b83\u8fd8\u4f1a\u4fdd\u5b58\u6bcf\u4e2a\u6587\u4ef6\u7684\u5927\u5c0f\u3001\u6700\u540e\u4fee\u6539\u65f6\u95f4\u4ee5\u53ca\u53ef\u9009\u7684\u6821\u9a8c\u548c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-slot</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9632\u6b62\u4e3a\u5907\u4efd\u521b\u5efa\u4e34\u65f6\u590d\u5236\u69fd\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u9009\u62e9\u4e86 WAL \u6d41\u5f0f\u4f20\u8f93\uff0c\u4f46\u6ca1\u6709\u4f7f\u7528<code class=\"option\">-S</code>\u9009\u9879\u7ed9\u51fa\u69fd\u540d\uff0c\u90a3\u4e48\u4f1a\u521b\u5efa\u4e00\u4e2a\u4e34\u65f6\u590d\u5236\u69fd\uff08\u5982\u679c\u6e90\u670d\u52a1\u5668\u652f\u6301\uff09\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7684\u4e3b\u8981\u76ee\u7684\u662f\u5728\u670d\u52a1\u5668\u6ca1\u6709\u7a7a\u95f2\u590d\u5236\u69fd\u65f6\uff0c\u4ecd\u7136\u5141\u8bb8\u6267\u884c\u57fa\u7840\u5907\u4efd\u3002\u51e0\u4e4e\u603b\u662f\u9996\u9009\u4f7f\u7528\u590d\u5236\u69fd\uff0c\u56e0\u4e3a\u5b83\u80fd\u9632\u6b62\u670d\u52a1\u5668\u5728\u5907\u4efd\u671f\u95f4\u79fb\u9664\u6240\u9700\u7684 WAL\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-verify-checksums</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u83b7\u53d6\u57fa\u7840\u5907\u4efd\u7684\u670d\u52a1\u5668\u542f\u7528\u4e86\u6821\u9a8c\u548c\uff0c\u5219\u7981\u7528\u5bf9\u8fd9\u4e9b\u6821\u9a8c\u548c\u7684\u9a8c\u8bc1\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f1a\u9a8c\u8bc1\u6821\u9a8c\u548c\uff1b\u6821\u9a8c\u548c\u9a8c\u8bc1\u5931\u8d25\u5c06\u5bfc\u81f4\u975e\u96f6\u9000\u51fa\u72b6\u6001\u3002\u4e0d\u8fc7\uff0c\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u57fa\u7840\u5907\u4efd\u4e0d\u4f1a\u88ab\u5220\u9664\uff0c\u5c31\u50cf\u4f7f\u7528\u4e86<code class=\"option\">--no-clean</code>\u4e00\u6837\u3002\u6821\u9a8c\u548c\u9a8c\u8bc1\u5931\u8d25\u4e5f\u4f1a\u5728<a class=\"link\" href=\"/docs/devel/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW\" title=\"27.2.20.\u00a0pg_stat_database\"><code class=\"structname\">pg_stat_database</code></a>\u89c6\u56fe\u4e2d\u62a5\u544a\u3002</p>\n<p lang=\"zh\">\u8981\u9a8c\u8bc1\u6821\u9a8c\u548c\uff0c\u670d\u52a1\u5668\u5fc5\u987b\u5728\u57fa\u7840\u5907\u4efd\u7684\u6574\u4e2a\u671f\u95f4\u542f\u7528\u6821\u9a8c\u548c\u3002\u5982\u679c\u57fa\u7840\u5907\u4efd\u5f00\u59cb\u65f6\u6821\u9a8c\u548c\u6b63\u5904\u4e8e\u542f\u7528\u8fc7\u7a0b\u4e2d\uff0c\u5219\u8be5\u57fa\u7840\u5907\u4efd\u4f1a\u7981\u7528\u6821\u9a8c\u548c\u9a8c\u8bc1\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u5230\u6e90\u670d\u52a1\u5668\u7684\u8fde\u63a5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>connstr</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>connstr</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ee5<a class=\"link\" href=\"/docs/devel/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u7684\u5f62\u5f0f\u6307\u5b9a\u7528\u4e8e\u8fde\u63a5\u670d\u52a1\u5668\u7684\u53c2\u6570\uff1b\u8fd9\u4e9b\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u76f8\u4e92\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u51fa\u4e8e\u4e0e\u5176\u4ed6\u5ba2\u6237\u7aef\u5e94\u7528\u4fdd\u6301\u4e00\u81f4\u7684\u8003\u8651\uff0c\u6b64\u9009\u9879\u540d\u4e3a<code class=\"literal\">--dbname</code>\uff1b\u4f46\u7531\u4e8e<span class=\"application\">pg_basebackup</span>\u5e76\u4e0d\u8fde\u63a5\u5230\u96c6\u7c07\u4e2d\u7684\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u7684\u6570\u636e\u5e93\u540d\u4f1a\u88ab\u670d\u52a1\u5668\u5ffd\u7565\u3002\u4e0d\u8fc7\uff0c\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u63d0\u4f9b\u7684\u6570\u636e\u5e93\u540d\u4f1a\u8986\u76d6\u9ed8\u8ba4\u6570\u636e\u5e93\u540d\uff08<code class=\"literal\">replication</code>\uff09\uff0c\u4ece\u800c\u7528\u4e8e\u5728<code class=\"filename\">~/.pgpass</code>\u4e2d\u67e5\u627e\u590d\u5236\u8fde\u63a5\u7684\u5bc6\u7801\u3002\u7c7b\u4f3c\u5730\uff0c\u8fde\u63a5<span class=\"productname\">PostgreSQL</span>\u65f6\u4f7f\u7528\u7684\u4e2d\u95f4\u4ef6\u6216\u4ee3\u7406\uff0c\u4e5f\u53ef\u80fd\u51fa\u4e8e\u8fde\u63a5\u8def\u7531\u7b49\u76ee\u7684\u4f7f\u7528\u8be5\u540d\u79f0\u3002\u8be5\u6570\u636e\u5e93\u540d\u4e5f\u53ef\u4f9b<a class=\"link\" href=\"/docs/devel/logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS-SYNCHRONIZATION\" title=\"47.2.3.\u00a0\u590d\u5236\u69fd\u540c\u6b65\">\u903b\u8f91\u590d\u5236\u69fd\u540c\u6b65</a>\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea<code class=\"envar\">PGHOST</code>\u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff1b\u5426\u5219\u4f1a\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u6240\u4f7f\u7528\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u4f7f\u7528<code class=\"envar\">PGPORT</code>\u73af\u5883\u53d8\u91cf\u4e2d\u7684\u503c\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u786e\u5b9a\u7684\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s <em class=\"replaceable\"><code>interval</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--status-interval=<em class=\"replaceable\"><code>interval</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u53d1\u9001\u56de\u6e90\u670d\u52a1\u5668\u7684\u72b6\u6001\u5305\u4e4b\u95f4\u76f8\u9694\u7684\u79d2\u6570\u3002\u8f83\u5c0f\u7684\u503c\u53ef\u4ee5\u8ba9\u670d\u52a1\u5668\u7aef\u5bf9\u5907\u4efd\u8fdb\u5ea6\u7684\u76d1\u63a7\u66f4\u7cbe\u786e\u3002\u503c\u4e3a\u96f6\u65f6\u4f1a\u5b8c\u5168\u7981\u7528\u5468\u671f\u6027\u72b6\u6001\u66f4\u65b0\uff0c\u4e0d\u8fc7\u5f53\u670d\u52a1\u5668\u8bf7\u6c42\u65f6\u4ecd\u4f1a\u53d1\u9001\u66f4\u65b0\uff0c\u4ee5\u907f\u514d\u56e0\u8d85\u65f6\u800c\u65ad\u5f00\u8fde\u63a5\u3002\u9ed8\u8ba4\u503c\u662f 10 \u79d2\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7981\u6b62\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\uff08\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff09\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u6b64\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u79cd\u573a\u666f\u4e0b\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236<span class=\"application\">pg_basebackup</span>\u5728\u8fde\u63a5\u6e90\u670d\u52a1\u5668\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7edd\u975e\u5fc5\u9700\uff0c\u56e0\u4e3a\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u81ea\u52a8\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\u6765\u53d1\u73b0\u670d\u52a1\u5668\u9700\u8981\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u8f93\u5165<code class=\"option\">-W</code>\u4ee5\u907f\u514d\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u662f\u503c\u5f97\u7684\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5176\u4ed6\u9009\u9879\u4e5f\u53ef\u7528\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa<span class=\"application\">pg_basebackup</span>\u7684\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"application\">pg_basebackup</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6<span class=\"productname\">PostgreSQL</span>\u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528<span class=\"application\">libpq</span>\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/devel/libpq-envars.html\" title=\"32.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.14\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\">\u73af\u5883\u53d8\u91cf<code class=\"envar\">PG_COLOR</code>\u6307\u5b9a\u662f\u5426\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a<code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c<code class=\"literal\">never</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u5728\u5907\u4efd\u5f00\u59cb\u65f6\uff0c\u9700\u8981\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u6267\u884c\u4e00\u6b21\u68c0\u67e5\u70b9\u3002\u8fd9\u53ef\u80fd\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\uff08\u5c24\u5176\u662f\u5728\u672a\u4f7f\u7528<code class=\"literal\">--checkpoint=fast</code>\u9009\u9879\u65f6\uff09\uff1b\u5728\u6b64\u671f\u95f4\uff0c<span class=\"application\">pg_basebackup</span>\u770b\u8d77\u6765\u4f1a\u5904\u4e8e\u7a7a\u95f2\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u5907\u4efd\u5c06\u5305\u62ec\u6570\u636e\u76ee\u5f55\u548c\u8868\u7a7a\u95f4\u4e2d\u7684\u6240\u6709\u6587\u4ef6\uff0c\u5305\u62ec\u914d\u7f6e\u6587\u4ef6\u4ee5\u53ca\u7b2c\u4e09\u65b9\u653e\u5728\u8fd9\u4e9b\u76ee\u5f55\u4e2d\u7684\u4efb\u4f55\u989d\u5916\u6587\u4ef6\uff0c\u4f46\u7531 PostgreSQL \u7ba1\u7406\u7684\u67d0\u4e9b\u4e34\u65f6\u6587\u4ef6\u548c\u64cd\u4f5c\u7cfb\u7edf\u6587\u4ef6\u9664\u5916\u3002\u4e0d\u8fc7\uff0c\u53ea\u6709\u666e\u901a\u6587\u4ef6\u548c\u76ee\u5f55\u4f1a\u88ab\u590d\u5236\uff0c\u4f46\u7528\u4e8e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u4f1a\u88ab\u4fdd\u7559\u3002\u6307\u5411 PostgreSQL \u5df2\u77e5\u7684\u67d0\u4e9b\u76ee\u5f55\u7684\u7b26\u53f7\u94fe\u63a5\u4f1a\u88ab\u590d\u5236\u4e3a\u7a7a\u76ee\u5f55\u3002\u5176\u4ed6\u7b26\u53f7\u94fe\u63a5\u548c\u7279\u6b8a\u8bbe\u5907\u6587\u4ef6\u5219\u4f1a\u88ab\u8df3\u8fc7\u3002\u5177\u4f53\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/devel/protocol-replication.html\" title=\"54.4.\u00a0\u6d41\u590d\u5236\u534f\u8bae\">\u7b2c\u00a054.4\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5728\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u4e2d\uff0c\u9664\u975e\u4f7f\u7528\u4e86<code class=\"literal\">--tablespace-mapping</code>\u9009\u9879\uff0c\u5426\u5219\u8868\u7a7a\u95f4\u4f1a\u5907\u4efd\u5230\u5176\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u7684\u76f8\u540c\u8def\u5f84\u3002\u5982\u679c\u4e0d\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u90a3\u4e48\u5f53\u8868\u7a7a\u95f4\u6b63\u5728\u4f7f\u7528\u65f6\uff0c\u5c31\u65e0\u6cd5\u5728\u4e0e\u670d\u52a1\u5668\u76f8\u540c\u7684\u4e3b\u673a\u4e0a\u6267\u884c\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u7684\u57fa\u7840\u5907\u4efd\uff0c\u56e0\u4e3a\u5907\u4efd\u5c06\u4e0d\u5f97\u4e0d\u5199\u5165\u4e0e\u539f\u59cb\u8868\u7a7a\u95f4\u76f8\u540c\u7684\u76ee\u5f55\u4f4d\u7f6e\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u7528\u6237\u9700\u8981\u5728\u542f\u52a8\u4f7f\u7528\u8fd9\u4e9b\u6570\u636e\u7684 PostgreSQL \u670d\u52a1\u5668\u4e4b\u524d\uff0c\u81ea\u884c\u89e3\u5f00\u6bcf\u4e2a tar \u6587\u4ef6\u3002\u5982\u679c\u5b58\u5728\u989d\u5916\u7684\u8868\u7a7a\u95f4\uff0c\u5fc5\u987b\u5c06\u5bf9\u5e94\u7684 tar \u6587\u4ef6\u89e3\u538b\u5230\u6b63\u786e\u4f4d\u7f6e\u3002\u6b64\u65f6\uff0c\u670d\u52a1\u5668\u4f1a\u6839\u636e base.tar \u4e2d tablespace_map \u6587\u4ef6\u7684\u5185\u5bb9\uff0c\u4e3a\u8fd9\u4e9b\u8868\u7a7a\u95f4\u521b\u5efa\u7b26\u53f7\u94fe\u63a5\u3002</p>\n<p lang=\"zh\">pg_basebackup \u53ef\u4e0e\u76f8\u540c\u6216\u66f4\u65e9\u4e3b\u8981\u7248\u672c\u7684\u670d\u52a1\u5668\u914d\u5408\u4f7f\u7528\uff0c\u6700\u4f4e\u652f\u6301 9.1\u3002\u4e0d\u8fc7\uff0cWAL \u6d41\u5f0f\u4f20\u8f93\u6a21\u5f0f\uff08-X stream\uff09\u53ea\u9002\u7528\u4e8e 9.3 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\uff0ctar \u683c\u5f0f\uff08--format=tar\uff09\u53ea\u9002\u7528\u4e8e 9.5 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\uff0c\u589e\u91cf\u5907\u4efd\uff08--incremental\uff09\u53ea\u9002\u7528\u4e8e 17 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6e90\u96c6\u7c07\u542f\u7528\u4e86\u6570\u636e\u6587\u4ef6\u7684\u7ec4\u6743\u9650\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u4fdd\u7559\u8fd9\u4e9b\u7ec4\u6743\u9650\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.9\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u8981\u4e3a\u670d\u52a1\u5668<code class=\"literal\">mydbserver</code>\u521b\u5efa\u4e00\u4e2a\u57fa\u7840\u5907\u4efd\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5230\u672c\u5730\u76ee\u5f55<code class=\"filename\">/usr/local/pgsql/data</code>\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -h mydbserver -D /usr/local/pgsql/data</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u672c\u5730\u670d\u52a1\u5668\u521b\u5efa\u4e00\u4e2a\u5907\u4efd\uff0c\u4e3a\u6bcf\u4e2a\u8868\u7a7a\u95f4\u5404\u751f\u6210\u4e00\u4e2a\u538b\u7f29\u7684 tar \u6587\u4ef6\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5728\u76ee\u5f55<code class=\"filename\">backup</code>\u4e2d\uff0c\u540c\u65f6\u5728\u8fd0\u884c\u671f\u95f4\u663e\u793a\u8fdb\u5ea6\u62a5\u544a\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup -Ft -z -P</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u4e00\u4e2a\u4ec5\u5305\u542b\u5355\u4e2a\u8868\u7a7a\u95f4\u7684\u672c\u5730\u6570\u636e\u5e93\u521b\u5efa\u5907\u4efd\uff0c\u5e76\u4f7f\u7528<span class=\"productname\">bzip2</span>\u8fdb\u884c\u538b\u7f29\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D - -Ft -X fetch | bzip2 &gt; backup.tar.bz2</code></strong>\n</pre>\n<p lang=\"zh\">\uff08\u5982\u679c\u8be5\u6570\u636e\u5e93\u4e2d\u6709\u591a\u4e2a\u8868\u7a7a\u95f4\uff0c\u6b64\u547d\u4ee4\u5c06\u5931\u8d25\u3002\uff09</p>\n<p lang=\"zh\">\u8981\u521b\u5efa\u4e00\u4e2a\u672c\u5730\u6570\u636e\u5e93\u7684\u5907\u4efd\uff0c\u5e76\u5c06\u4f4d\u4e8e<code class=\"filename\">/opt/ts</code>\u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230<code class=\"filename\">./backup/ts</code>\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup/data -T /opt/ts=$(pwd)/backup/ts</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u672c\u5730\u670d\u52a1\u5668\u521b\u5efa\u4e00\u4e2a\u5907\u4efd\uff0c\u4e3a\u6bcf\u4e2a\u8868\u7a7a\u95f4\u751f\u6210\u4e00\u4e2a tar \u6587\u4ef6\uff0c\u5e76\u4f7f\u7528<span class=\"application\">gzip</span>\u4ee5 9 \u7ea7\u538b\u7f29\u540e\u5b58\u50a8\u5230\u76ee\u5f55<code class=\"filename\">backup</code>\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup -Ft --compress=gzip:9</code></strong>\n</pre>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.10\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/devel/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/devel/progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING\" title=\"27.4.7.\u00a0Base Backup Progress Reporting\">Section\u00a027.4.7</a></span>\n</div>\n</div></div>", "manual_path": "app-pgbasebackup.html", "localization": {"status": "complete", "sources": [{"url": "/docs/devel/app-pgbasebackup.html", "method": "same-major semantic node", "sha256": "d0949e73011fc5b82c3dbaedc22021ef5c9227fee3127eaec736acfabd42105f", "language": "zh", "matched_nodes": ["#APP-PGBASEBACKUP/div[2]/p[1]", "#APP-PGBASEBACKUP/div[3]/h2[0]", "#APP-PGBASEBACKUP/div[4]/div[8]/ul[0]/li[0]", "#APP-PGBASEBACKUP/div[4]/div[8]/ul[0]/li[1]", "#APP-PGBASEBACKUP/div[4]/div[8]/ul[0]/li[2]", "#APP-PGBASEBACKUP/div[4]/div[8]/ul[0]/li[3]", "#APP-PGBASEBACKUP/div[4]/p[1]", "#APP-PGBASEBACKUP/div[4]/p[2]", "#APP-PGBASEBACKUP/div[4]/p[3]", "#APP-PGBASEBACKUP/div[4]/p[4]", "#APP-PGBASEBACKUP/div[4]/p[5]", "#APP-PGBASEBACKUP/div[4]/p[6]", "#APP-PGBASEBACKUP/div[4]/p[7]", "#APP-PGBASEBACKUP/div[4]/p[9]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[3]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[5]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[5]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[17]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[19]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[19]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[19]/p[3]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[19]/p[4]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[3]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[7]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[7]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[17]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[17]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[17]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[19]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[21]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[21]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[21]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[21]/p[3]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[23]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[25]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[25]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[27]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[29]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[29]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[29]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[31]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[31]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[31]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[7]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[7]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[7]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[8]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[8]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/p[3]", "#APP-PGBASEBACKUP/div[5]/p[5]", "#APP-PGBASEBACKUP/div[5]/p[7]", "#APP-PGBASEBACKUP/div[6]/h2[0]", "#APP-PGBASEBACKUP/div[6]/p[1]", "#APP-PGBASEBACKUP/div[6]/p[2]", "#APP-PGBASEBACKUP/div[7]/h2[0]", "#APP-PGBASEBACKUP/div[7]/p[1]", "#APP-PGBASEBACKUP/div[7]/p[2]", "#APP-PGBASEBACKUP/div[7]/p[3]", "#APP-PGBASEBACKUP/div[7]/p[6]", "#APP-PGBASEBACKUP/div[8]/h2[0]", "#APP-PGBASEBACKUP/div[8]/p[10]", "#APP-PGBASEBACKUP/div[8]/p[1]", "#APP-PGBASEBACKUP/div[8]/p[3]", "#APP-PGBASEBACKUP/div[8]/p[5]", "#APP-PGBASEBACKUP/div[8]/p[7]", "#APP-PGBASEBACKUP/div[8]/p[8]", "#APP-PGBASEBACKUP/div[9]/h2[0]"]}], "language": "zh", "original_text": {"/summary": "pg_basebackup \u2014 take a base backup of a PostgreSQL cluster", "/category": "Client applications", "/versions/20/description/0": "pg_basebackup \u2014 take a base backup of a PostgreSQL cluster", "/versions/20/facts/0/label": "Documented executable", "/versions/20/facts/1/label": "Executable version", "/versions/20/facts/2/label": "Reference inventory", "/versions/20/facts/2/value": "Client applications", "/versions/20/facts/3/label": "Option definition groups", "/versions/20/tables/0/title": "Documented options", "/versions/20/related/0/label": "libpq connection parameters", "/versions/20/tables/0/rows/0/summary": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty.", "/versions/20/tables/0/rows/1/summary": "Selects the format for the output. format can be one of the following:", "/versions/20/tables/0/rows/2/summary": "Performs an incremental backup . The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup.", "/versions/20/tables/0/rows/3/summary": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup.", "/versions/20/tables/0/rows/4/summary": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup.", "/versions/20/tables/0/rows/5/summary": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces.", "/versions/20/tables/0/rows/6/summary": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format.", "/versions/20/tables/0/rows/7/summary": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup.", "/versions/20/tables/0/rows/8/summary": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "/versions/20/tables/0/rows/9/summary": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch .", "/versions/20/tables/0/columns/0/label": "Option and arguments", "/versions/20/tables/0/columns/1/label": "Description", "/versions/20/tables/0/rows/10/summary": "Sets checkpoint mode to fast or spread (see Section 25.3.4 ). The default is spread.", "/versions/20/tables/0/rows/11/summary": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists.", "/versions/20/tables/0/rows/12/summary": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used.", "/versions/20/tables/0/rows/13/summary": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging.", "/versions/20/tables/0/rows/14/summary": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.", "/versions/20/tables/0/rows/15/summary": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.", "/versions/20/tables/0/rows/16/summary": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second.", "/versions/20/tables/0/rows/17/summary": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby.", "/versions/20/tables/0/rows/18/summary": "When set to fsync , which is the default, pg_basebackup will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace.", "/versions/20/tables/0/rows/19/summary": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.", "/versions/20/tables/0/rows/20/summary": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C .", "/versions/20/tables/0/rows/21/summary": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case.", "/versions/20/tables/0/rows/22/summary": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL .", "/versions/20/tables/0/rows/23/summary": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file.", "/versions/20/tables/0/rows/24/summary": "Prevents the creation of a temporary replication slot for the backup.", "/versions/20/tables/0/rows/25/summary": "Disables verification of checksums, if they are enabled on the server the base backup is taken from.", "/versions/20/tables/0/rows/26/summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "/versions/20/tables/0/rows/27/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "/versions/20/tables/0/rows/28/summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "/versions/20/tables/0/rows/29/summary": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds.", "/versions/20/tables/0/rows/30/summary": "Specifies the user name to connect as.", "/versions/20/tables/0/rows/31/summary": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/20/tables/0/rows/32/summary": "Forces pg_basebackup to prompt for a password before connecting to the source server.", "/versions/20/tables/0/rows/33/summary": "Prints the pg_basebackup version and exits.", "/versions/20/tables/0/rows/34/summary": "Shows help about pg_basebackup command line arguments, and exits."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "04881f7de5b011805f85024a1d57e1cd9599242cff23043624131db175fd2899"}, "comparison_data": {"options": [{"names": ["-D directory", "--pgdata= directory"], "signature": "-D directory --pgdata= directory", "description": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty. When the backup is in tar format, the target directory may be specified as - (dash), causing the tar file to be written to stdout . This option is required."}, {"names": ["-F format", "--format= format"], "signature": "-F format --format= format", "description": "Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the source server's data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory's contents will be written to a file named base.tar , and each other tablespace will be written to a separate tar file named after that tablespace's OID. If the target directory is specified as - (dash), the tar contents will be written to standard output, suitable for piping to (for example) gzip . This is only allowed if the cluster has no additional tablespaces and WAL streaming is not used."}, {"names": ["-i old_manifest_file", "--incremental= old_manifest_file"], "signature": "-i old_manifest_file --incremental= old_manifest_file", "description": "Performs an incremental backup . The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup."}, {"names": ["-R", "--write-recovery-conf"], "signature": "-R --write-recovery-conf", "description": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup. The postgresql.auto.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that streaming replication and logical replication slot synchronization will use the same settings later on. The dbname will be recorded only if the dbname was specified explicitly in the connection string or environment variable ."}, {"names": ["-t target", "--target= target"], "signature": "-t target --target= target", "description": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup. Since WAL streaming is implemented by pg_basebackup rather than by the server, this option cannot be used together with -Xstream . Since that is the default, when this option is specified, you must also specify either -Xfetch or -Xnone ."}, {"names": ["-T olddir = newdir", "--tablespace-mapping= olddir = newdir"], "signature": "-T olddir = newdir --tablespace-mapping= olddir = newdir", "description": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected."}, {"names": ["--waldir= waldir"], "signature": "--waldir= waldir", "description": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format."}, {"names": ["-X method", "--wal-method= method"], "signature": "-X method --wal-method= method", "description": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup. The following method s for collecting the write-ahead logs are supported: n none Don't include write-ahead logs in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the source server's wal_keep_size parameter to be set high enough that the required log data is not removed before the end of the backup. If the required log data has been recycled before it's time to transfer it, the backup will fail and be unusable. When tar format is used, the write-ahead log files will be included in the base.tar file. s stream Stream write-ahead log data while the backup is being taken. This method will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will require two replication connections not just one. As long as the client can keep up with the write-ahead log data, using this method requires no extra write-ahead logs to be saved on the source server. When tar format is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default."}, {"names": ["-z", "--gzip"], "signature": "-z --gzip", "description": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-Z level", "-Z [{client|server}-] method [: detail ]", "--compress= level", "--compress=[{client|server}-] method [: detail ]"], "signature": "-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]", "description": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch . The compression method can be set to gzip , lz4 , zstd , none for no compression or an integer (no compression if 0, gzip if greater than 0). A compression detail string can optionally be specified. If the detail string is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form keyword or keyword=value . Currently, the supported keywords are level , long , and workers . The detail string cannot be used when the compression method is specified as a plain integer. If no compression level is specified, the default compression level will be used. If only a level is specified without mentioning an algorithm, gzip compression will be used if the level is greater than 0, and no compression will be used if the level is 0. When the tar format is used with gzip , lz4 , or zstd , the suffix .gz , .lz4 , or .zst , respectively, will be automatically added to all tar filenames. When the plain format is used, client-side compression may not be specified, but it is still possible to request server-side compression. If this is done, the server will compress the backup for transmission, and the client will decompress and extract it. When this option is used in combination with -Xstream , pg_wal.tar will be compressed using gzip if client-side gzip compression is selected, but will not be compressed if any other compression algorithm is selected, or if server-side compression is selected."}, {"names": ["-c {fast|spread}", "--checkpoint={fast|spread}"], "signature": "-c {fast|spread} --checkpoint={fast|spread}", "description": "Sets checkpoint mode to fast or spread (see Section 25.3.4 ). The default is spread."}, {"names": ["-C", "--create-slot"], "signature": "-C --create-slot", "description": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists."}, {"names": ["-l label", "--label= label"], "signature": "-l label --label= label", "description": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used."}, {"names": ["-n", "--no-clean"], "signature": "-n --no-clean", "description": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way."}, {"names": ["-N", "--no-sync"], "signature": "-N --no-sync", "description": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."}, {"names": ["-P", "--progress"], "signature": "-P --progress", "description": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL."}, {"names": ["-r rate", "--max-rate= rate"], "signature": "-r rate --max-rate= rate", "description": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch ."}, {"names": ["-S slotname", "--slot= slotname"], "signature": "-S slotname --slot= slotname", "description": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby. The specified replication slot has to exist unless the option -C is also used. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming."}, {"names": ["--sync-method= method"], "signature": "--sync-method= method", "description": "When set to fsync , which is the default, pg_basebackup will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace. On Linux, syncfs may be used instead to ask the operating system to synchronize the whole file system that contains the backup directory. When the plain format is used, pg_basebackup will also synchronize the file systems that contain the WAL files and each tablespace. See recovery_init_sync_method for information about the caveats to be aware of when using syncfs . This option has no effect when --no-sync is used."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."}, {"names": ["--manifest-checksums= algorithm"], "signature": "--manifest-checksums= algorithm", "description": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C . If NONE is selected, the backup manifest will not contain any checksums. Otherwise, it will contain a checksum of each file in the backup using the specified algorithm. In addition, the manifest will always contain a SHA256 checksum of its own contents. The SHA algorithms are significantly more CPU-intensive than CRC32C , so selecting one of them may increase the time required to complete the backup. Using a SHA hash function provides a cryptographically secure digest of each file for users who wish to verify that the backup has not been tampered with, while the CRC-32C algorithm provides a checksum that is much faster to calculate; it is good at catching errors due to accidental changes but is not resistant to malicious modifications. Note that, to be useful against an adversary who has access to the backup, the backup manifest would need to be stored securely elsewhere or otherwise verified not to have been modified since the backup was taken. pg_verifybackup can be used to check the integrity of a backup against the backup manifest."}, {"names": ["--manifest-force-encode"], "signature": "--manifest-force-encode", "description": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case."}, {"names": ["--no-estimate-size"], "signature": "--no-estimate-size", "description": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL . Without this option, the backup will start by enumerating the size of the entire database, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent. This option is useful to avoid such estimation time if it's too long. This option is not allowed when using --progress ."}, {"names": ["--no-manifest"], "signature": "--no-manifest", "description": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file."}, {"names": ["--no-slot"], "signature": "--no-slot", "description": "Prevents the creation of a temporary replication slot for the backup. By default, if log streaming is selected but no slot name is given with the -S option, then a temporary replication slot is created (if supported by the source server). The main purpose of this option is to allow taking a base backup when the server has no free replication slots. Using a replication slot is almost always preferred, because it prevents needed WAL from being removed by the server during the backup."}, {"names": ["--no-verify-checksums"], "signature": "--no-verify-checksums", "description": "Disables verification of checksums, if they are enabled on the server the base backup is taken from. By default, checksums are verified and checksum failures will result in a non-zero exit status. However, the base backup will not be removed in such a case, as if the --no-clean option had been used. Checksum verification failures will also be reported in the pg_stat_database view. Checksums must be enabled on the server for the duration of the base backup in order to be verified. If checksums are in the process of being enabled when the base backup starts then checksum verification is disabled for the base backup."}, {"names": ["-d connstr", "--dbname= connstr"], "signature": "-d connstr --dbname= connstr", "description": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. This option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, any database name included in the connection string will be ignored by the server. However, a database name supplied that way overrides the default database name ( replication ) for purposes of looking up the replication connection's password in ~/.pgpass . Similarly, middleware or proxies used in connecting to PostgreSQL might utilize the name for purposes such as connection routing. The database name can also be used by logical replication slot synchronization ."}, {"names": ["-h host", "--host= host"], "signature": "-h host --host= host", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-s interval", "--status-interval= interval"], "signature": "-s interval --status-interval= interval", "description": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Specifies the user name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Forces pg_basebackup to prompt for a password before connecting to the source server. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Prints the pg_basebackup version and exits."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Shows help about pg_basebackup command line arguments, and exits."}], "synopsis": ["pg_basebackup [ option ...]"], "environment": []}, "comparison_hash": "5fca952ed471e4df86add9ceb6b9e1a78175dd501662ede0aebe83562b504eb4", "manual_language": "zh"}}}, "snapshot": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_basebackup"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "18.6"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "35"}], "tables": [{"key": "options", "rows": [{"summary": "\u8bbe\u7f6e\u5199\u5165\u8f93\u51fa\u7684\u76ee\u6807\u76ee\u5f55\u3002\u5982\u679c\u8be5\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c pg_basebackup \u4f1a\u521b\u5efa\u5b83\uff08\u4ee5\u53ca\u6240\u6709\u7f3a\u5931\u7684\u7236\u76ee\u5f55\uff09\u3002\u5982\u679c\u8be5\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-D directory --pgdata= directory"}}, {"summary": "\u9009\u62e9\u8f93\u51fa\u683c\u5f0f\u3002 format \u53ef\u4ee5\u662f\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-F format --format= format"}}, {"summary": "\u6267\u884c \u589e\u91cf\u5907\u4efd \u3002\u5fc5\u987b\u63d0\u4f9b\u53c2\u8003\u5907\u4efd\u7684\u5907\u4efd\u6e05\u5355\uff1b\u8be5\u6587\u4ef6\u5c06\u88ab\u4e0a\u4f20\u5230\u670d\u52a1\u5668\uff0c\u968f\u540e\u670d\u52a1\u5668\u4f1a\u8fd4\u56de\u6240\u8bf7\u6c42\u7684\u589e\u91cf\u5907\u4efd\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-i old_manifest_file --incremental= old_manifest_file"}}, {"summary": "\u521b\u5efa standby.signal \u6587\u4ef6\uff0c\u5e76\u5c06\u8fde\u63a5\u8bbe\u7f6e\u8ffd\u52a0\u5230\u76ee\u6807\u76ee\u5f55\u4e2d\u7684 postgresql.auto.conf \u6587\u4ef6\u4e2d\uff08\u5982\u679c\u4f7f\u7528 tar \u683c\u5f0f\uff0c\u5219\u8ffd\u52a0\u5230\u57fa\u7840\u5f52\u6863\u6587\u4ef6\u5185\uff09\u3002\u8fd9\u6837\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u5229\u7528\u5907\u4efd\u7ed3\u679c\u642d\u5efa\u5907\u5e93\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-R --write-recovery-conf"}}, {"summary": "\u6307\u793a\u670d\u52a1\u5668\u5c06\u57fa\u7840\u5907\u4efd\u653e\u5230\u54ea\u91cc\u3002\u9ed8\u8ba4\u76ee\u6807\u662f client \uff0c\u8868\u793a\u5907\u4efd\u5e94\u53d1\u9001\u5230\u8fd0\u884c pg_basebackup \u7684\u90a3\u53f0\u673a\u5668\u3002\u5982\u679c\u76ee\u6807\u6539\u4e3a server:/some/path \uff0c\u5219\u5907\u4efd\u4f1a\u5b58\u50a8\u5728\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684 /some/path \u76ee\u5f55\u4e2d\u3002\u5c06\u5907\u4efd\u5b58\u50a8\u5728\u670d\u52a1\u5668\u4e0a\u9700\u8981\u8d85\u7ea7\u7528\u6237\u6743\u9650\uff0c\u6216\u62e5\u6709 pg_write_server_files \u89d2\u8272\u7684\u6743\u9650\u3002\u5982\u679c\u76ee\u6807\u8bbe\u7f6e\u4e3a blackhole \uff0c\u5219\u5185\u5bb9\u4f1a\u88ab\u4e22\u5f03\uff0c\u4e0d\u4f1a\u5b58\u50a8\u5230\u4efb\u4f55\u5730\u65b9\u3002\u8fd9\u53ea\u5e94\u7528\u4e8e\u6d4b\u8bd5\u76ee\u7684\uff0c\u56e0\u4e3a\u6700\u7ec8\u4e0d\u4f1a\u5f97\u5230\u5b9e\u9645\u5907\u4efd\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-t target --target= target"}}, {"summary": "\u5728\u5907\u4efd\u671f\u95f4\uff0c\u5c06\u76ee\u5f55 olddir \u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230 newdir \u3002\u8981\u4f7f\u6b64\u9009\u9879\u751f\u6548\uff0c olddir \u5fc5\u987b\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u5b9a\u4e49\u7684\u8be5\u8868\u7a7a\u95f4\u8def\u5f84\u5b8c\u5168\u4e00\u81f4\u3002\uff08\u4f46\u5982\u679c\u6e90\u670d\u52a1\u5668\u4e0a\u5728 olddir \u4e2d\u6ca1\u6709\u8868\u7a7a\u95f4\uff0c\u4e5f\u4e0d\u7b97\u9519\u8bef\u3002\uff09\u4e0e\u6b64\u540c\u65f6\uff0c newdir \u662f\u63a5\u6536\u4e3b\u673a\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u4e00\u4e2a\u76ee\u5f55\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c newdir \u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002 olddir \u548c newdir \u90fd\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u5982\u679c\u4efb\u4e00\u8def\u5f84\u4e2d\u9700\u8981\u5305\u542b\u7b49\u53f7\uff08 = \uff09\uff0c\u8bf7\u5728\u5176\u524d\u9762\u52a0\u4e0a\u53cd\u659c\u6760\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u4ee5\u5904\u7406\u591a\u4e2a\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-T olddir = newdir --tablespace-mapping= olddir = newdir"}}, {"summary": "\u8bbe\u7f6e\u5199\u5165 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cWAL \u6587\u4ef6\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u7684 pg_wal \u5b50\u76ee\u5f55\u4e2d\uff0c\u4f46\u6b64\u9009\u9879\u53ef\u7528\u4e8e\u5c06\u5176\u653e\u5728\u5176\u4ed6\u4f4d\u7f6e\u3002 waldir \u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c waldir \u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002\u53ea\u6709\u5f53\u5907\u4efd\u91c7\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u624d\u80fd\u6307\u5b9a\u6b64\u9009\u9879\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "--waldir= waldir"}}, {"summary": "\u5728\u5907\u4efd\u4e2d\u5305\u542b\u6240\u9700\u7684 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u3002\u8fd9\u5c06\u5305\u62ec\u5907\u4efd\u671f\u95f4\u751f\u6210\u7684\u6240\u6709\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u9664\u975e\u6307\u5b9a\u65b9\u6cd5 none \uff0c\u5426\u5219\u5c31\u53ef\u4ee5\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u542f\u52a8 postmaster\uff0c\u800c\u65e0\u9700\u67e5\u9605 WAL \u5f52\u6863\uff0c\u4ece\u800c\u4f7f\u8f93\u51fa\u6210\u4e3a\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u5907\u4efd\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-X method --wal-method= method"}}, {"summary": "\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u4f7f\u7528\u9ed8\u8ba4\u538b\u7f29\u7ea7\u522b\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0 .gz \u540e\u7f00\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-z --gzip"}}, {"summary": "\u8bf7\u6c42\u5bf9\u5907\u4efd\u8fdb\u884c\u538b\u7f29\u3002\u5982\u679c\u5305\u542b client \u6216 server \uff0c\u5219\u6307\u5b9a\u538b\u7f29\u6267\u884c\u7684\u4f4d\u7f6e\u3002\u5728\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4f1a\u51cf\u5c11\u4f20\u8f93\u5e26\u5bbd\u5360\u7528\uff0c\u4f46\u4f1a\u589e\u52a0\u670d\u52a1\u5668 CPU \u6d88\u8017\u3002\u9ed8\u8ba4\u503c\u662f client \uff0c\u4f46\u4f7f\u7528 --target \u65f6\u9664\u5916\uff1b\u6b64\u65f6\u5907\u4efd\u4e0d\u4f1a\u53d1\u9001\u5230\u5ba2\u6237\u7aef\uff0c\u56e0\u6b64\u53ea\u6709\u670d\u52a1\u5668\u7aef\u538b\u7f29\u624d\u6709\u610f\u4e49\u3002\u4f7f\u7528\u9ed8\u8ba4\u7684 -Xstream \u65f6\uff0c\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4e0d\u4f1a\u5e94\u7528\u4e8e WAL\u3002\u82e5\u8981\u538b\u7f29 WAL\uff0c\u8bf7\u4f7f\u7528\u5ba2\u6237\u7aef\u538b\u7f29\uff0c\u6216\u8005\u6307\u5b9a -Xfetch \u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]"}}, {"summary": "\u5c06\u68c0\u67e5\u70b9\u6a21\u5f0f\u8bbe\u7f6e\u4e3a fast\uff08\u7acb\u5373\uff09\u6216 spread\uff08\u9ed8\u8ba4\uff09\uff08\u89c1 \u7b2c 25.3.4 \u8282 \uff09\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-c {fast|spread} --checkpoint={fast|spread}"}}, {"summary": "\u6307\u5b9a\u5728\u5f00\u59cb\u5907\u4efd\u4e4b\u524d\uff0c\u5e94\u521b\u5efa\u7531 --slot \u9009\u9879\u6307\u5b9a\u540d\u79f0\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u8be5\u69fd\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u9519\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-C --create-slot"}}, {"summary": "\u8bbe\u7f6e\u5907\u4efd\u6807\u7b7e\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u503c \u201c pg_basebackup base backup \u201d \u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-l label --label= label"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53 pg_basebackup \u56e0\u9519\u8bef\u4e2d\u6b62\u65f6\uff0c\u5b83\u4f1a\u5220\u9664\u5728\u53d1\u73b0\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u76ee\u5f55\uff08\u4f8b\u5982\u76ee\u6807\u76ee\u5f55\u548c\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\uff09\u3002\u6b64\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u5f88\u6709\u5e2e\u52a9\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-n --no-clean"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_basebackup \u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u88ab\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f1a\u4f7f pg_basebackup \u4e0d\u7ecf\u7b49\u5f85\u5c31\u76f4\u63a5\u8fd4\u56de\uff0c\u56e0\u6b64\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u968f\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u57fa\u7840\u5907\u4efd\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u5408\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-N --no-sync"}}, {"summary": "\u542f\u7528\u8fdb\u5ea6\u62a5\u544a\u3002\u6253\u5f00\u6b64\u9009\u9879\u540e\uff0c\u4f1a\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u7ed9\u51fa\u4e00\u4e2a\u8fd1\u4f3c\u7684\u8fdb\u5ea6\u62a5\u544a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u53d1\u751f\u53d8\u5316\uff0c\u56e0\u6b64\u8fd9\u53ea\u662f\u8fd1\u4f3c\u503c\uff0c\u6700\u7ec8\u672a\u5fc5\u6070\u597d\u7ed3\u675f\u5728 100% \u3002\u7279\u522b\u662f\u5f53\u5907\u4efd\u4e2d\u5305\u542b WAL \u65f6\uff0c\u603b\u6570\u636e\u91cf\u65e0\u6cd5\u9884\u5148\u4f30\u8ba1\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u65e6\u8fdb\u5ea6\u8d85\u8fc7\u4e0d\u542b WAL \u65f6\u7684\u603b\u4f30\u8ba1\u503c\uff0c\u4f30\u8ba1\u76ee\u6807\u5927\u5c0f\u5c31\u4f1a\u7ee7\u7eed\u589e\u52a0\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-P --progress"}}, {"summary": "\u8bbe\u7f6e\u4ece\u6e90\u670d\u52a1\u5668\u6536\u96c6\u6570\u636e\u65f6\u5141\u8bb8\u7684\u6700\u5927\u4f20\u8f93\u901f\u7387\u3002\u8fd9\u6709\u52a9\u4e8e\u9650\u5236 pg_basebackup \u5bf9\u670d\u52a1\u5668\u7684\u5f71\u54cd\u3002\u53d6\u503c\u5355\u4f4d\u4e3a\u6bcf\u79d2\u5343\u5b57\u8282\u3002\u4f7f\u7528\u540e\u7f00 M \u8868\u793a\u6bcf\u79d2\u5146\u5b57\u8282\u3002\u4e5f\u63a5\u53d7\u540e\u7f00 k \uff0c\u4f46\u6ca1\u6709\u5b9e\u9645\u5f71\u54cd\u3002\u6709\u6548\u53d6\u503c\u8303\u56f4\u4e3a\u6bcf\u79d2 32 \u5343\u5b57\u8282\u5230\u6bcf\u79d2 1024 \u5146\u5b57\u8282\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-r rate --max-rate= rate"}}, {"summary": "\u6b64\u9009\u9879\u53ea\u80fd\u4e0e -X stream \u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u4f1a\u4f7f WAL \u6d41\u5f0f\u4f20\u8f93\u4f7f\u7528\u6307\u5b9a\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u6b64\u57fa\u7840\u5907\u4efd\u6253\u7b97\u7528\u4f5c\u4f7f\u7528\u590d\u5236\u69fd\u7684\u6d41\u590d\u5236\u5907\u5e93\uff0c\u90a3\u4e48\u8be5\u5907\u5e93\u5e94\u5c06\u540c\u4e00\u4e2a\u590d\u5236\u69fd\u540d\u79f0\u7528\u4f5c primary_slot_name \u7684\u503c\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u4e3b\u5e93\u5728\u57fa\u7840\u5907\u4efd\u7ed3\u675f\u4e0e\u65b0\u5907\u5e93\u5f00\u59cb\u6d41\u590d\u5236\u4e4b\u95f4\u7684\u8fd9\u6bb5\u65f6\u95f4\u5185\uff0c\u4e0d\u4f1a\u79fb\u9664\u4efb\u4f55\u5fc5\u9700\u7684 WAL \u6570\u636e\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-S slotname --slot= slotname"}}, {"summary": "\u8bbe\u7f6e\u4e3a fsync \uff08\u9ed8\u8ba4\uff09\u65f6\uff0c pg_basebackup \u4f1a\u9012\u5f52\u6253\u5f00\u5e76\u540c\u6b65\u5907\u4efd\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3002\u4f7f\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u67e5\u627e\u6587\u4ef6\u4f1a\u8ddf\u968f WAL \u76ee\u5f55\u548c\u5404\u5df2\u914d\u7f6e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "--sync-method= method"}}, {"summary": "\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\u3002\u5b83\u4f1a\u5728\u542f\u52a8\u548c\u5173\u95ed\u8fc7\u7a0b\u4e2d\u8f93\u51fa\u4e00\u4e9b\u989d\u5916\u6b65\u9aa4\uff1b\u5982\u679c\u540c\u65f6\u542f\u7528\u4e86\u8fdb\u5ea6\u62a5\u544a\uff0c\u8fd8\u4f1a\u663e\u793a\u5f53\u524d\u6b63\u5728\u5904\u7406\u7684\u786e\u5207\u6587\u4ef6\u540d\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-v --verbose"}}, {"summary": "\u6307\u5b9a\u5e94\u7528\u5230\u5907\u4efd\u6e05\u5355\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u7684\u6821\u9a8c\u548c\u7b97\u6cd5\u3002\u76ee\u524d\u53ef\u7528\u7684\u7b97\u6cd5\u6709 NONE \u3001 CRC32C \u3001 SHA224 \u3001 SHA256 \u3001 SHA384 \u548c SHA512 \u3002\u9ed8\u8ba4\u503c\u4e3a CRC32C \u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "--manifest-checksums= algorithm"}}, {"summary": "\u5f3a\u5236\u5c06\u5907\u4efd\u6e05\u5355\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u540d\u7f16\u7801\u4e3a\u5341\u516d\u8fdb\u5236\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u5bf9\u975e UTF8 \u6587\u4ef6\u540d\u8fdb\u884c\u5341\u516d\u8fdb\u5236\u7f16\u7801\u3002\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u8bfb\u53d6\u5907\u4efd\u6e05\u5355\u6587\u4ef6\u7684\u5de5\u5177\u662f\u5426\u80fd\u6b63\u786e\u5904\u7406\u8fd9\u79cd\u60c5\u51b5\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "--manifest-force-encode"}}, {"summary": "\u7981\u6b62\u670d\u52a1\u5668\u4f30\u7b97\u5c06\u8981\u6d41\u5f0f\u4f20\u8f93\u7684\u5907\u4efd\u6570\u636e\u603b\u91cf\uff0c\u56e0\u6b64 pg_stat_progress_basebackup \u89c6\u56fe\u4e2d\u7684 backup_total \u5217\u59cb\u7ec8\u4e3a NULL\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "--no-estimate-size"}}, {"summary": "\u7981\u6b62\u751f\u6210\u5907\u4efd\u6e05\u5355\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u670d\u52a1\u5668\u5c06\u751f\u6210\u5e76\u53d1\u9001\u4e00\u4e2a\u5907\u4efd\u6e05\u5355\uff0c\u53ef\u4f7f\u7528 pg_verifybackup \u8fdb\u884c\u9a8c\u8bc1\u3002\u8be5\u6e05\u5355\u5217\u51fa\u4e86\u5907\u4efd\u4e2d\u7684\u6bcf\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u4e0d\u5305\u62ec\u53ef\u80fd\u5305\u542b\u5728\u5176\u4e2d\u7684\u4efb\u4f55 WAL \u6587\u4ef6\u3002\u5b83\u8fd8\u4f1a\u4fdd\u5b58\u6bcf\u4e2a\u6587\u4ef6\u7684\u5927\u5c0f\u3001\u6700\u540e\u4fee\u6539\u65f6\u95f4\u4ee5\u53ca\u53ef\u9009\u7684\u6821\u9a8c\u548c\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "--no-manifest"}}, {"summary": "\u9632\u6b62\u4e3a\u5907\u4efd\u521b\u5efa\u4e34\u65f6\u590d\u5236\u69fd\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "--no-slot"}}, {"summary": "\u5982\u679c\u83b7\u53d6\u57fa\u7840\u5907\u4efd\u7684\u670d\u52a1\u5668\u542f\u7528\u4e86\u6821\u9a8c\u548c\uff0c\u5219\u7981\u7528\u5bf9\u8fd9\u4e9b\u6821\u9a8c\u548c\u7684\u9a8c\u8bc1\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "--no-verify-checksums"}}, {"summary": "\u4ee5 \u8fde\u63a5\u5b57\u7b26\u4e32 \u7684\u5f62\u5f0f\u6307\u5b9a\u7528\u4e8e\u8fde\u63a5\u670d\u52a1\u5668\u7684\u53c2\u6570\uff1b\u8fd9\u4e9b\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u76f8\u4e92\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-d connstr --dbname= connstr"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGHOST \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff1b\u5426\u5219\u4f1a\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-h host --host= host"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u6240\u4f7f\u7528\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u4e2d\u7684\u503c\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u786e\u5b9a\u7684\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-p port --port= port"}}, {"summary": "\u6307\u5b9a\u53d1\u9001\u56de\u6e90\u670d\u52a1\u5668\u7684\u72b6\u6001\u5305\u4e4b\u95f4\u76f8\u9694\u7684\u79d2\u6570\u3002\u8f83\u5c0f\u7684\u503c\u53ef\u4ee5\u8ba9\u670d\u52a1\u5668\u7aef\u5bf9\u5907\u4efd\u8fdb\u5ea6\u7684\u76d1\u63a7\u66f4\u7cbe\u786e\u3002\u503c\u4e3a\u96f6\u65f6\u4f1a\u5b8c\u5168\u7981\u7528\u5468\u671f\u6027\u72b6\u6001\u66f4\u65b0\uff0c\u4e0d\u8fc7\u5f53\u670d\u52a1\u5668\u8bf7\u6c42\u65f6\u4ecd\u4f1a\u53d1\u9001\u66f4\u65b0\uff0c\u4ee5\u907f\u514d\u56e0\u8d85\u65f6\u800c\u65ad\u5f00\u8fde\u63a5\u3002\u9ed8\u8ba4\u503c\u662f 10 \u79d2\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-s interval --status-interval= interval"}}, {"summary": "\u6307\u5b9a\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-U username --username= username"}}, {"summary": "\u7981\u6b62\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\uff08\u4f8b\u5982 .pgpass \u6587\u4ef6\uff09\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u6b64\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u79cd\u573a\u666f\u4e0b\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 pg_basebackup \u5728\u8fde\u63a5\u6e90\u670d\u52a1\u5668\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-W --password"}}, {"summary": "\u8f93\u51fa pg_basebackup \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-V --version"}}, {"summary": "\u663e\u793a pg_basebackup \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/18/app-pgbasebackup.html", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}], "options": [{"names": ["-D directory", "--pgdata= directory"], "summary": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty.", "signature": "-D directory --pgdata= directory", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty. When the backup is in tar format, the target directory may be specified as - (dash), causing the tar file to be written to stdout . This option is required."}, {"names": ["-F format", "--format= format"], "summary": "Selects the format for the output. format can be one of the following:", "signature": "-F format --format= format", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the source server's data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory's contents will be written to a file named base.tar , and each other tablespace will be written to a separate tar file named after that tablespace's OID. If the target directory is specified as - (dash), the tar contents will be written to standard output, suitable for piping to (for example) gzip . This is only allowed if the cluster has no additional tablespaces and WAL streaming is not used."}, {"names": ["-i old_manifest_file", "--incremental= old_manifest_file"], "summary": "Performs an incremental backup . The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup.", "signature": "-i old_manifest_file --incremental= old_manifest_file", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Performs an incremental backup . The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup."}, {"names": ["-R", "--write-recovery-conf"], "summary": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup.", "signature": "-R --write-recovery-conf", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup. The postgresql.auto.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that streaming replication and logical replication slot synchronization will use the same settings later on. The dbname will be recorded only if the dbname was specified explicitly in the connection string or environment variable ."}, {"names": ["-t target", "--target= target"], "summary": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup.", "signature": "-t target --target= target", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup. Since WAL streaming is implemented by pg_basebackup rather than by the server, this option cannot be used together with -Xstream . Since that is the default, when this option is specified, you must also specify either -Xfetch or -Xnone ."}, {"names": ["-T olddir = newdir", "--tablespace-mapping= olddir = newdir"], "summary": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces.", "signature": "-T olddir = newdir --tablespace-mapping= olddir = newdir", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected."}, {"names": ["--waldir= waldir"], "summary": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format.", "signature": "--waldir= waldir", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format."}, {"names": ["-X method", "--wal-method= method"], "summary": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup.", "signature": "-X method --wal-method= method", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup. The following method s for collecting the write-ahead logs are supported: n none Don't include write-ahead logs in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the source server's wal_keep_size parameter to be set high enough that the required log data is not removed before the end of the backup. If the required log data has been recycled before it's time to transfer it, the backup will fail and be unusable. When tar format is used, the write-ahead log files will be included in the base.tar file. s stream Stream write-ahead log data while the backup is being taken. This method will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will require two replication connections not just one. As long as the client can keep up with the write-ahead log data, using this method requires no extra write-ahead logs to be saved on the source server. When tar format is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default."}, {"names": ["-z", "--gzip"], "summary": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "signature": "-z --gzip", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-Z level", "-Z [{client|server}-] method [: detail ]", "--compress= level", "--compress=[{client|server}-] method [: detail ]"], "summary": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch .", "signature": "-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch . The compression method can be set to gzip , lz4 , zstd , none for no compression or an integer (no compression if 0, gzip if greater than 0). A compression detail string can optionally be specified. If the detail string is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form keyword or keyword=value . Currently, the supported keywords are level , long , and workers . The detail string cannot be used when the compression method is specified as a plain integer. If no compression level is specified, the default compression level will be used. If only a level is specified without mentioning an algorithm, gzip compression will be used if the level is greater than 0, and no compression will be used if the level is 0. When the tar format is used with gzip , lz4 , or zstd , the suffix .gz , .lz4 , or .zst , respectively, will be automatically added to all tar filenames. When the plain format is used, client-side compression may not be specified, but it is still possible to request server-side compression. If this is done, the server will compress the backup for transmission, and the client will decompress and extract it. When this option is used in combination with -Xstream , pg_wal.tar will be compressed using gzip if client-side gzip compression is selected, but will not be compressed if any other compression algorithm is selected, or if server-side compression is selected."}, {"names": ["-c {fast|spread}", "--checkpoint={fast|spread}"], "summary": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 25.3.4 ).", "signature": "-c {fast|spread} --checkpoint={fast|spread}", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 25.3.4 )."}, {"names": ["-C", "--create-slot"], "summary": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists.", "signature": "-C --create-slot", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists."}, {"names": ["-l label", "--label= label"], "summary": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used.", "signature": "-l label --label= label", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used."}, {"names": ["-n", "--no-clean"], "summary": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging.", "signature": "-n --no-clean", "source_url": "/docs/18/app-pgbasebackup.html", "description": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way."}, {"names": ["-N", "--no-sync"], "summary": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.", "signature": "-N --no-sync", "source_url": "/docs/18/app-pgbasebackup.html", "description": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."}, {"names": ["-P", "--progress"], "summary": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.", "signature": "-P --progress", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL."}, {"names": ["-r rate", "--max-rate= rate"], "summary": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second.", "signature": "-r rate --max-rate= rate", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch ."}, {"names": ["-S slotname", "--slot= slotname"], "summary": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby.", "signature": "-S slotname --slot= slotname", "source_url": "/docs/18/app-pgbasebackup.html", "description": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby. The specified replication slot has to exist unless the option -C is also used. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming."}, {"names": ["--sync-method= method"], "summary": "When set to fsync , which is the default, pg_basebackup will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace.", "signature": "--sync-method= method", "source_url": "/docs/18/app-pgbasebackup.html", "description": "When set to fsync , which is the default, pg_basebackup will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace. On Linux, syncfs may be used instead to ask the operating system to synchronize the whole file system that contains the backup directory. When the plain format is used, pg_basebackup will also synchronize the file systems that contain the WAL files and each tablespace. See recovery_init_sync_method for information about the caveats to be aware of when using syncfs . This option has no effect when --no-sync is used."}, {"names": ["-v", "--verbose"], "summary": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.", "signature": "-v --verbose", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."}, {"names": ["--manifest-checksums= algorithm"], "summary": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C .", "signature": "--manifest-checksums= algorithm", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C . If NONE is selected, the backup manifest will not contain any checksums. Otherwise, it will contain a checksum of each file in the backup using the specified algorithm. In addition, the manifest will always contain a SHA256 checksum of its own contents. The SHA algorithms are significantly more CPU-intensive than CRC32C , so selecting one of them may increase the time required to complete the backup. Using a SHA hash function provides a cryptographically secure digest of each file for users who wish to verify that the backup has not been tampered with, while the CRC-32C algorithm provides a checksum that is much faster to calculate; it is good at catching errors due to accidental changes but is not resistant to malicious modifications. Note that, to be useful against an adversary who has access to the backup, the backup manifest would need to be stored securely elsewhere or otherwise verified not to have been modified since the backup was taken. pg_verifybackup can be used to check the integrity of a backup against the backup manifest."}, {"names": ["--manifest-force-encode"], "summary": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case.", "signature": "--manifest-force-encode", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case."}, {"names": ["--no-estimate-size"], "summary": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL .", "signature": "--no-estimate-size", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL . Without this option, the backup will start by enumerating the size of the entire database, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent. This option is useful to avoid such estimation time if it's too long. This option is not allowed when using --progress ."}, {"names": ["--no-manifest"], "summary": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file.", "signature": "--no-manifest", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file."}, {"names": ["--no-slot"], "summary": "Prevents the creation of a temporary replication slot for the backup.", "signature": "--no-slot", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Prevents the creation of a temporary replication slot for the backup. By default, if log streaming is selected but no slot name is given with the -S option, then a temporary replication slot is created (if supported by the source server). The main purpose of this option is to allow taking a base backup when the server has no free replication slots. Using a replication slot is almost always preferred, because it prevents needed WAL from being removed by the server during the backup."}, {"names": ["--no-verify-checksums"], "summary": "Disables verification of checksums, if they are enabled on the server the base backup is taken from.", "signature": "--no-verify-checksums", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Disables verification of checksums, if they are enabled on the server the base backup is taken from. By default, checksums are verified and checksum failures will result in a non-zero exit status. However, the base backup will not be removed in such a case, as if the --no-clean option had been used. Checksum verification failures will also be reported in the pg_stat_database view."}, {"names": ["-d connstr", "--dbname= connstr"], "summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": "-d connstr --dbname= connstr", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. This option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, any database name included in the connection string will be ignored by the server. However, a database name supplied that way overrides the default database name ( replication ) for purposes of looking up the replication connection's password in ~/.pgpass . Similarly, middleware or proxies used in connecting to PostgreSQL might utilize the name for purposes such as connection routing. The database name can also be used by logical replication slot synchronization ."}, {"names": ["-h host", "--host= host"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "signature": "-h host --host= host", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "signature": "-p port --port= port", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-s interval", "--status-interval= interval"], "summary": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds.", "signature": "-s interval --status-interval= interval", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds."}, {"names": ["-U username", "--username= username"], "summary": "Specifies the user name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Specifies the user name to connect as."}, {"names": ["-w", "--no-password"], "summary": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "summary": "Forces pg_basebackup to prompt for a password before connecting to the source server.", "signature": "-W --password", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Forces pg_basebackup to prompt for a password before connecting to the source server. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["-V", "--version"], "summary": "Prints the pg_basebackup version and exits.", "signature": "-V --version", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Prints the pg_basebackup version and exits."}, {"names": ["-?", "--help"], "summary": "Shows help about pg_basebackup command line arguments, and exits.", "signature": "-? --help", "source_url": "/docs/18/app-pgbasebackup.html", "description": "Shows help about pg_basebackup command line arguments, and exits."}], "related": [{"url": "/wiki/conn/?v=18", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "label": "18.6", "major": "18", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/18/postgresql-18-A4.pdf", "bytes": 15865106, "pages": 3154, "sha256": "19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/18/postgresql-18-US.pdf", "bytes": 15748059, "pages": 3328, "sha256": "facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319", "built_at": "2026-09-26"}}, "tree": "18", "index": "index.html", "major": "18", "pages": 1148, "release": "18.6", "source_url": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "svg_assets": 3, "source_mode": "en SGML built with pinned official archive", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "revision": "ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8", "evidence_kind": "English manual and source declarations", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "sources": [{"url": "https://pg.center/docs/18/app-pgbasebackup.html", "file": "app-pgbasebackup.html", "label": "18.6 English manual \u00b7 app-pgbasebackup.html", "anchor": "", "sha256": "76780bc785b5bf8a7b20cdc1678b3e8d1de6aafb9cc46df9e578012d4f71546b", "language": "en", "original_url": "/docs/18/app-pgbasebackup.html"}, {"url": "https://pg.center/docs/18/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0", "language": "en", "original_url": "/docs/18/reference-client.html"}], "sections": [], "synopsis": ["pg_basebackup [ option ...]"], "signature": "pg_basebackup [ option ...]", "description": ["pg_basebackup \u2014 \u83b7\u53d6 PostgreSQL \u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd"], "environment": [], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGBASEBACKUP\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_basebackup</span></span></h2>\n<p lang=\"zh\">pg_basebackup \u2014 \u83b7\u53d6<span class=\"productname\">PostgreSQL</span>\u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.10.4.1\"><code class=\"command\">pg_basebackup</code> [<em class=\"replaceable\"><code>option</code></em>...]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u7528\u4e8e\u83b7\u53d6\u6b63\u5728\u8fd0\u884c\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07\u7684\u57fa\u7840\u5907\u4efd\u3002\u5907\u4efd\u8fc7\u7a0b\u4e0d\u4f1a\u5f71\u54cd\u6570\u636e\u5e93\u7684\u5176\u4ed6\u5ba2\u6237\u7aef\uff0c\u5e76\u4e14\u8be5\u5907\u4efd\u65e2\u53ef\u7528\u4e8e\u65f6\u95f4\u70b9\u6062\u590d\uff08\u89c1<a class=\"xref\" href=\"/docs/18/continuous-archiving.html\" title=\"25.3.\u00a0\u6301\u7eed\u5f52\u6863\u548c\u65f6\u95f4\u70b9\u6062\u590d\uff08PITR\uff09\">\u7b2c\u00a025.3\u00a0\u8282</a>\uff09\uff0c\u4e5f\u53ef\u7528\u4f5c\u65e5\u5fd7\u4f20\u9001\u6216\u6d41\u590d\u5236\u5907\u5e93\u7684\u8d77\u70b9\uff08\u89c1<a class=\"xref\" href=\"/docs/18/warm-standby.html\" title=\"26.2.\u00a0\u65e5\u5fd7\u4f20\u9001\u5907\u5e93\">\u7b2c\u00a026.2\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u65e2\u53ef\u4ee5\u6267\u884c\u5b8c\u6574\u57fa\u7840\u5907\u4efd\uff0c\u4e5f\u53ef\u4ee5\u6267\u884c\u589e\u91cf\u57fa\u7840\u5907\u4efd\u3002\u6267\u884c\u5b8c\u6574\u5907\u4efd\u65f6\uff0c\u5b83\u4f1a\u7cbe\u786e\u590d\u5236\u6570\u636e\u5e93\u96c6\u7c07\u7684\u6587\u4ef6\u3002\u6267\u884c\u589e\u91cf\u5907\u4efd\u65f6\uff0c\u539f\u672c\u4f1a\u5305\u542b\u5728\u5b8c\u6574\u5907\u4efd\u4e2d\u7684\u67d0\u4e9b\u6587\u4ef6\uff0c\u53ef\u80fd\u4f1a\u88ab\u8fd9\u4e9b\u6587\u4ef6\u7684\u589e\u91cf\u7248\u672c\u66ff\u4ee3\uff0c\u5176\u4e2d\u4ec5\u5305\u542b\u81ea\u53c2\u8003\u5907\u4efd\u4ee5\u6765\u88ab\u4fee\u6539\u8fc7\u7684\u5757\u3002\u589e\u91cf\u5907\u4efd\u4e0d\u80fd\u76f4\u63a5\u4f7f\u7528\uff1b\u5fc5\u987b\u5148\u4f7f\u7528<a class=\"xref\" href=\"/docs/18/app-pgcombinebackup.html\" title=\"pg_combinebackup\"><span class=\"refentrytitle\"><span class=\"application\">pg_combinebackup</span></span></a>\u5c06\u5176\u4e0e\u5b83\u6240\u4f9d\u8d56\u7684\u5148\u524d\u5907\u4efd\u5408\u5e76\u3002\u5173\u4e8e\u589e\u91cf\u5907\u4efd\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u89c1<a class=\"xref\" href=\"/docs/18/continuous-archiving.html#BACKUP-INCREMENTAL-BACKUP\" title=\"25.3.3.\u00a0\u8fdb\u884c\u589e\u91cf\u5907\u4efd\">\u7b2c\u00a025.3.3\u00a0\u8282</a>\uff1b\u5173\u4e8e\u4ece\u5907\u4efd\u6062\u590d\u7684\u6b65\u9aa4\uff0c\u89c1<a class=\"xref\" href=\"/docs/18/continuous-archiving.html#BACKUP-PITR-RECOVERY\" title=\"25.3.5.\u00a0\u4f7f\u7528\u6301\u7eed\u5f52\u6863\u5907\u4efd\u8fdb\u884c\u6062\u590d\">\u7b2c\u00a025.3.5\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5728\u4efb\u4f55\u6a21\u5f0f\u4e0b\uff0c<span class=\"application\">pg_basebackup</span>\u90fd\u4f1a\u786e\u4fdd\u670d\u52a1\u5668\u81ea\u52a8\u8fdb\u5165\u548c\u9000\u51fa\u5907\u4efd\u6a21\u5f0f\u3002\u5907\u4efd\u59cb\u7ec8\u9488\u5bf9\u6574\u4e2a\u6570\u636e\u5e93\u96c6\u7c07\uff1b\u4e0d\u53ef\u80fd\u53ea\u5907\u4efd\u5355\u4e2a\u6570\u636e\u5e93\u6216\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u5bf9\u4e8e\u9009\u62e9\u6027\u5907\u4efd\uff0c\u5fc5\u987b\u4f7f\u7528\u8bf8\u5982<a class=\"xref\" href=\"/docs/18/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>\u4e4b\u7c7b\u7684\u5176\u4ed6\u5de5\u5177\u3002</p>\n<p lang=\"zh\">\u5907\u4efd\u662f\u901a\u8fc7\u4e00\u4e2a\u4f7f\u7528\u590d\u5236\u534f\u8bae\u7684\u5e38\u89c4<span class=\"productname\">PostgreSQL</span>\u8fde\u63a5\u8fdb\u884c\u7684\u3002\u5efa\u7acb\u8be5\u8fde\u63a5\u6240\u4f7f\u7528\u7684\u7528\u6237 ID \u5fc5\u987b\u5177\u6709<code class=\"literal\">REPLICATION</code>\u6743\u9650\uff08\u89c1<a class=\"xref\" href=\"/docs/18/role-attributes.html\" title=\"21.2.\u00a0\u89d2\u8272\u5c5e\u6027\">\u7b2c\u00a021.2\u00a0\u8282</a>\uff09\uff0c\u6216\u8005\u662f\u8d85\u7ea7\u7528\u6237\uff0c\u5e76\u4e14<a class=\"link\" href=\"/docs/18/auth-pg-hba-conf.html\" title=\"20.1.\u00a0pg_hba.conf \u6587\u4ef6\"><code class=\"filename\">pg_hba.conf</code></a>\u5fc5\u987b\u5141\u8bb8\u8be5\u590d\u5236\u8fde\u63a5\u3002\u670d\u52a1\u5668\u8fd8\u5fc5\u987b\u5c06<a class=\"xref\" href=\"/docs/18/runtime-config-replication.html#GUC-MAX-WAL-SENDERS\">max_wal_senders</a>\u8bbe\u7f6e\u5f97\u8db3\u591f\u9ad8\uff0c\u4ee5\u4fbf\u81f3\u5c11\u63d0\u4f9b\u4e00\u4e2a\u7528\u4e8e\u5907\u4efd\u7684 WAL \u53d1\u9001\u8fdb\u7a0b\uff0c\u5e76\u5728\u4f7f\u7528 WAL \u6d41\u5f0f\u4f20\u8f93\u65f6\u518d\u63d0\u4f9b\u4e00\u4e2a WAL \u53d1\u9001\u8fdb\u7a0b\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u540c\u65f6\u8fd0\u884c\u591a\u4e2a<code class=\"command\">pg_basebackup</code>\uff0c\u4f46\u4ece\u6027\u80fd\u89d2\u5ea6\u6765\u770b\uff0c\u901a\u5e38\u6700\u597d\u53ea\u6267\u884c\u4e00\u6b21\u5907\u4efd\uff0c\u7136\u540e\u590d\u5236\u5176\u7ed3\u679c\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_basebackup</span>\u4e0d\u4ec5\u53ef\u4ee5\u4ece\u4e3b\u5e93\u83b7\u53d6\u57fa\u7840\u5907\u4efd\uff0c\u4e5f\u53ef\u4ee5\u4ece\u5907\u5e93\u83b7\u53d6\u3002\u8981\u4ece\u5907\u5e93\u83b7\u53d6\u5907\u4efd\uff0c\u9700\u8981\u5c06\u5907\u5e93\u914d\u7f6e\u4e3a\u80fd\u591f\u63a5\u53d7\u590d\u5236\u8fde\u63a5\uff08\u5373\u8bbe\u7f6e<code class=\"varname\">max_wal_senders</code>\u548c<a class=\"xref\" href=\"/docs/18/runtime-config-replication.html#GUC-HOT-STANDBY\">hot_standby</a>\uff0c\u5e76\u9002\u5f53\u5730\u914d\u7f6e\u5176<code class=\"filename\">pg_hba.conf</code>\uff09\u3002\u8fd8\u9700\u8981\u5728\u4e3b\u5e93\u4e0a\u542f\u7528<a class=\"xref\" href=\"/docs/18/runtime-config-wal.html#GUC-FULL-PAGE-WRITES\">full_page_writes</a>\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u4ece\u5907\u5e93\u83b7\u53d6\u5907\u4efd\u5b58\u5728\u4e00\u4e9b\u9650\u5236\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5907\u4efd\u5386\u53f2\u6587\u4ef6\u4e0d\u4f1a\u5728\u88ab\u5907\u4efd\u7684\u6570\u636e\u5e93\u96c6\u7c07\u4e2d\u521b\u5efa\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">pg_basebackup</span>\u65e0\u6cd5\u5f3a\u5236\u5907\u5e93\u5728\u5907\u4efd\u7ed3\u675f\u65f6\u5207\u6362\u5230\u65b0\u7684 WAL \u6587\u4ef6\u3002\u5f53\u4f7f\u7528<code class=\"literal\">-X none</code>\u65f6\uff0c\u5982\u679c\u4e3b\u5e93\u4e0a\u7684\u5199\u5165\u6d3b\u52a8\u8f83\u5c11\uff0c<span class=\"application\">pg_basebackup</span>\u53ef\u80fd\u9700\u8981\u957f\u65f6\u95f4\u7b49\u5f85\uff0c\u76f4\u5230\u5907\u4efd\u6240\u9700\u7684\u6700\u540e\u4e00\u4e2a WAL \u6587\u4ef6\u88ab\u5207\u6362\u5e76\u5f52\u6863\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5728\u4e3b\u5e93\u4e0a\u8fd0\u884c<code class=\"function\">pg_switch_wal</code>\uff0c\u4ee5\u7acb\u5373\u89e6\u53d1 WAL \u6587\u4ef6\u5207\u6362\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5982\u679c\u5907\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u88ab\u63d0\u5347\u4e3a\u4e3b\u5e93\uff0c\u5219\u5907\u4efd\u4f1a\u5931\u8d25\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5907\u4efd\u6240\u9700\u7684\u6240\u6709 WAL \u8bb0\u5f55\u90fd\u5fc5\u987b\u5305\u542b\u8db3\u591f\u7684\u6574\u9875\u5199\u5165\uff0c\u56e0\u6b64\u5fc5\u987b\u5728\u4e3b\u5e93\u4e0a\u542f\u7528<code class=\"varname\">full_page_writes</code>\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u6bcf\u5f53<span class=\"application\">pg_basebackup</span>\u6267\u884c\u57fa\u7840\u5907\u4efd\u65f6\uff0c\u670d\u52a1\u5668\u7684<code class=\"structname\">pg_stat_progress_basebackup</code>\u89c6\u56fe\u90fd\u4f1a\u62a5\u544a\u5907\u4efd\u8fdb\u5ea6\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/18/progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING\" title=\"27.4.6.\u00a0\u57fa\u7840\u5907\u4efd\u8fdb\u5ea6\u62a5\u544a\">\u7b2c\u00a027.4.6\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u8f93\u51fa\u7684\u4f4d\u7f6e\u548c\u683c\u5f0f\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>directory</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u5199\u5165\u8f93\u51fa\u7684\u76ee\u6807\u76ee\u5f55\u3002\u5982\u679c\u8be5\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u521b\u5efa\u5b83\uff08\u4ee5\u53ca\u6240\u6709\u7f3a\u5931\u7684\u7236\u76ee\u5f55\uff09\u3002\u5982\u679c\u8be5\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002</p>\n<p lang=\"zh\">\u5f53\u5907\u4efd\u91c7\u7528 tar \u683c\u5f0f\u65f6\uff0c\u76ee\u6807\u76ee\u5f55\u53ef\u4ee5\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff08\u77ed\u6a2a\u7ebf\uff09\uff0c\u4ece\u800c\u5c06 tar \u6587\u4ef6\u5199\u5230<code class=\"literal\">stdout</code>\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u662f\u5fc5\u9700\u7684\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>format</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--format=<em class=\"replaceable\"><code>format</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u9009\u62e9\u8f93\u51fa\u683c\u5f0f\u3002<em class=\"replaceable\"><code>format</code></em>\u53ef\u4ee5\u662f\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">p</code><br/></span><span class=\"term\"><code class=\"literal\">plain</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u5199\u4e3a\u666e\u901a\u6587\u4ef6\uff0c\u5176\u5e03\u5c40\u4e0e\u6e90\u670d\u52a1\u5668\u7684\u6570\u636e\u76ee\u5f55\u548c\u8868\u7a7a\u95f4\u76f8\u540c\u3002\u5f53\u96c6\u7c07\u6ca1\u6709\u989d\u5916\u8868\u7a7a\u95f4\u65f6\uff0c\u6574\u4e2a\u6570\u636e\u5e93\u90fd\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u3002\u5982\u679c\u96c6\u7c07\u5305\u542b\u989d\u5916\u8868\u7a7a\u95f4\uff0c\u5219\u4e3b\u6570\u636e\u76ee\u5f55\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\uff0c\u800c\u5176\u4ed6\u6240\u6709\u8868\u7a7a\u95f4\u90fd\u4f1a\u653e\u5728\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u76f8\u540c\u7684\u7edd\u5bf9\u8def\u5f84\u4e2d\u3002\uff08\u5982\u9700\u6539\u53d8\u8fd9\u4e00\u70b9\uff0c\u89c1<code class=\"option\">--tablespace-mapping</code>\u3002\uff09</p>\n<p lang=\"zh\">\u8fd9\u662f\u9ed8\u8ba4\u683c\u5f0f\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">t</code><br/></span><span class=\"term\"><code class=\"literal\">tar</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u5199\u4e3a\u76ee\u6807\u76ee\u5f55\u4e2d\u7684 tar \u6587\u4ef6\u3002\u4e3b\u6570\u636e\u76ee\u5f55\u7684\u5185\u5bb9\u4f1a\u5199\u5165\u540d\u4e3a<code class=\"filename\">base.tar</code>\u7684\u6587\u4ef6\u4e2d\uff0c\u800c\u6bcf\u4e2a\u5176\u4ed6\u8868\u7a7a\u95f4\u90fd\u4f1a\u5199\u5165\u4e00\u4e2a\u4ee5\u8be5\u8868\u7a7a\u95f4 OID \u547d\u540d\u7684\u72ec\u7acb tar \u6587\u4ef6\u4e2d\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u76ee\u6807\u76ee\u5f55\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff08\u77ed\u6a2a\u7ebf\uff09\uff0ctar \u5185\u5bb9\u5c06\u5199\u5165\u6807\u51c6\u8f93\u51fa\uff0c\u9002\u5408\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u4f8b\u5982<span class=\"productname\">gzip</span>\u3002\u53ea\u6709\u5f53\u96c6\u7c07\u6ca1\u6709\u989d\u5916\u8868\u7a7a\u95f4\u4e14\u672a\u4f7f\u7528 WAL \u6d41\u5f0f\u4f20\u8f93\u65f6\uff0c\u624d\u5141\u8bb8\u8fd9\u6837\u505a\u3002</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-i <em class=\"replaceable\"><code>old_manifest_file</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--incremental=<em class=\"replaceable\"><code>old_manifest_file</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6267\u884c<a class=\"link\" href=\"/docs/18/continuous-archiving.html#BACKUP-INCREMENTAL-BACKUP\" title=\"25.3.3.\u00a0\u8fdb\u884c\u589e\u91cf\u5907\u4efd\">\u589e\u91cf\u5907\u4efd</a>\u3002\u5fc5\u987b\u63d0\u4f9b\u53c2\u8003\u5907\u4efd\u7684\u5907\u4efd\u6e05\u5355\uff1b\u8be5\u6587\u4ef6\u5c06\u88ab\u4e0a\u4f20\u5230\u670d\u52a1\u5668\uff0c\u968f\u540e\u670d\u52a1\u5668\u4f1a\u8fd4\u56de\u6240\u8bf7\u6c42\u7684\u589e\u91cf\u5907\u4efd\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code><br/></span><span class=\"term\"><code class=\"option\">--write-recovery-conf</code></span></dt>\n<dd>\n<p lang=\"zh\">\u521b\u5efa<a class=\"link\" href=\"/docs/18/warm-standby.html#FILE-STANDBY-SIGNAL\"><code class=\"filename\">standby.signal</code></a> <a class=\"indexterm\" id=\"id-1.9.4.10.6.2.1.4.3.1.2\" name=\"id-1.9.4.10.6.2.1.4.3.1.2\"></a>\u6587\u4ef6\uff0c\u5e76\u5c06\u8fde\u63a5\u8bbe\u7f6e\u8ffd\u52a0\u5230\u76ee\u6807\u76ee\u5f55\u4e2d\u7684<code class=\"filename\">postgresql.auto.conf</code>\u6587\u4ef6\u4e2d\uff08\u5982\u679c\u4f7f\u7528 tar \u683c\u5f0f\uff0c\u5219\u8ffd\u52a0\u5230\u57fa\u7840\u5f52\u6863\u6587\u4ef6\u5185\uff09\u3002\u8fd9\u6837\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u5229\u7528\u5907\u4efd\u7ed3\u679c\u642d\u5efa\u5907\u5e93\u3002</p>\n<p lang=\"zh\"><code class=\"filename\">postgresql.auto.conf</code>\u6587\u4ef6\u5c06\u8bb0\u5f55\u8fde\u63a5\u8bbe\u7f6e\uff0c\u4ee5\u53ca\uff08\u5982\u679c\u6307\u5b9a\uff09<span class=\"application\">pg_basebackup</span>\u6b63\u5728\u4f7f\u7528\u7684\u590d\u5236\u69fd\uff0c\u4ee5\u4fbf\u540e\u7eed\u7684\u6d41\u590d\u5236\u548c<a class=\"link\" href=\"/docs/18/logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS-SYNCHRONIZATION\" title=\"47.2.3.\u00a0\u590d\u5236\u69fd\u540c\u6b65\">\u903b\u8f91\u590d\u5236\u69fd\u540c\u6b65</a>\u4f7f\u7528\u76f8\u540c\u7684\u8bbe\u7f6e\u3002\u53ea\u6709\u5f53 dbname \u5728\u8fde\u63a5\u5b57\u7b26\u4e32\u6216<a class=\"link\" href=\"/docs/18/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u73af\u5883\u53d8\u91cf</a>\u4e2d\u88ab\u663e\u5f0f\u6307\u5b9a\u65f6\uff0c\u624d\u4f1a\u8bb0\u5f55 dbname\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t <em class=\"replaceable\"><code>target</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--target=<em class=\"replaceable\"><code>target</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u793a\u670d\u52a1\u5668\u5c06\u57fa\u7840\u5907\u4efd\u653e\u5230\u54ea\u91cc\u3002\u9ed8\u8ba4\u76ee\u6807\u662f<code class=\"literal\">client</code>\uff0c\u8868\u793a\u5907\u4efd\u5e94\u53d1\u9001\u5230\u8fd0\u884c<span class=\"application\">pg_basebackup</span>\u7684\u90a3\u53f0\u673a\u5668\u3002\u5982\u679c\u76ee\u6807\u6539\u4e3a<code class=\"literal\">server:/some/path</code>\uff0c\u5219\u5907\u4efd\u4f1a\u5b58\u50a8\u5728\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684<code class=\"literal\">/some/path</code>\u76ee\u5f55\u4e2d\u3002\u5c06\u5907\u4efd\u5b58\u50a8\u5728\u670d\u52a1\u5668\u4e0a\u9700\u8981\u8d85\u7ea7\u7528\u6237\u6743\u9650\uff0c\u6216\u62e5\u6709<code class=\"literal\">pg_write_server_files</code>\u89d2\u8272\u7684\u6743\u9650\u3002\u5982\u679c\u76ee\u6807\u8bbe\u7f6e\u4e3a<code class=\"literal\">blackhole</code>\uff0c\u5219\u5185\u5bb9\u4f1a\u88ab\u4e22\u5f03\uff0c\u4e0d\u4f1a\u5b58\u50a8\u5230\u4efb\u4f55\u5730\u65b9\u3002\u8fd9\u53ea\u5e94\u7528\u4e8e\u6d4b\u8bd5\u76ee\u7684\uff0c\u56e0\u4e3a\u6700\u7ec8\u4e0d\u4f1a\u5f97\u5230\u5b9e\u9645\u5907\u4efd\u3002</p>\n<p lang=\"zh\">\u7531\u4e8e WAL \u6d41\u5f0f\u4f20\u8f93\u662f\u7531<span class=\"application\">pg_basebackup</span>\u800c\u4e0d\u662f\u670d\u52a1\u5668\u5b9e\u73b0\u7684\uff0c\u56e0\u6b64\u6b64\u9009\u9879\u4e0d\u80fd\u4e0e<code class=\"literal\">-Xstream</code>\u4e00\u8d77\u4f7f\u7528\u3002\u7531\u4e8e\u540e\u8005\u662f\u9ed8\u8ba4\u503c\uff0c\u6240\u4ee5\u6307\u5b9a\u6b64\u9009\u9879\u65f6\uff0c\u8fd8\u5fc5\u987b\u540c\u65f6\u6307\u5b9a<code class=\"literal\">-Xfetch</code>\u6216<code class=\"literal\">-Xnone</code>\u4e4b\u4e00\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>olddir</code></em>=<em class=\"replaceable\"><code>newdir</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--tablespace-mapping=<em class=\"replaceable\"><code>olddir</code></em>=<em class=\"replaceable\"><code>newdir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u671f\u95f4\uff0c\u5c06\u76ee\u5f55<em class=\"replaceable\"><code>olddir</code></em>\u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230<em class=\"replaceable\"><code>newdir</code></em>\u3002\u8981\u4f7f\u6b64\u9009\u9879\u751f\u6548\uff0c<em class=\"replaceable\"><code>olddir</code></em>\u5fc5\u987b\u4e0e\u6e90\u670d\u52a1\u5668\u4e0a\u5b9a\u4e49\u7684\u8be5\u8868\u7a7a\u95f4\u8def\u5f84\u5b8c\u5168\u4e00\u81f4\u3002\uff08\u4f46\u5982\u679c\u6e90\u670d\u52a1\u5668\u4e0a\u5728<em class=\"replaceable\"><code>olddir</code></em>\u4e2d\u6ca1\u6709\u8868\u7a7a\u95f4\uff0c\u4e5f\u4e0d\u7b97\u9519\u8bef\u3002\uff09\u4e0e\u6b64\u540c\u65f6\uff0c<em class=\"replaceable\"><code>newdir</code></em>\u662f\u63a5\u6536\u4e3b\u673a\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u4e00\u4e2a\u76ee\u5f55\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c<em class=\"replaceable\"><code>newdir</code></em>\u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002<em class=\"replaceable\"><code>olddir</code></em>\u548c<em class=\"replaceable\"><code>newdir</code></em>\u90fd\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u5982\u679c\u4efb\u4e00\u8def\u5f84\u4e2d\u9700\u8981\u5305\u542b\u7b49\u53f7\uff08<code class=\"literal\">=</code>\uff09\uff0c\u8bf7\u5728\u5176\u524d\u9762\u52a0\u4e0a\u53cd\u659c\u6760\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u4ee5\u5904\u7406\u591a\u4e2a\u8868\u7a7a\u95f4\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u91cd\u5b9a\u4f4d\u8868\u7a7a\u95f4\uff0c\u4e3b\u6570\u636e\u76ee\u5f55\u4e2d\u7684\u7b26\u53f7\u94fe\u63a5\u5c06\u88ab\u66f4\u65b0\u4e3a\u6307\u5411\u65b0\u4f4d\u7f6e\u3002\u56e0\u6b64\uff0c\u65b0\u6570\u636e\u76ee\u5f55\u5df2\u53ef\u76f4\u63a5\u7528\u4e8e\u542f\u52a8\u4e00\u4e2a\u6240\u6709\u8868\u7a7a\u95f4\u90fd\u4f4d\u4e8e\u66f4\u65b0\u540e\u4f4d\u7f6e\u7684\u65b0\u670d\u52a1\u5668\u5b9e\u4f8b\u3002</p>\n<p lang=\"zh\">\u76ee\u524d\uff0c\u6b64\u9009\u9879\u4ec5\u9002\u7528\u4e8e\u666e\u901a\u6587\u4ef6\u8f93\u51fa\u683c\u5f0f\uff1b\u5982\u679c\u9009\u62e9\u4e86 tar \u683c\u5f0f\uff0c\u5219\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--waldir=<em class=\"replaceable\"><code>waldir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5199\u5165 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cWAL \u6587\u4ef6\u4f1a\u653e\u5728\u76ee\u6807\u76ee\u5f55\u7684<code class=\"filename\">pg_wal</code>\u5b50\u76ee\u5f55\u4e2d\uff0c\u4f46\u6b64\u9009\u9879\u53ef\u7528\u4e8e\u5c06\u5176\u653e\u5728\u5176\u4ed6\u4f4d\u7f6e\u3002<em class=\"replaceable\"><code>waldir</code></em>\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002\u4e0e\u4e3b\u76ee\u6807\u76ee\u5f55\u4e00\u6837\uff0c<em class=\"replaceable\"><code>waldir</code></em>\u4e0d\u5fc5\u4e8b\u5148\u5b58\u5728\uff0c\u4f46\u5982\u679c\u5b58\u5728\u5219\u5fc5\u987b\u4e3a\u7a7a\u3002\u53ea\u6709\u5f53\u5907\u4efd\u91c7\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u624d\u80fd\u6307\u5b9a\u6b64\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-X <em class=\"replaceable\"><code>method</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--wal-method=<em class=\"replaceable\"><code>method</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u4e2d\u5305\u542b\u6240\u9700\u7684 WAL\uff08\u9884\u5199\u5f0f\u65e5\u5fd7\uff09\u6587\u4ef6\u3002\u8fd9\u5c06\u5305\u62ec\u5907\u4efd\u671f\u95f4\u751f\u6210\u7684\u6240\u6709\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u9664\u975e\u6307\u5b9a\u65b9\u6cd5<code class=\"literal\">none</code>\uff0c\u5426\u5219\u5c31\u53ef\u4ee5\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u542f\u52a8 postmaster\uff0c\u800c\u65e0\u9700\u67e5\u9605 WAL \u5f52\u6863\uff0c\u4ece\u800c\u4f7f\u8f93\u51fa\u6210\u4e3a\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u5907\u4efd\u3002</p>\n<p lang=\"zh\">\u652f\u6301\u4ee5\u4e0b\u7528\u4e8e\u6536\u96c6\u9884\u5199\u5f0f\u65e5\u5fd7\u7684<em class=\"replaceable\"><code>method</code></em>\u503c\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">n</code><br/></span><span class=\"term\"><code class=\"literal\">none</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u5728\u5907\u4efd\u4e2d\u5305\u542b\u9884\u5199\u5f0f\u65e5\u5fd7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">f</code><br/></span><span class=\"term\"><code class=\"literal\">fetch</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5907\u4efd\u7ed3\u675f\u65f6\u6536\u96c6\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u3002\u56e0\u6b64\uff0c\u6e90\u670d\u52a1\u5668\u7684<a class=\"xref\" href=\"/docs/18/runtime-config-replication.html#GUC-WAL-KEEP-SIZE\">wal_keep_size</a>\u53c2\u6570\u5fc5\u987b\u8bbe\u7f6e\u5f97\u8db3\u591f\u9ad8\uff0c\u4ee5\u786e\u4fdd\u5728\u5907\u4efd\u7ed3\u675f\u524d\u4e0d\u4f1a\u79fb\u9664\u6240\u9700\u7684\u65e5\u5fd7\u6570\u636e\u3002\u5982\u679c\u5728\u4f20\u8f93\u8fd9\u4e9b\u6570\u636e\u4e4b\u524d\u5b83\u4eec\u5df2\u7ecf\u88ab\u56de\u6536\uff0c\u5219\u5907\u4efd\u4f1a\u5931\u8d25\u5e76\u4e14\u65e0\u6cd5\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u4f1a\u5305\u542b\u5728<code class=\"filename\">base.tar</code>\u6587\u4ef6\u4e2d\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">s</code><br/></span><span class=\"term\"><code class=\"literal\">stream</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u6267\u884c\u5907\u4efd\u7684\u540c\u65f6\u6d41\u5f0f\u4f20\u8f93\u9884\u5199\u5f0f\u65e5\u5fd7\u6570\u636e\u3002\u6b64\u65b9\u6cd5\u4f1a\u5411\u670d\u52a1\u5668\u6253\u5f00\u7b2c\u4e8c\u4e2a\u8fde\u63a5\uff0c\u5e76\u5728\u6267\u884c\u5907\u4efd\u65f6\u5e76\u884c\u5f00\u59cb\u6d41\u5f0f\u4f20\u8f93\u9884\u5199\u5f0f\u65e5\u5fd7\u3002\u56e0\u6b64\uff0c\u5b83\u9700\u8981\u4e24\u4e2a\u590d\u5236\u8fde\u63a5\uff0c\u800c\u4e0d\u53ea\u662f\u4e00\u4e2a\u3002\u53ea\u8981\u5ba2\u6237\u7aef\u80fd\u591f\u8ddf\u4e0a\u9884\u5199\u5f0f\u65e5\u5fd7\u6570\u636e\uff0c\u4f7f\u7528\u6b64\u65b9\u6cd5\u5c31\u4e0d\u9700\u8981\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u989d\u5916\u4fdd\u7559\u9884\u5199\u5f0f\u65e5\u5fd7\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u9884\u5199\u5f0f\u65e5\u5fd7\u6587\u4ef6\u4f1a\u5199\u5165\u4e00\u4e2a\u540d\u4e3a<code class=\"filename\">pg_wal.tar</code>\u7684\u72ec\u7acb\u6587\u4ef6\u4e2d\uff08\u5982\u679c\u670d\u52a1\u5668\u7248\u672c\u65e9\u4e8e 10\uff0c\u5219\u6587\u4ef6\u540d\u4e3a<code class=\"filename\">pg_xlog.tar</code>\uff09\u3002</p>\n<p lang=\"zh\">\u8fd9\u662f\u9ed8\u8ba4\u503c\u3002</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-z</code><br/></span><span class=\"term\"><code class=\"option\">--gzip</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528 tar \u6587\u4ef6\u8f93\u51fa\u7684 gzip \u538b\u7f29\uff0c\u4f7f\u7528\u9ed8\u8ba4\u538b\u7f29\u7ea7\u522b\u3002\u538b\u7f29\u4ec5\u5728\u4f7f\u7528 tar \u683c\u5f0f\u65f6\u53ef\u7528\uff0c\u5e76\u4e14\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u81ea\u52a8\u6dfb\u52a0<code class=\"filename\">.gz</code>\u540e\u7f00\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-Z <em class=\"replaceable\"><code>level</code></em></code><br/></span><span class=\"term\"><code class=\"option\">-Z [{client|server}-]<em class=\"replaceable\"><code>method</code></em>[:<em class=\"replaceable\"><code>detail</code></em>]</code><br/></span><span class=\"term\"><code class=\"option\">--compress=<em class=\"replaceable\"><code>level</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--compress=[{client|server}-]<em class=\"replaceable\"><code>method</code></em>[:<em class=\"replaceable\"><code>detail</code></em>]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bf7\u6c42\u5bf9\u5907\u4efd\u8fdb\u884c\u538b\u7f29\u3002\u5982\u679c\u5305\u542b<code class=\"literal\">client</code>\u6216<code class=\"literal\">server</code>\uff0c\u5219\u6307\u5b9a\u538b\u7f29\u6267\u884c\u7684\u4f4d\u7f6e\u3002\u5728\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4f1a\u51cf\u5c11\u4f20\u8f93\u5e26\u5bbd\u5360\u7528\uff0c\u4f46\u4f1a\u589e\u52a0\u670d\u52a1\u5668 CPU \u6d88\u8017\u3002\u9ed8\u8ba4\u503c\u662f<code class=\"literal\">client</code>\uff0c\u4f46\u4f7f\u7528<code class=\"literal\">--target</code>\u65f6\u9664\u5916\uff1b\u6b64\u65f6\u5907\u4efd\u4e0d\u4f1a\u53d1\u9001\u5230\u5ba2\u6237\u7aef\uff0c\u56e0\u6b64\u53ea\u6709\u670d\u52a1\u5668\u7aef\u538b\u7f29\u624d\u6709\u610f\u4e49\u3002\u4f7f\u7528\u9ed8\u8ba4\u7684<code class=\"literal\">-Xstream</code>\u65f6\uff0c\u670d\u52a1\u5668\u7aef\u538b\u7f29\u4e0d\u4f1a\u5e94\u7528\u4e8e WAL\u3002\u82e5\u8981\u538b\u7f29 WAL\uff0c\u8bf7\u4f7f\u7528\u5ba2\u6237\u7aef\u538b\u7f29\uff0c\u6216\u8005\u6307\u5b9a<code class=\"literal\">-Xfetch</code>\u3002</p>\n<p lang=\"zh\">\u538b\u7f29\u65b9\u6cd5\u53ef\u4ee5\u8bbe\u7f6e\u4e3a<code class=\"literal\">gzip</code>\u3001<code class=\"literal\">lz4</code>\u3001<code class=\"literal\">zstd</code>\u3001<code class=\"literal\">none</code>\uff08\u4e0d\u538b\u7f29\uff09\uff0c\u4e5f\u53ef\u4ee5\u76f4\u63a5\u6307\u5b9a\u4e00\u4e2a\u6574\u6570\uff080 \u8868\u793a\u4e0d\u538b\u7f29\uff0c\u5927\u4e8e 0 \u8868\u793a<code class=\"literal\">gzip</code>\uff09\u3002\u8fd8\u53ef\u4ee5\u9009\u62e9\u6027\u5730\u6307\u5b9a\u538b\u7f29\u7ec6\u8282\u5b57\u7b26\u4e32\u3002\u5982\u679c\u7ec6\u8282\u5b57\u7b26\u4e32\u662f\u6574\u6570\uff0c\u5219\u8868\u793a\u538b\u7f29\u7ea7\u522b\uff1b\u5426\u5219\uff0c\u5b83\u5e94\u4e3a\u9017\u53f7\u5206\u9694\u7684\u9879\u76ee\u5217\u8868\uff0c\u6bcf\u9879\u7684\u5f62\u5f0f\u4e3a<em class=\"replaceable\"><code>keyword</code></em>\u6216<em class=\"replaceable\"><code>keyword=value</code></em>\u3002\u76ee\u524d\u652f\u6301\u7684\u5173\u952e\u5b57\u6709<code class=\"literal\">level</code>\u3001<code class=\"literal\">long</code>\u548c<code class=\"literal\">workers</code>\u3002\u5f53\u538b\u7f29\u65b9\u6cd5\u4ee5\u7eaf\u6574\u6570\u5f62\u5f0f\u6307\u5b9a\u65f6\uff0c\u4e0d\u80fd\u518d\u4f7f\u7528\u7ec6\u8282\u5b57\u7b26\u4e32\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u538b\u7f29\u7ea7\u522b\uff0c\u5c06\u4f7f\u7528\u9ed8\u8ba4\u7ea7\u522b\u3002\u5982\u679c\u53ea\u6307\u5b9a\u7ea7\u522b\u800c\u672a\u6307\u5b9a\u7b97\u6cd5\uff0c\u5219\u7ea7\u522b\u5927\u4e8e 0 \u65f6\u4f7f\u7528 gzip \u538b\u7f29\uff0c\u7ea7\u522b\u4e3a 0 \u65f6\u4e0d\u538b\u7f29\u3002</p>\n<p lang=\"zh\">\u5f53 tar \u683c\u5f0f\u914d\u5408<code class=\"literal\">gzip</code>\u3001<code class=\"literal\">lz4</code>\u6216<code class=\"literal\">zstd</code>\u4f7f\u7528\u65f6\uff0c\u6240\u6709 tar \u6587\u4ef6\u540d\u90fd\u4f1a\u5206\u522b\u81ea\u52a8\u52a0\u4e0a<code class=\"filename\">.gz</code>\u3001<code class=\"filename\">.lz4</code>\u6216<code class=\"filename\">.zst</code>\u540e\u7f00\u3002\u4f7f\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u4e0d\u80fd\u6307\u5b9a\u5ba2\u6237\u7aef\u538b\u7f29\uff0c\u4f46\u4ecd\u53ef\u4ee5\u8bf7\u6c42\u670d\u52a1\u5668\u7aef\u538b\u7f29\u3002\u8fd9\u6837\u505a\u65f6\uff0c\u670d\u52a1\u5668\u4f1a\u5148\u538b\u7f29\u5907\u4efd\u518d\u4f20\u8f93\uff0c\u800c\u5ba2\u6237\u7aef\u4f1a\u5bf9\u5176\u8fdb\u884c\u89e3\u538b\u5e76\u63d0\u53d6\u3002</p>\n<p lang=\"zh\">\u5f53\u6b64\u9009\u9879\u4e0e<code class=\"literal\">-Xstream</code>\u7ec4\u5408\u4f7f\u7528\u65f6\uff0c\u5982\u679c\u9009\u62e9\u4e86\u5ba2\u6237\u7aef gzip \u538b\u7f29\uff0c\u5219<code class=\"literal\">pg_wal.tar</code>\u4f1a\u4f7f\u7528<code class=\"literal\">gzip</code>\u538b\u7f29\uff1b\u4f46\u5982\u679c\u9009\u62e9\u4e86\u5176\u4ed6\u538b\u7f29\u7b97\u6cd5\uff0c\u6216\u8005\u9009\u62e9\u4e86\u670d\u52a1\u5668\u7aef\u538b\u7f29\uff0c\u5219\u4e0d\u4f1a\u88ab\u538b\u7f29\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u5907\u4efd\u7684\u751f\u6210\u548c\u7a0b\u5e8f\u7684\u8c03\u7528\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-c {fast|spread}</code><br/></span><span class=\"term\"><code class=\"option\">--checkpoint={fast|spread}</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u68c0\u67e5\u70b9\u6a21\u5f0f\u8bbe\u7f6e\u4e3a fast\uff08\u7acb\u5373\uff09\u6216 spread\uff08\u9ed8\u8ba4\uff09\uff08\u89c1<a class=\"xref\" href=\"/docs/18/continuous-archiving.html#BACKUP-LOWLEVEL-BASE-BACKUP\" title=\"25.3.4.\u00a0\u4f7f\u7528\u4f4e\u7ea7 API \u8fdb\u884c\u57fa\u7840\u5907\u4efd\">\u7b2c\u00a025.3.4\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--create-slot</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728\u5f00\u59cb\u5907\u4efd\u4e4b\u524d\uff0c\u5e94\u521b\u5efa\u7531<code class=\"literal\">--slot</code>\u9009\u9879\u6307\u5b9a\u540d\u79f0\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u8be5\u69fd\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u9519\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>label</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--label=<em class=\"replaceable\"><code>label</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5907\u4efd\u6807\u7b7e\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u503c<span class=\"quote\">\u201c<span class=\"quote\"><code class=\"literal\">pg_basebackup base backup</code></span>\u201d</span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-clean</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53<code class=\"command\">pg_basebackup</code>\u56e0\u9519\u8bef\u4e2d\u6b62\u65f6\uff0c\u5b83\u4f1a\u5220\u9664\u5728\u53d1\u73b0\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u76ee\u5f55\uff08\u4f8b\u5982\u76ee\u6807\u76ee\u5f55\u548c\u9884\u5199\u5f0f\u65e5\u5fd7\u76ee\u5f55\uff09\u3002\u6b64\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u5f88\u6709\u5e2e\u52a9\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u65e0\u8bba\u662f\u5426\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u8868\u7a7a\u95f4\u76ee\u5f55\u90fd\u4e0d\u4f1a\u88ab\u6e05\u7406\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N</code><br/></span><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">pg_basebackup</code>\u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u88ab\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f1a\u4f7f<code class=\"command\">pg_basebackup</code>\u4e0d\u7ecf\u7b49\u5f85\u5c31\u76f4\u63a5\u8fd4\u56de\uff0c\u56e0\u6b64\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u968f\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u57fa\u7840\u5907\u4efd\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u5408\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P</code><br/></span><span class=\"term\"><code class=\"option\">--progress</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528\u8fdb\u5ea6\u62a5\u544a\u3002\u6253\u5f00\u6b64\u9009\u9879\u540e\uff0c\u4f1a\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u7ed9\u51fa\u4e00\u4e2a\u8fd1\u4f3c\u7684\u8fdb\u5ea6\u62a5\u544a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u53d1\u751f\u53d8\u5316\uff0c\u56e0\u6b64\u8fd9\u53ea\u662f\u8fd1\u4f3c\u503c\uff0c\u6700\u7ec8\u672a\u5fc5\u6070\u597d\u7ed3\u675f\u5728<code class=\"literal\">100%</code>\u3002\u7279\u522b\u662f\u5f53\u5907\u4efd\u4e2d\u5305\u542b WAL \u65f6\uff0c\u603b\u6570\u636e\u91cf\u65e0\u6cd5\u9884\u5148\u4f30\u8ba1\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u65e6\u8fdb\u5ea6\u8d85\u8fc7\u4e0d\u542b WAL \u65f6\u7684\u603b\u4f30\u8ba1\u503c\uff0c\u4f30\u8ba1\u76ee\u6807\u5927\u5c0f\u5c31\u4f1a\u7ee7\u7eed\u589e\u52a0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r <em class=\"replaceable\"><code>rate</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--max-rate=<em class=\"replaceable\"><code>rate</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u4ece\u6e90\u670d\u52a1\u5668\u6536\u96c6\u6570\u636e\u65f6\u5141\u8bb8\u7684\u6700\u5927\u4f20\u8f93\u901f\u7387\u3002\u8fd9\u6709\u52a9\u4e8e\u9650\u5236<span class=\"application\">pg_basebackup</span>\u5bf9\u670d\u52a1\u5668\u7684\u5f71\u54cd\u3002\u53d6\u503c\u5355\u4f4d\u4e3a\u6bcf\u79d2\u5343\u5b57\u8282\u3002\u4f7f\u7528\u540e\u7f00<code class=\"literal\">M</code>\u8868\u793a\u6bcf\u79d2\u5146\u5b57\u8282\u3002\u4e5f\u63a5\u53d7\u540e\u7f00<code class=\"literal\">k</code>\uff0c\u4f46\u6ca1\u6709\u5b9e\u9645\u5f71\u54cd\u3002\u6709\u6548\u53d6\u503c\u8303\u56f4\u4e3a\u6bcf\u79d2 32 \u5343\u5b57\u8282\u5230\u6bcf\u79d2 1024 \u5146\u5b57\u8282\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u59cb\u7ec8\u5f71\u54cd\u6570\u636e\u76ee\u5f55\u7684\u4f20\u8f93\u3002\u53ea\u6709\u5f53\u6536\u96c6\u65b9\u6cd5\u4e3a<code class=\"literal\">fetch</code>\u65f6\uff0cWAL \u6587\u4ef6\u7684\u4f20\u8f93\u624d\u4f1a\u53d7\u5230\u5f71\u54cd\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>slotname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--slot=<em class=\"replaceable\"><code>slotname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u53ea\u80fd\u4e0e<code class=\"literal\">-X stream</code>\u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u4f1a\u4f7f WAL \u6d41\u5f0f\u4f20\u8f93\u4f7f\u7528\u6307\u5b9a\u7684\u590d\u5236\u69fd\u3002\u5982\u679c\u6b64\u57fa\u7840\u5907\u4efd\u6253\u7b97\u7528\u4f5c\u4f7f\u7528\u590d\u5236\u69fd\u7684\u6d41\u590d\u5236\u5907\u5e93\uff0c\u90a3\u4e48\u8be5\u5907\u5e93\u5e94\u5c06\u540c\u4e00\u4e2a\u590d\u5236\u69fd\u540d\u79f0\u7528\u4f5c<a class=\"xref\" href=\"/docs/18/runtime-config-replication.html#GUC-PRIMARY-SLOT-NAME\">primary_slot_name</a>\u7684\u503c\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u4e3b\u5e93\u5728\u57fa\u7840\u5907\u4efd\u7ed3\u675f\u4e0e\u65b0\u5907\u5e93\u5f00\u59cb\u6d41\u590d\u5236\u4e4b\u95f4\u7684\u8fd9\u6bb5\u65f6\u95f4\u5185\uff0c\u4e0d\u4f1a\u79fb\u9664\u4efb\u4f55\u5fc5\u9700\u7684 WAL \u6570\u636e\u3002</p>\n<p lang=\"zh\">\u6307\u5b9a\u7684\u590d\u5236\u69fd\u5fc5\u987b\u5df2\u7ecf\u5b58\u5728\uff0c\u9664\u975e\u8fd8\u540c\u65f6\u4f7f\u7528\u4e86<code class=\"option\">-C</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5e76\u4e14\u670d\u52a1\u5668\u652f\u6301\u4e34\u65f6\u590d\u5236\u69fd\uff0810 \u53ca\u4ee5\u4e0a\u7248\u672c\uff09\uff0c\u5219\u4f1a\u81ea\u52a8\u4f7f\u7528\u4e34\u65f6\u590d\u5236\u69fd\u8fdb\u884c WAL \u6d41\u5f0f\u4f20\u8f93\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--sync-method=<em class=\"replaceable\"><code>method</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u4e3a<code class=\"literal\">fsync</code>\uff08\u9ed8\u8ba4\uff09\u65f6\uff0c<code class=\"command\">pg_basebackup</code>\u4f1a\u9012\u5f52\u6253\u5f00\u5e76\u540c\u6b65\u5907\u4efd\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3002\u4f7f\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c\u67e5\u627e\u6587\u4ef6\u4f1a\u8ddf\u968f WAL \u76ee\u5f55\u548c\u5404\u5df2\u914d\u7f6e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u3002</p>\n<p lang=\"zh\">\u5728 Linux \u4e0a\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528<code class=\"literal\">syncfs</code>\uff0c\u8ba9\u64cd\u4f5c\u7cfb\u7edf\u540c\u6b65\u5305\u542b\u5907\u4efd\u76ee\u5f55\u7684\u6574\u4e2a\u6587\u4ef6\u7cfb\u7edf\u3002\u4f7f\u7528\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u65f6\uff0c<code class=\"command\">pg_basebackup</code>\u8fd8\u4f1a\u540c\u6b65\u5305\u542b WAL \u6587\u4ef6\u548c\u5404\u8868\u7a7a\u95f4\u7684\u6587\u4ef6\u7cfb\u7edf\u3002\u5173\u4e8e\u4f7f\u7528<code class=\"literal\">syncfs</code>\u65f6\u9700\u8981\u6ce8\u610f\u7684\u4e8b\u9879\uff0c\u89c1<a class=\"xref\" href=\"/docs/18/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\">recovery_init_sync_method</a>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--no-sync</code>\u65f6\uff0c\u6b64\u9009\u9879\u65e0\u6548\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\u3002\u5b83\u4f1a\u5728\u542f\u52a8\u548c\u5173\u95ed\u8fc7\u7a0b\u4e2d\u8f93\u51fa\u4e00\u4e9b\u989d\u5916\u6b65\u9aa4\uff1b\u5982\u679c\u540c\u65f6\u542f\u7528\u4e86\u8fdb\u5ea6\u62a5\u544a\uff0c\u8fd8\u4f1a\u663e\u793a\u5f53\u524d\u6b63\u5728\u5904\u7406\u7684\u786e\u5207\u6587\u4ef6\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--manifest-checksums=<em class=\"replaceable\"><code>algorithm</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u5e94\u7528\u5230\u5907\u4efd\u6e05\u5355\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u7684\u6821\u9a8c\u548c\u7b97\u6cd5\u3002\u76ee\u524d\u53ef\u7528\u7684\u7b97\u6cd5\u6709<code class=\"literal\">NONE</code>\u3001<code class=\"literal\">CRC32C</code>\u3001<code class=\"literal\">SHA224</code>\u3001<code class=\"literal\">SHA256</code>\u3001<code class=\"literal\">SHA384</code>\u548c<code class=\"literal\">SHA512</code>\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">CRC32C</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">NONE</code>\uff0c\u5907\u4efd\u6e05\u5355\u5c06\u4e0d\u5305\u542b\u4efb\u4f55\u6821\u9a8c\u548c\u3002\u5426\u5219\uff0c\u5b83\u5c06\u5305\u542b\u4f7f\u7528\u6307\u5b9a\u7b97\u6cd5\u4e3a\u5907\u4efd\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u8ba1\u7b97\u7684\u6821\u9a8c\u548c\u3002\u6b64\u5916\uff0c\u6e05\u5355\u59cb\u7ec8\u4f1a\u5305\u542b\u5176\u81ea\u8eab\u5185\u5bb9\u7684<code class=\"literal\">SHA256</code>\u6821\u9a8c\u548c\u3002<code class=\"literal\">SHA</code>\u7b97\u6cd5\u660e\u663e\u6bd4<code class=\"literal\">CRC32C</code>\u66f4\u8017\u8d39 CPU\uff0c\u56e0\u6b64\u9009\u62e9\u5176\u4e2d\u4e00\u79cd\u53ef\u80fd\u4f1a\u589e\u52a0\u5b8c\u6210\u5907\u4efd\u6240\u9700\u7684\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u5e0c\u671b\u9a8c\u8bc1\u5907\u4efd\u672a\u88ab\u7be1\u6539\u7684\u7528\u6237\uff0c\u4f7f\u7528 SHA hash \u51fd\u6570\u53ef\u4ee5\u4e3a\u6bcf\u4e2a\u6587\u4ef6\u63d0\u4f9b\u5177\u6709\u5bc6\u7801\u5b66\u5b89\u5168\u6027\u7684\u6458\u8981\uff1b\u800c CRC-32C \u7b97\u6cd5\u63d0\u4f9b\u7684\u6821\u9a8c\u548c\u8ba1\u7b97\u901f\u5ea6\u8981\u5feb\u5f97\u591a\uff0c\u867d\u7136\u5b83\u5f88\u9002\u5408\u53d1\u73b0\u7531\u4e8e\u610f\u5916\u6539\u52a8\u9020\u6210\u7684\u9519\u8bef\uff0c\u4f46\u5e76\u4e0d\u80fd\u62b5\u5fa1\u6076\u610f\u4fee\u6539\u3002\u8bf7\u6ce8\u610f\uff0c\u8981\u60f3\u5bf9\u80fd\u591f\u8bbf\u95ee\u5907\u4efd\u7684\u653b\u51fb\u8005\u5f62\u6210\u9632\u62a4\uff0c\u5907\u4efd\u6e05\u5355\u5c31\u9700\u8981\u5b89\u5168\u5730\u4fdd\u5b58\u5728\u5176\u4ed6\u5730\u65b9\uff0c\u6216\u8005\u4ee5\u5176\u4ed6\u65b9\u5f0f\u786e\u8ba4\u81ea\u5907\u4efd\u5b8c\u6210\u540e\u672a\u88ab\u4fee\u6539\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528<a class=\"xref\" href=\"/docs/18/app-pgverifybackup.html\" title=\"pg_verifybackup\"><span class=\"refentrytitle\"><span class=\"application\">pg_verifybackup</span></span></a>\u6839\u636e\u5907\u4efd\u6e05\u5355\u68c0\u67e5\u5907\u4efd\u7684\u5b8c\u6574\u6027\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--manifest-force-encode</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f3a\u5236\u5c06\u5907\u4efd\u6e05\u5355\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u540d\u7f16\u7801\u4e3a\u5341\u516d\u8fdb\u5236\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u5bf9\u975e UTF8 \u6587\u4ef6\u540d\u8fdb\u884c\u5341\u516d\u8fdb\u5236\u7f16\u7801\u3002\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u8bfb\u53d6\u5907\u4efd\u6e05\u5355\u6587\u4ef6\u7684\u5de5\u5177\u662f\u5426\u80fd\u6b63\u786e\u5904\u7406\u8fd9\u79cd\u60c5\u51b5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-estimate-size</code></span></dt>\n<dd>\n<p lang=\"zh\">\u7981\u6b62\u670d\u52a1\u5668\u4f30\u7b97\u5c06\u8981\u6d41\u5f0f\u4f20\u8f93\u7684\u5907\u4efd\u6570\u636e\u603b\u91cf\uff0c\u56e0\u6b64 pg_stat_progress_basebackup \u89c6\u56fe\u4e2d\u7684 backup_total \u5217\u59cb\u7ec8\u4e3a NULL\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5907\u4efd\u4f1a\u5148\u679a\u4e3e\u6574\u4e2a\u6570\u636e\u5e93\u7684\u5927\u5c0f\uff0c\u7136\u540e\u518d\u56de\u8fc7\u5934\u6765\u53d1\u9001\u5b9e\u9645\u5185\u5bb9\u3002\u8fd9\u53ef\u80fd\u4f1a\u8ba9\u5907\u4efd\u8017\u65f6\u7565\u957f\uff0c\u7279\u522b\u662f\u5728\u53d1\u9001\u7b2c\u4e00\u6279\u6570\u636e\u4e4b\u524d\u6240\u9700\u65f6\u95f4\u4f1a\u66f4\u4e45\u3002\u5982\u679c\u8fd9\u79cd\u4f30\u7b97\u8017\u65f6\u8fc7\u957f\uff0c\u6b64\u9009\u9879\u5c31\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u5b83\u53ef\u4ee5\u907f\u514d\u8fd9\u6bb5\u4f30\u7b97\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--progress</code>\u65f6\uff0c\u4e0d\u5141\u8bb8\u4f7f\u7528\u6b64\u9009\u9879\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-manifest</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7981\u6b62\u751f\u6210\u5907\u4efd\u6e05\u5355\u3002\u5982\u679c\u672a\u6307\u5b9a\u6b64\u9009\u9879\uff0c\u670d\u52a1\u5668\u5c06\u751f\u6210\u5e76\u53d1\u9001\u4e00\u4e2a\u5907\u4efd\u6e05\u5355\uff0c\u53ef\u4f7f\u7528<a class=\"xref\" href=\"/docs/18/app-pgverifybackup.html\" title=\"pg_verifybackup\"><span class=\"refentrytitle\"><span class=\"application\">pg_verifybackup</span></span></a>\u8fdb\u884c\u9a8c\u8bc1\u3002\u8be5\u6e05\u5355\u5217\u51fa\u4e86\u5907\u4efd\u4e2d\u7684\u6bcf\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u4e0d\u5305\u62ec\u53ef\u80fd\u5305\u542b\u5728\u5176\u4e2d\u7684\u4efb\u4f55 WAL \u6587\u4ef6\u3002\u5b83\u8fd8\u4f1a\u4fdd\u5b58\u6bcf\u4e2a\u6587\u4ef6\u7684\u5927\u5c0f\u3001\u6700\u540e\u4fee\u6539\u65f6\u95f4\u4ee5\u53ca\u53ef\u9009\u7684\u6821\u9a8c\u548c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-slot</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9632\u6b62\u4e3a\u5907\u4efd\u521b\u5efa\u4e34\u65f6\u590d\u5236\u69fd\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u9009\u62e9\u4e86 WAL \u6d41\u5f0f\u4f20\u8f93\uff0c\u4f46\u6ca1\u6709\u4f7f\u7528<code class=\"option\">-S</code>\u9009\u9879\u7ed9\u51fa\u69fd\u540d\uff0c\u90a3\u4e48\u4f1a\u521b\u5efa\u4e00\u4e2a\u4e34\u65f6\u590d\u5236\u69fd\uff08\u5982\u679c\u6e90\u670d\u52a1\u5668\u652f\u6301\uff09\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7684\u4e3b\u8981\u76ee\u7684\u662f\u5728\u670d\u52a1\u5668\u6ca1\u6709\u7a7a\u95f2\u590d\u5236\u69fd\u65f6\uff0c\u4ecd\u7136\u5141\u8bb8\u6267\u884c\u57fa\u7840\u5907\u4efd\u3002\u51e0\u4e4e\u603b\u662f\u9996\u9009\u4f7f\u7528\u590d\u5236\u69fd\uff0c\u56e0\u4e3a\u5b83\u80fd\u9632\u6b62\u670d\u52a1\u5668\u5728\u5907\u4efd\u671f\u95f4\u79fb\u9664\u6240\u9700\u7684 WAL\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-verify-checksums</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u83b7\u53d6\u57fa\u7840\u5907\u4efd\u7684\u670d\u52a1\u5668\u542f\u7528\u4e86\u6821\u9a8c\u548c\uff0c\u5219\u7981\u7528\u5bf9\u8fd9\u4e9b\u6821\u9a8c\u548c\u7684\u9a8c\u8bc1\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f1a\u9a8c\u8bc1\u6821\u9a8c\u548c\uff1b\u6821\u9a8c\u548c\u9a8c\u8bc1\u5931\u8d25\u5c06\u5bfc\u81f4\u975e\u96f6\u9000\u51fa\u72b6\u6001\u3002\u4e0d\u8fc7\uff0c\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u57fa\u7840\u5907\u4efd\u4e0d\u4f1a\u88ab\u5220\u9664\uff0c\u5c31\u50cf\u4f7f\u7528\u4e86<code class=\"option\">--no-clean</code>\u4e00\u6837\u3002\u6821\u9a8c\u548c\u9a8c\u8bc1\u5931\u8d25\u4e5f\u4f1a\u5728<a class=\"link\" href=\"/docs/18/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW\" title=\"27.2.17.\u00a0pg_stat_database\"><code class=\"structname\">pg_stat_database</code></a>\u89c6\u56fe\u4e2d\u62a5\u544a\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u547d\u4ee4\u884c\u9009\u9879\u63a7\u5236\u5230\u6e90\u670d\u52a1\u5668\u7684\u8fde\u63a5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>connstr</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>connstr</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ee5<a class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u7684\u5f62\u5f0f\u6307\u5b9a\u7528\u4e8e\u8fde\u63a5\u670d\u52a1\u5668\u7684\u53c2\u6570\uff1b\u8fd9\u4e9b\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u76f8\u4e92\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u51fa\u4e8e\u4e0e\u5176\u4ed6\u5ba2\u6237\u7aef\u5e94\u7528\u4fdd\u6301\u4e00\u81f4\u7684\u8003\u8651\uff0c\u6b64\u9009\u9879\u540d\u4e3a<code class=\"literal\">--dbname</code>\uff1b\u4f46\u7531\u4e8e<span class=\"application\">pg_basebackup</span>\u5e76\u4e0d\u8fde\u63a5\u5230\u96c6\u7c07\u4e2d\u7684\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u7684\u6570\u636e\u5e93\u540d\u4f1a\u88ab\u670d\u52a1\u5668\u5ffd\u7565\u3002\u4e0d\u8fc7\uff0c\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u63d0\u4f9b\u7684\u6570\u636e\u5e93\u540d\u4f1a\u8986\u76d6\u9ed8\u8ba4\u6570\u636e\u5e93\u540d\uff08<code class=\"literal\">replication</code>\uff09\uff0c\u4ece\u800c\u7528\u4e8e\u5728<code class=\"filename\">~/.pgpass</code>\u4e2d\u67e5\u627e\u590d\u5236\u8fde\u63a5\u7684\u5bc6\u7801\u3002\u7c7b\u4f3c\u5730\uff0c\u8fde\u63a5<span class=\"productname\">PostgreSQL</span>\u65f6\u4f7f\u7528\u7684\u4e2d\u95f4\u4ef6\u6216\u4ee3\u7406\uff0c\u4e5f\u53ef\u80fd\u51fa\u4e8e\u8fde\u63a5\u8def\u7531\u7b49\u76ee\u7684\u4f7f\u7528\u8be5\u540d\u79f0\u3002\u8be5\u6570\u636e\u5e93\u540d\u4e5f\u53ef\u4f9b<a class=\"link\" href=\"/docs/18/logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS-SYNCHRONIZATION\" title=\"47.2.3.\u00a0\u590d\u5236\u69fd\u540c\u6b65\">\u903b\u8f91\u590d\u5236\u69fd\u540c\u6b65</a>\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u8fd0\u884c\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea<code class=\"envar\">PGHOST</code>\u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff1b\u5426\u5219\u4f1a\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u6240\u4f7f\u7528\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u4f7f\u7528<code class=\"envar\">PGPORT</code>\u73af\u5883\u53d8\u91cf\u4e2d\u7684\u503c\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u786e\u5b9a\u7684\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s <em class=\"replaceable\"><code>interval</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--status-interval=<em class=\"replaceable\"><code>interval</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u53d1\u9001\u56de\u6e90\u670d\u52a1\u5668\u7684\u72b6\u6001\u5305\u4e4b\u95f4\u76f8\u9694\u7684\u79d2\u6570\u3002\u8f83\u5c0f\u7684\u503c\u53ef\u4ee5\u8ba9\u670d\u52a1\u5668\u7aef\u5bf9\u5907\u4efd\u8fdb\u5ea6\u7684\u76d1\u63a7\u66f4\u7cbe\u786e\u3002\u503c\u4e3a\u96f6\u65f6\u4f1a\u5b8c\u5168\u7981\u7528\u5468\u671f\u6027\u72b6\u6001\u66f4\u65b0\uff0c\u4e0d\u8fc7\u5f53\u670d\u52a1\u5668\u8bf7\u6c42\u65f6\u4ecd\u4f1a\u53d1\u9001\u66f4\u65b0\uff0c\u4ee5\u907f\u514d\u56e0\u8d85\u65f6\u800c\u65ad\u5f00\u8fde\u63a5\u3002\u9ed8\u8ba4\u503c\u662f 10 \u79d2\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7981\u6b62\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\uff08\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff09\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u6b64\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u79cd\u573a\u666f\u4e0b\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236<span class=\"application\">pg_basebackup</span>\u5728\u8fde\u63a5\u6e90\u670d\u52a1\u5668\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7edd\u975e\u5fc5\u9700\uff0c\u56e0\u4e3a\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u81ea\u52a8\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\u6765\u53d1\u73b0\u670d\u52a1\u5668\u9700\u8981\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u8f93\u5165<code class=\"option\">-W</code>\u4ee5\u907f\u514d\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u662f\u503c\u5f97\u7684\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5176\u4ed6\u9009\u9879\u4e5f\u53ef\u7528\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa<span class=\"application\">pg_basebackup</span>\u7684\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"application\">pg_basebackup</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6<span class=\"productname\">PostgreSQL</span>\u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528<span class=\"application\">libpq</span>\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.15\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\">\u73af\u5883\u53d8\u91cf<code class=\"envar\">PG_COLOR</code>\u6307\u5b9a\u662f\u5426\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a<code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c<code class=\"literal\">never</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u5728\u5907\u4efd\u5f00\u59cb\u65f6\uff0c\u9700\u8981\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u6267\u884c\u4e00\u6b21\u68c0\u67e5\u70b9\u3002\u8fd9\u53ef\u80fd\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\uff08\u5c24\u5176\u662f\u5728\u672a\u4f7f\u7528<code class=\"literal\">--checkpoint=fast</code>\u9009\u9879\u65f6\uff09\uff1b\u5728\u6b64\u671f\u95f4\uff0c<span class=\"application\">pg_basebackup</span>\u770b\u8d77\u6765\u4f1a\u5904\u4e8e\u7a7a\u95f2\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u5907\u4efd\u5c06\u5305\u62ec\u6570\u636e\u76ee\u5f55\u548c\u8868\u7a7a\u95f4\u4e2d\u7684\u6240\u6709\u6587\u4ef6\uff0c\u5305\u62ec\u914d\u7f6e\u6587\u4ef6\u4ee5\u53ca\u7b2c\u4e09\u65b9\u653e\u5728\u8fd9\u4e9b\u76ee\u5f55\u4e2d\u7684\u4efb\u4f55\u989d\u5916\u6587\u4ef6\uff0c\u4f46\u7531 PostgreSQL \u7ba1\u7406\u7684\u67d0\u4e9b\u4e34\u65f6\u6587\u4ef6\u548c\u64cd\u4f5c\u7cfb\u7edf\u6587\u4ef6\u9664\u5916\u3002\u4e0d\u8fc7\uff0c\u53ea\u6709\u666e\u901a\u6587\u4ef6\u548c\u76ee\u5f55\u4f1a\u88ab\u590d\u5236\uff0c\u4f46\u7528\u4e8e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u4f1a\u88ab\u4fdd\u7559\u3002\u6307\u5411 PostgreSQL \u5df2\u77e5\u7684\u67d0\u4e9b\u76ee\u5f55\u7684\u7b26\u53f7\u94fe\u63a5\u4f1a\u88ab\u590d\u5236\u4e3a\u7a7a\u76ee\u5f55\u3002\u5176\u4ed6\u7b26\u53f7\u94fe\u63a5\u548c\u7279\u6b8a\u8bbe\u5907\u6587\u4ef6\u5219\u4f1a\u88ab\u8df3\u8fc7\u3002\u5177\u4f53\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/18/protocol-replication.html\" title=\"54.4.\u00a0\u6d41\u590d\u5236\u534f\u8bae\">\u7b2c\u00a054.4\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5728\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u4e2d\uff0c\u9664\u975e\u4f7f\u7528\u4e86<code class=\"literal\">--tablespace-mapping</code>\u9009\u9879\uff0c\u5426\u5219\u8868\u7a7a\u95f4\u4f1a\u5907\u4efd\u5230\u5176\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u7684\u76f8\u540c\u8def\u5f84\u3002\u5982\u679c\u4e0d\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u90a3\u4e48\u5f53\u8868\u7a7a\u95f4\u6b63\u5728\u4f7f\u7528\u65f6\uff0c\u5c31\u65e0\u6cd5\u5728\u4e0e\u670d\u52a1\u5668\u76f8\u540c\u7684\u4e3b\u673a\u4e0a\u6267\u884c\u666e\u901a\u6587\u4ef6\u683c\u5f0f\u7684\u57fa\u7840\u5907\u4efd\uff0c\u56e0\u4e3a\u5907\u4efd\u5c06\u4e0d\u5f97\u4e0d\u5199\u5165\u4e0e\u539f\u59cb\u8868\u7a7a\u95f4\u76f8\u540c\u7684\u76ee\u5f55\u4f4d\u7f6e\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 tar \u683c\u5f0f\u65f6\uff0c\u7528\u6237\u9700\u8981\u5728\u542f\u52a8\u4f7f\u7528\u8fd9\u4e9b\u6570\u636e\u7684 PostgreSQL \u670d\u52a1\u5668\u4e4b\u524d\uff0c\u81ea\u884c\u89e3\u5f00\u6bcf\u4e2a tar \u6587\u4ef6\u3002\u5982\u679c\u5b58\u5728\u989d\u5916\u7684\u8868\u7a7a\u95f4\uff0c\u5fc5\u987b\u5c06\u5bf9\u5e94\u7684 tar \u6587\u4ef6\u89e3\u538b\u5230\u6b63\u786e\u4f4d\u7f6e\u3002\u6b64\u65f6\uff0c\u670d\u52a1\u5668\u4f1a\u6839\u636e base.tar \u4e2d tablespace_map \u6587\u4ef6\u7684\u5185\u5bb9\uff0c\u4e3a\u8fd9\u4e9b\u8868\u7a7a\u95f4\u521b\u5efa\u7b26\u53f7\u94fe\u63a5\u3002</p>\n<p lang=\"zh\">pg_basebackup \u53ef\u4e0e\u76f8\u540c\u6216\u66f4\u65e9\u4e3b\u8981\u7248\u672c\u7684\u670d\u52a1\u5668\u914d\u5408\u4f7f\u7528\uff0c\u6700\u4f4e\u652f\u6301 9.1\u3002\u4e0d\u8fc7\uff0cWAL \u6d41\u5f0f\u4f20\u8f93\u6a21\u5f0f\uff08-X stream\uff09\u53ea\u9002\u7528\u4e8e 9.3 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\uff0ctar \u683c\u5f0f\uff08--format=tar\uff09\u53ea\u9002\u7528\u4e8e 9.5 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\uff0c\u589e\u91cf\u5907\u4efd\uff08--incremental\uff09\u53ea\u9002\u7528\u4e8e 17 \u53ca\u66f4\u9ad8\u7248\u672c\u7684\u670d\u52a1\u5668\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6e90\u96c6\u7c07\u542f\u7528\u4e86\u6570\u636e\u6587\u4ef6\u7684\u7ec4\u6743\u9650\uff0c<span class=\"application\">pg_basebackup</span>\u4f1a\u4fdd\u7559\u8fd9\u4e9b\u7ec4\u6743\u9650\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.9\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u8981\u4e3a\u670d\u52a1\u5668<code class=\"literal\">mydbserver</code>\u521b\u5efa\u4e00\u4e2a\u57fa\u7840\u5907\u4efd\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5230\u672c\u5730\u76ee\u5f55<code class=\"filename\">/usr/local/pgsql/data</code>\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -h mydbserver -D /usr/local/pgsql/data</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u672c\u5730\u670d\u52a1\u5668\u521b\u5efa\u4e00\u4e2a\u5907\u4efd\uff0c\u4e3a\u6bcf\u4e2a\u8868\u7a7a\u95f4\u5404\u751f\u6210\u4e00\u4e2a\u538b\u7f29\u7684 tar \u6587\u4ef6\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5728\u76ee\u5f55<code class=\"filename\">backup</code>\u4e2d\uff0c\u540c\u65f6\u5728\u8fd0\u884c\u671f\u95f4\u663e\u793a\u8fdb\u5ea6\u62a5\u544a\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup -Ft -z -P</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u4e00\u4e2a\u4ec5\u5305\u542b\u5355\u4e2a\u8868\u7a7a\u95f4\u7684\u672c\u5730\u6570\u636e\u5e93\u521b\u5efa\u5907\u4efd\uff0c\u5e76\u4f7f\u7528<span class=\"productname\">bzip2</span>\u8fdb\u884c\u538b\u7f29\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D - -Ft -X fetch | bzip2 &gt; backup.tar.bz2</code></strong>\n</pre>\n<p lang=\"zh\">\uff08\u5982\u679c\u8be5\u6570\u636e\u5e93\u4e2d\u6709\u591a\u4e2a\u8868\u7a7a\u95f4\uff0c\u6b64\u547d\u4ee4\u5c06\u5931\u8d25\u3002\uff09</p>\n<p lang=\"zh\">\u8981\u521b\u5efa\u4e00\u4e2a\u672c\u5730\u6570\u636e\u5e93\u7684\u5907\u4efd\uff0c\u5e76\u5c06\u4f4d\u4e8e<code class=\"filename\">/opt/ts</code>\u4e2d\u7684\u8868\u7a7a\u95f4\u91cd\u5b9a\u4f4d\u5230<code class=\"filename\">./backup/ts</code>\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup/data -T /opt/ts=$(pwd)/backup/ts</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u4e3a\u672c\u5730\u670d\u52a1\u5668\u521b\u5efa\u4e00\u4e2a\u5907\u4efd\uff0c\u4e3a\u6bcf\u4e2a\u8868\u7a7a\u95f4\u751f\u6210\u4e00\u4e2a tar \u6587\u4ef6\uff0c\u5e76\u4f7f\u7528<span class=\"application\">gzip</span>\u4ee5 9 \u7ea7\u538b\u7f29\u540e\u5b58\u50a8\u5230\u76ee\u5f55<code class=\"filename\">backup</code>\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_basebackup -D backup -Ft --compress=gzip:9</code></strong>\n</pre>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.10\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/18/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/18/progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING\" title=\"27.4.6.\u00a0Base Backup Progress Reporting\">Section\u00a027.4.6</a></span>\n</div>\n</div></div>", "manual_path": "app-pgbasebackup.html", "localization": {"status": "complete", "sources": [{"url": "/docs/18/app-pgbasebackup.html", "method": "same-major semantic node", "sha256": "a703370a3d669288bd3b7a33c5fb4a2a2dd313310a93c6c7775c108f9e9e0327", "language": "zh", "matched_nodes": ["#APP-PGBASEBACKUP/div[2]/p[1]", "#APP-PGBASEBACKUP/div[3]/h2[0]", "#APP-PGBASEBACKUP/div[4]/div[8]/ul[0]/li[0]", "#APP-PGBASEBACKUP/div[4]/div[8]/ul[0]/li[1]", "#APP-PGBASEBACKUP/div[4]/div[8]/ul[0]/li[2]", "#APP-PGBASEBACKUP/div[4]/div[8]/ul[0]/li[3]", "#APP-PGBASEBACKUP/div[4]/p[1]", "#APP-PGBASEBACKUP/div[4]/p[2]", "#APP-PGBASEBACKUP/div[4]/p[3]", "#APP-PGBASEBACKUP/div[4]/p[4]", "#APP-PGBASEBACKUP/div[4]/p[5]", "#APP-PGBASEBACKUP/div[4]/p[6]", "#APP-PGBASEBACKUP/div[4]/p[7]", "#APP-PGBASEBACKUP/div[4]/p[9]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[11]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[13]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[3]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[5]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/div[2]/dl[0]/dd[5]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[15]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[17]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[19]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[19]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[19]/p[3]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[19]/p[4]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[1]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[3]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[7]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[7]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[2]/dl[0]/dd[9]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[15]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[17]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[17]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[17]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[19]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[21]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[21]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[21]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[21]/p[3]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[23]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[25]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[25]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[27]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[29]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[29]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[29]/p[2]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[31]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[31]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[7]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[7]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[4]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[11]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[13]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[13]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[1]/p[0]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[1]/p[1]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[5]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[7]", "#APP-PGBASEBACKUP/div[5]/div[6]/dl[0]/dd[9]", "#APP-PGBASEBACKUP/div[5]/div[8]/dl[0]/dd[1]", "#APP-PGBASEBACKUP/div[5]/div[8]/dl[0]/dd[3]", "#APP-PGBASEBACKUP/div[5]/p[1]", "#APP-PGBASEBACKUP/div[5]/p[3]", "#APP-PGBASEBACKUP/div[5]/p[5]", "#APP-PGBASEBACKUP/div[5]/p[7]", "#APP-PGBASEBACKUP/div[6]/h2[0]", "#APP-PGBASEBACKUP/div[6]/p[1]", "#APP-PGBASEBACKUP/div[6]/p[2]", "#APP-PGBASEBACKUP/div[7]/h2[0]", "#APP-PGBASEBACKUP/div[7]/p[1]", "#APP-PGBASEBACKUP/div[7]/p[2]", "#APP-PGBASEBACKUP/div[7]/p[3]", "#APP-PGBASEBACKUP/div[7]/p[6]", "#APP-PGBASEBACKUP/div[8]/h2[0]", "#APP-PGBASEBACKUP/div[8]/p[10]", "#APP-PGBASEBACKUP/div[8]/p[1]", "#APP-PGBASEBACKUP/div[8]/p[3]", "#APP-PGBASEBACKUP/div[8]/p[5]", "#APP-PGBASEBACKUP/div[8]/p[7]", "#APP-PGBASEBACKUP/div[8]/p[8]", "#APP-PGBASEBACKUP/div[9]/h2[0]"]}], "language": "zh", "original_text": {"/versions/18/description/0": "pg_basebackup \u2014 take a base backup of a PostgreSQL cluster", "/versions/18/facts/0/label": "Documented executable", "/versions/18/facts/1/label": "Executable version", "/versions/18/facts/2/label": "Reference inventory", "/versions/18/facts/2/value": "Client applications", "/versions/18/facts/3/label": "Option definition groups", "/versions/18/tables/0/title": "Documented options", "/versions/18/related/0/label": "libpq connection parameters", "/versions/18/tables/0/rows/0/summary": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty.", "/versions/18/tables/0/rows/1/summary": "Selects the format for the output. format can be one of the following:", "/versions/18/tables/0/rows/2/summary": "Performs an incremental backup . The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup.", "/versions/18/tables/0/rows/3/summary": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup.", "/versions/18/tables/0/rows/4/summary": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup.", "/versions/18/tables/0/rows/5/summary": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces.", "/versions/18/tables/0/rows/6/summary": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format.", "/versions/18/tables/0/rows/7/summary": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup.", "/versions/18/tables/0/rows/8/summary": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.", "/versions/18/tables/0/rows/9/summary": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch .", "/versions/18/tables/0/columns/0/label": "Option and arguments", "/versions/18/tables/0/columns/1/label": "Description", "/versions/18/tables/0/rows/10/summary": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 25.3.4 ).", "/versions/18/tables/0/rows/11/summary": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists.", "/versions/18/tables/0/rows/12/summary": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used.", "/versions/18/tables/0/rows/13/summary": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging.", "/versions/18/tables/0/rows/14/summary": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.", "/versions/18/tables/0/rows/15/summary": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.", "/versions/18/tables/0/rows/16/summary": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second.", "/versions/18/tables/0/rows/17/summary": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby.", "/versions/18/tables/0/rows/18/summary": "When set to fsync , which is the default, pg_basebackup will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace.", "/versions/18/tables/0/rows/19/summary": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.", "/versions/18/tables/0/rows/20/summary": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C .", "/versions/18/tables/0/rows/21/summary": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case.", "/versions/18/tables/0/rows/22/summary": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL .", "/versions/18/tables/0/rows/23/summary": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file.", "/versions/18/tables/0/rows/24/summary": "Prevents the creation of a temporary replication slot for the backup.", "/versions/18/tables/0/rows/25/summary": "Disables verification of checksums, if they are enabled on the server the base backup is taken from.", "/versions/18/tables/0/rows/26/summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "/versions/18/tables/0/rows/27/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "/versions/18/tables/0/rows/28/summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "/versions/18/tables/0/rows/29/summary": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds.", "/versions/18/tables/0/rows/30/summary": "Specifies the user name to connect as.", "/versions/18/tables/0/rows/31/summary": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/18/tables/0/rows/32/summary": "Forces pg_basebackup to prompt for a password before connecting to the source server.", "/versions/18/tables/0/rows/33/summary": "Prints the pg_basebackup version and exits.", "/versions/18/tables/0/rows/34/summary": "Shows help about pg_basebackup command line arguments, and exits."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "55343dccf452f10043bd73c75aa4d1e6dd8d9b76eb29b3ab36a07f131673fa0c"}, "comparison_data": {"options": [{"names": ["-D directory", "--pgdata= directory"], "signature": "-D directory --pgdata= directory", "description": "Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty. When the backup is in tar format, the target directory may be specified as - (dash), causing the tar file to be written to stdout . This option is required."}, {"names": ["-F format", "--format= format"], "signature": "-F format --format= format", "description": "Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the source server's data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory's contents will be written to a file named base.tar , and each other tablespace will be written to a separate tar file named after that tablespace's OID. If the target directory is specified as - (dash), the tar contents will be written to standard output, suitable for piping to (for example) gzip . This is only allowed if the cluster has no additional tablespaces and WAL streaming is not used."}, {"names": ["-i old_manifest_file", "--incremental= old_manifest_file"], "signature": "-i old_manifest_file --incremental= old_manifest_file", "description": "Performs an incremental backup . The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup."}, {"names": ["-R", "--write-recovery-conf"], "signature": "-R --write-recovery-conf", "description": "Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup. The postgresql.auto.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that streaming replication and logical replication slot synchronization will use the same settings later on. The dbname will be recorded only if the dbname was specified explicitly in the connection string or environment variable ."}, {"names": ["-t target", "--target= target"], "signature": "-t target --target= target", "description": "Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup. Since WAL streaming is implemented by pg_basebackup rather than by the server, this option cannot be used together with -Xstream . Since that is the default, when this option is specified, you must also specify either -Xfetch or -Xnone ."}, {"names": ["-T olddir = newdir", "--tablespace-mapping= olddir = newdir"], "signature": "-T olddir = newdir --tablespace-mapping= olddir = newdir", "description": "Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected."}, {"names": ["--waldir= waldir"], "signature": "--waldir= waldir", "description": "Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format."}, {"names": ["-X method", "--wal-method= method"], "signature": "-X method --wal-method= method", "description": "Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup. The following method s for collecting the write-ahead logs are supported: n none Don't include write-ahead logs in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the source server's wal_keep_size parameter to be set high enough that the required log data is not removed before the end of the backup. If the required log data has been recycled before it's time to transfer it, the backup will fail and be unusable. When tar format is used, the write-ahead log files will be included in the base.tar file. s stream Stream write-ahead log data while the backup is being taken. This method will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will require two replication connections not just one. As long as the client can keep up with the write-ahead log data, using this method requires no extra write-ahead logs to be saved on the source server. When tar format is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default."}, {"names": ["-z", "--gzip"], "signature": "-z --gzip", "description": "Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."}, {"names": ["-Z level", "-Z [{client|server}-] method [: detail ]", "--compress= level", "--compress=[{client|server}-] method [: detail ]"], "signature": "-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]", "description": "Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch . The compression method can be set to gzip , lz4 , zstd , none for no compression or an integer (no compression if 0, gzip if greater than 0). A compression detail string can optionally be specified. If the detail string is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form keyword or keyword=value . Currently, the supported keywords are level , long , and workers . The detail string cannot be used when the compression method is specified as a plain integer. If no compression level is specified, the default compression level will be used. If only a level is specified without mentioning an algorithm, gzip compression will be used if the level is greater than 0, and no compression will be used if the level is 0. When the tar format is used with gzip , lz4 , or zstd , the suffix .gz , .lz4 , or .zst , respectively, will be automatically added to all tar filenames. When the plain format is used, client-side compression may not be specified, but it is still possible to request server-side compression. If this is done, the server will compress the backup for transmission, and the client will decompress and extract it. When this option is used in combination with -Xstream , pg_wal.tar will be compressed using gzip if client-side gzip compression is selected, but will not be compressed if any other compression algorithm is selected, or if server-side compression is selected."}, {"names": ["-c {fast|spread}", "--checkpoint={fast|spread}"], "signature": "-c {fast|spread} --checkpoint={fast|spread}", "description": "Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 25.3.4 )."}, {"names": ["-C", "--create-slot"], "signature": "-C --create-slot", "description": "Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists."}, {"names": ["-l label", "--label= label"], "signature": "-l label --label= label", "description": "Sets the label for the backup. If none is specified, a default value of \u201c pg_basebackup base backup \u201d will be used."}, {"names": ["-n", "--no-clean"], "signature": "-n --no-clean", "description": "By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way."}, {"names": ["-N", "--no-sync"], "signature": "-N --no-sync", "description": "By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."}, {"names": ["-P", "--progress"], "signature": "-P --progress", "description": "Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL."}, {"names": ["-r rate", "--max-rate= rate"], "signature": "-r rate --max-rate= rate", "description": "Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch ."}, {"names": ["-S slotname", "--slot= slotname"], "signature": "-S slotname --slot= slotname", "description": "This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby. The specified replication slot has to exist unless the option -C is also used. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming."}, {"names": ["--sync-method= method"], "signature": "--sync-method= method", "description": "When set to fsync , which is the default, pg_basebackup will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace. On Linux, syncfs may be used instead to ask the operating system to synchronize the whole file system that contains the backup directory. When the plain format is used, pg_basebackup will also synchronize the file systems that contain the WAL files and each tablespace. See recovery_init_sync_method for information about the caveats to be aware of when using syncfs . This option has no effect when --no-sync is used."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."}, {"names": ["--manifest-checksums= algorithm"], "signature": "--manifest-checksums= algorithm", "description": "Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C . If NONE is selected, the backup manifest will not contain any checksums. Otherwise, it will contain a checksum of each file in the backup using the specified algorithm. In addition, the manifest will always contain a SHA256 checksum of its own contents. The SHA algorithms are significantly more CPU-intensive than CRC32C , so selecting one of them may increase the time required to complete the backup. Using a SHA hash function provides a cryptographically secure digest of each file for users who wish to verify that the backup has not been tampered with, while the CRC-32C algorithm provides a checksum that is much faster to calculate; it is good at catching errors due to accidental changes but is not resistant to malicious modifications. Note that, to be useful against an adversary who has access to the backup, the backup manifest would need to be stored securely elsewhere or otherwise verified not to have been modified since the backup was taken. pg_verifybackup can be used to check the integrity of a backup against the backup manifest."}, {"names": ["--manifest-force-encode"], "signature": "--manifest-force-encode", "description": "Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case."}, {"names": ["--no-estimate-size"], "signature": "--no-estimate-size", "description": "Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL . Without this option, the backup will start by enumerating the size of the entire database, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent. This option is useful to avoid such estimation time if it's too long. This option is not allowed when using --progress ."}, {"names": ["--no-manifest"], "signature": "--no-manifest", "description": "Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file."}, {"names": ["--no-slot"], "signature": "--no-slot", "description": "Prevents the creation of a temporary replication slot for the backup. By default, if log streaming is selected but no slot name is given with the -S option, then a temporary replication slot is created (if supported by the source server). The main purpose of this option is to allow taking a base backup when the server has no free replication slots. Using a replication slot is almost always preferred, because it prevents needed WAL from being removed by the server during the backup."}, {"names": ["--no-verify-checksums"], "signature": "--no-verify-checksums", "description": "Disables verification of checksums, if they are enabled on the server the base backup is taken from. By default, checksums are verified and checksum failures will result in a non-zero exit status. However, the base backup will not be removed in such a case, as if the --no-clean option had been used. Checksum verification failures will also be reported in the pg_stat_database view."}, {"names": ["-d connstr", "--dbname= connstr"], "signature": "-d connstr --dbname= connstr", "description": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. This option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, any database name included in the connection string will be ignored by the server. However, a database name supplied that way overrides the default database name ( replication ) for purposes of looking up the replication connection's password in ~/.pgpass . Similarly, middleware or proxies used in connecting to PostgreSQL might utilize the name for purposes such as connection routing. The database name can also be used by logical replication slot synchronization ."}, {"names": ["-h host", "--host= host"], "signature": "-h host --host= host", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-s interval", "--status-interval= interval"], "signature": "-s interval --status-interval= interval", "description": "Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Specifies the user name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Forces pg_basebackup to prompt for a password before connecting to the source server. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Prints the pg_basebackup version and exits."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Shows help about pg_basebackup command line arguments, and exits."}], "synopsis": ["pg_basebackup [ option ...]"], "environment": []}, "comparison_hash": "1355c21a25dc07b130a2e139c0430698018dbc37b620dff3f0f565fbaec56228", "manual_language": "zh"}, "comparison": {"left": "13", "right": "14", "status": "changed", "diff": "--- PostgreSQL 13\n+++ PostgreSQL 14\n@@ -65,7 +65,7 @@\n       \"signature\": \"-Z level --compress= level\"\n     },\n     {\n-      \"description\": \"Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 25.3.3 ).\",\n+      \"description\": \"Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 26.3.3 ).\",\n       \"names\": [\n         \"-c fast|spread\",\n         \"--checkpoint= fast|spread\""}}