↑↓ 选择↵ 打开⌫ 切换范围完整搜索

PG.CENTER 连接 PostgreSQL 文档、百科与生态知识。由 Pigsty 维护。

Wiki / 配置参数

primary_conninfo

指定备库用来连接发送服务器的连接字符串。这个字符串的格式在第 32.1.1 节中描述。如果在这个字符串中有任何选项未被指定,那么将检查相应的环境变量(见第 32.15 节)。如果环境变量也没有被设置,则使用默认值。 连接字符串应当指定发送服务器的主机名(或地址),以及端口号(如果它与备库的默认端口不同)。还要指定发送服务器上具有适当权限的角色所对应的用户名(见第 26.2.5.1 节)。如果发送端要求密码认证,还需要提供密码。它既可以直接写在 primary_conninfo 字符串中,也可以写在备库上的独立 ~/.pgpass 文件中(数据库名使用 replication)。 对于复制槽同步(见第 47.2.3 节),还必须在 primary_conninfo 字符串中指定有效的 dbname。该设置只用于槽同步,对流式传输会被忽略。 这个参数只能在 postgresql.conf 文件或服务器命令行上设置。如果在 WAL 接收进程运行时修改该参数,则会向该进程发送信号使其关闭,并期望它使用新设置重新启动(除非 primary_conninfo 是空字符串)。如果服务器没有处于备库模式,则此设置无效。

英文手册覆盖始于 PostgreSQL 7.4. 来源历史与运行验证各自保留独立版本边界。

当前阅读 PG 19·选择有来源记录的版本

boot val
未知
category
Replication / Standby Servers
context
sighup
doc same as
未知
documented
true
enumvals
未知
extra desc
未知
lang
en
max val
未知
metadata version
19beta4
min val
未知
name
primary_conninfo
short desc
Sets the connection string to be used to connect to the sending server.
source
pg-settings-source-snapshot
unit
未知
vartype
string

版本定义 PG 19

指定备库用来连接发送服务器的连接字符串。这个字符串的格式在第 32.1.1 节中描述。如果在这个字符串中有任何选项未被指定,那么将检查相应的环境变量(见第 32.15 节)。如果环境变量也没有被设置,则使用默认值。

连接字符串应当指定发送服务器的主机名(或地址),以及端口号(如果它与备库的默认端口不同)。还要指定发送服务器上具有适当权限的角色所对应的用户名(见第 26.2.5.1 节)。如果发送端要求密码认证,还需要提供密码。它既可以直接写在 primary_conninfo 字符串中,也可以写在备库上的独立 ~/.pgpass 文件中(数据库名使用 replication)。

对于复制槽同步(见第 47.2.3 节),还必须在 primary_conninfo 字符串中指定有效的 dbname。该设置只用于槽同步,对流式传输会被忽略。

这个参数只能在 postgresql.conf 文件或服务器命令行上设置。如果在 WAL 接收进程运行时修改该参数,则会向该进程发送信号使其关闭,并期望它使用新设置重新启动(除非 primary_conninfo 是空字符串)。如果服务器没有处于备库模式,则此设置无效。

比较版本

完整来源事实

doc html

<p>
          Specifies a connection string to be used for the standby server
          to connect with a sending server. This string is in the format
          described in <a class="xref" href="/docs/19/libpq-connect.html#LIBPQ-CONNSTRING" title="32.1.1. Connection Strings">Section 32.1.1</a>. If any option is
          unspecified in this string, then the corresponding environment
          variable (see <a class="xref" href="/docs/19/libpq-envars.html" title="32.15. Environment Variables">Section 32.15</a>) is checked. If the
          environment variable is not set either, then
          defaults are used.
         </p><p>
          The connection string should specify the host name (or address)
          of the sending server, as well as the port number if it is not
          the same as the standby server's default.
          Also specify a user name corresponding to a suitably-privileged role
          on the sending server (see
          <a class="xref" href="/docs/19/warm-standby.html#STREAMING-REPLICATION-AUTHENTICATION" title="26.2.5.1. Authentication">Section 26.2.5.1</a>).
          A password needs to be provided too, if the sender demands password
          authentication.  It can be provided in the
          <code class="varname">primary_conninfo</code> string, or in a separate
          <code class="filename">~/.pgpass</code> file on the standby server (use
          <code class="literal">replication</code> as the database name).
         </p><p>
          For replication slot synchronization (see
          <a class="xref" href="/docs/19/logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS-SYNCHRONIZATION" title="47.2.3. Replication Slot Synchronization">Section 47.2.3</a>),
          it is also necessary to specify a valid <code class="literal">dbname</code>
          in the <code class="varname">primary_conninfo</code> string. This will only be
          used for slot synchronization. It is ignored for streaming.
         </p><p>
          This parameter can only be set in the <code class="filename">postgresql.conf</code>
          file or on the server command line.
          If this parameter is changed while the WAL receiver process is
          running, that process is signaled to shut down and expected to
          restart with the new setting (except if <code class="varname">primary_conninfo</code>
          is an empty string).
          This setting has no effect if the server is not in standby mode.
         </p>

documentation revision

{"inputs":[{"file":"runtime-config-replication.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"76b3c1615af7dd60d031cefd485568e6336b3d13c366e8a473304bd7ef2fb92d","version":"19rc2"},{"file":"runtime-config-replication.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"935f29b71e863329c3c39caae902de37d5bbf03c2adcf42322225d3cefe71a84","version":"19rc2"}],"release":"19rc2","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"}

来源引用

完整定义与证据 JSON

定义来源

center · PostgreSQL 19 · wiki-repair-20261023:40f3549855cbfff7f053a2ef23c344ea0d6f89072e7478e2af30512583985f68

正文语言: zh-Hans · wiki-repair-20261023:40f3549855cbfff7f053a2ef23c344ea0d6f89072e7478e2af30512583985f68