Postgresql 中文操作指南

F.5. basebackup_to_shell — example "shell" pg_basebackup module #

basebackup_to_shell يضيف هدف النسخ الاحتياطي الأساسي المخصص الذي يسمى shell . هذا يجعل من الممكن تشغيل pg_basebackup --target=shell أو، وفقًا لكيفية تكوين هذه الوحدة النمطية، pg_basebackup --target=shell:_DETAIL_STRING_ ، ويؤدي إلى تنفيذ أمر خادم اختاره مسؤول الخادم لكل أرشيف مضغوط تم إنشاؤه بواسطة عملية النسخ الاحتياطي. سيتلقى الأمر محتويات الأرشيف عبر الإدخال القياسي.

basebackup_to_shell adds a custom basebackup target called shell. This makes it possible to run pg_basebackup --target=shell or, depending on how this module is configured, pg_basebackup --target=shell:_DETAIL_STRING_, and cause a server command chosen by the server administrator to be executed for each tar archive generated by the backup process. The command will receive the contents of the archive via standard input.

本模块主要作为如何在扩展模块中创建新的备份目标的示例,但在某些情况下,它本身可能会很有用。为了运行,此模块必须通过 shared_preload_librarieslocal_preload_libraries 加载。

This module is primarily intended as an example of how to create a new backup targets via an extension module, but in some scenarios it may be useful for its own sake. In order to function, this module must be loaded via shared_preload_libraries or local_preload_libraries.

F.5.1. Configuration Parameters #

  • basebackup_to_shell.command (string)

    • The command which the server should execute for each archive generated by the backup process. If %f occurs in the command string, it will be replaced by the name of the archive (e.g. base.tar). If %d occurs in the command string, it will be replaced by the target detail provided by the user. A target detail is required if %d is used in the command string, and prohibited otherwise. For security reasons, it may contain only alphanumeric characters. If %% occurs in the command string, it will be replaced by a single %. If % occurs in the command string followed by any other character or at the end of the string, an error occurs.

  • basebackup_to_shell.required_role (string)

    • The role required in order to make use of the shell backup target. If this is not set, any replication user may make use of the shell backup target.