{"Entry":{"collection":"guc","key":"primary_conninfo","name":"primary_conninfo","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Replication / Standby Servers","category_zh":"","changed_in":["13"],"changes":[{"documentation_changed":false,"fields":{},"from":"11","status":"added","to":"12"},{"documentation_changed":true,"fields":{"context":{"from":"postmaster","to":"sighup"}},"from":"12","status":"changed","to":"13"},{"documentation_changed":true,"fields":{},"from":"13","status":"changed","to":"14"},{"documentation_changed":true,"fields":{},"from":"16","status":"changed","to":"17"},{"documentation_changed":true,"fields":{},"from":"19","status":"changed","to":"20"}],"content_hash":"43f544d3805913e71228609f75820eb5c5535785c6f0af936fd251e84b3b14dd","context":"","default_changed_in":[],"default_history":[{"from":"12","to":"19","value":"Empty string"}],"editorial":{"advice":{"olap":"Read standbys and logical subscribers often see long queries or large transactions. Put explicit bounds on replay/apply and monitor lag, worker saturation, slot restart_lsn, and conflict cancellations.","oltp":"Size primary_conninfo from topology, failover roles, slot/subscription count, and reconnect headroom. Test worst-case primary latency, standby replay, and disk retention before production.","small":"Configure only replication capacity that is actually used. Even a small topology needs bounded timeouts and slot lifecycle; unlimited retention is not reliability."},"mechanism":["Sets the connection string to be used to connect to the sending server. A configuration reload applies a new value; existing work already in flight is not retroactively changed.","The WAL receiver uses this libpq connection string to reach an upstream sender. Reloading a changed nonempty value restarts the receiver; credentials should come from a protected passfile where possible, and slot synchronization additionally requires dbname.","Monitor and change primary_conninfo together with max_wal_senders, max_replication_slots, wal_level. Validate on the relevant server role and real workload, then use its sighup context to choose session change, reload, or restart; a historical boot default is not the current effective value."],"pitfalls":["Embedding a plaintext password in broadly readable configuration or process diagnostics.","Omitting dbname when slot synchronization needs it.","Changing upstream identity without coordinating timeline and slot state.","Changing it on the wrong primary, standby, sender, or subscriber role.","Watching only configured bytes/time instead of actual lag, slot position, and worker state."],"references":[{"title":"PostgreSQL 19 Beta 4: primary_conninfo","url":"https://www.postgresql.org/docs/19/runtime-config-replication.html#GUC-PRIMARY-CONNINFO"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["max_wal_senders","max_replication_slots","wal_level","wal_sender_timeout","max_slot_wal_keep_size","primary_slot_name"],"summary":"primary_conninfo sets the connection string to be used to connect to the sending server. It is a sighup setting present in PG12–18; the latest recorded boot default is empty."},"enumvals":[],"first_version":"12","group":"Replication","group_slug":"replication","imported_at":"2026-09-27T17:57:31.843406+08:00","intro_commit":{"authored_at":"2018-11-25T16:31:16+01:00","discussion":["https://www.postgresql.org/message-id/flat/607741529606767@web3g.yandex.ru/"],"hash":"2dedf4d9a899b36d1a8ed29be5efbd1b31a8fe85","subject":"Integrate recovery.conf into postgresql.conf","url":"https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=2dedf4d9a899b36d1a8ed29be5efbd1b31a8fe85"},"key":"primary_conninfo","last_version":"20","max_val":"","min_val":"","name":"primary_conninfo","position":316,"present_in":["12","13","14","15","16","17","18","19","20"],"short_desc":"Specifies a connection string to be used for the standby server to connect with a sending server.","short_desc_zh":"","source_rev":"english-manuals:2a388786d201e326bfb992c18bf509cdcb5206e31c9601def9cddbc9d7c43d1f","unit":"","vartype":"string"}},"Definition":{"Collection":"guc","Key":"primary_conninfo","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"primary_conninfo","SourceRevision":"english-manuals:2a388786d201e326bfb992c18bf509cdcb5206e31c9601def9cddbc9d7c43d1f","Facts":{"boot_val":"","category":"Replication / Standby Servers","context":"sighup","description":"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 Section 32.1.1. If any option is unspecified in this string, then the corresponding environment variable (see Section 32.15) is checked. If the environment variable is not set either, then defaults are used. 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 Section 26.2.5.1). A password needs to be provided too, if the sender demands password authentication. It can be provided in the primary_conninfo string, or in a separate ~/.pgpass file on the standby server (use replication as the database name). For replication slot synchronization (see Section 47.2.3), it is also necessary to specify a valid dbname in the primary_conninfo string. This will only be used for slot synchronization. It is ignored for streaming. This parameter can only be set in the postgresql.conf 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 primary_conninfo is an empty string). This setting has no effect if the server is not in standby mode.","doc":{"anchor":"GUC-PRIMARY-CONNINFO","file":"runtime-config-replication.html","lang":"en","sha256":"c78480a202f8579e2655e080060afe4859c9eb26a16318fb9099dabb178fb32d","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"primary_conninfo","short_desc":"Sets the connection string to be used to connect to the sending server.","source":"pg-settings-source-snapshot","unit":null,"vartype":"string"},"ManualEvidence":{"doc":{"anchor":"GUC-PRIMARY-CONNINFO","file":"runtime-config-replication.html","lang":"en","sha256":"c78480a202f8579e2655e080060afe4859c9eb26a16318fb9099dabb178fb32d","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"primary_conninfo","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"primary_conninfo","Summary":"","BodyHTML":"\u003cp\u003e指定备库用来连接发送服务器的连接字符串。这个字符串的格式在\u003ca href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" rel=\"nofollow\"\u003e第 32.1.1 节\u003c/a\u003e中描述。如果在这个字符串中有任何选项未被指定，那么将检查相应的环境变量（见\u003ca href=\"/docs/18/libpq-envars.html\" rel=\"nofollow\"\u003e第 32.15 节\u003c/a\u003e）。如果环境变量也没有被设置，则使用默认值。\u003c/p\u003e\u003cp\u003e连接字符串应当指定发送服务器的主机名（或地址），以及端口号（如果它与备库的默认端口不同）。还要指定发送服务器上具有适当权限的角色所对应的用户名（见\u003ca href=\"/docs/18/warm-standby.html#STREAMING-REPLICATION-AUTHENTICATION\" rel=\"nofollow\"\u003e第 26.2.5.1 节\u003c/a\u003e）。如果发送端要求密码认证，还需要提供密码。它既可以直接写在 \u003ccode\u003eprimary_conninfo\u003c/code\u003e 字符串中，也可以写在备库上的独立 \u003ccode\u003e~/.pgpass\u003c/code\u003e 文件中（数据库名使用 \u003ccode\u003ereplication\u003c/code\u003e）。\u003c/p\u003e\u003cp\u003e对于复制槽同步（见\u003ca href=\"/docs/18/logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS-SYNCHRONIZATION\" rel=\"nofollow\"\u003e第 47.2.3 节\u003c/a\u003e），还必须在 \u003ccode\u003eprimary_conninfo\u003c/code\u003e 字符串中指定有效的 \u003ccode\u003edbname\u003c/code\u003e。该设置只用于槽同步，对流式传输会被忽略。\u003c/p\u003e\u003cp\u003e这个参数只能在 \u003ccode\u003epostgresql.conf\u003c/code\u003e 文件或服务器命令行上设置。如果在 WAL 接收进程运行时修改该参数，则会向该进程发送信号使其关闭，并期望它使用新设置重新启动（除非 \u003ccode\u003eprimary_conninfo\u003c/code\u003e 是空字符串）。如果服务器没有处于备库模式，则此设置无效。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"7897dfb5cc332e24b568f017ea369966350a955820d3e59bc9a811e2cf88ffc9","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e指定备库用来连接发送服务器的连接字符串。这个字符串的格式在\u003ca href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. 连接字符串\"\u003e第 32.1.1 节\u003c/a\u003e中描述。如果在这个字符串中有任何选项未被指定，那么将检查相应的环境变量（见\u003ca href=\"/docs/18/libpq-envars.html\" title=\"32.15. 环境变量\"\u003e第 32.15 节\u003c/a\u003e）。如果环境变量也没有被设置，则使用默认值。\u003c/p\u003e\u003cp\u003e连接字符串应当指定发送服务器的主机名（或地址），以及端口号（如果它与备库的默认端口不同）。还要指定发送服务器上具有适当权限的角色所对应的用户名（见\u003ca href=\"/docs/18/warm-standby.html#STREAMING-REPLICATION-AUTHENTICATION\" title=\"26.2.5.1. 认证\"\u003e第 26.2.5.1 节\u003c/a\u003e）。如果发送端要求密码认证，还需要提供密码。它既可以直接写在 \u003ccode class=\"varname\"\u003eprimary_conninfo\u003c/code\u003e 字符串中，也可以写在备库上的独立 \u003ccode class=\"filename\"\u003e~/.pgpass\u003c/code\u003e 文件中（数据库名使用 \u003ccode class=\"literal\"\u003ereplication\u003c/code\u003e）。\u003c/p\u003e\u003cp\u003e对于复制槽同步（见\u003ca href=\"/docs/18/logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS-SYNCHRONIZATION\" title=\"47.2.3. 复制槽同步\"\u003e第 47.2.3 节\u003c/a\u003e），还必须在 \u003ccode class=\"varname\"\u003eprimary_conninfo\u003c/code\u003e 字符串中指定有效的 \u003ccode class=\"literal\"\u003edbname\u003c/code\u003e。该设置只用于槽同步，对流式传输会被忽略。\u003c/p\u003e\u003cp\u003e这个参数只能在 \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e 文件或服务器命令行上设置。如果在 WAL 接收进程运行时修改该参数，则会向该进程发送信号使其关闭，并期望它使用新设置重新启动（除非 \u003ccode class=\"varname\"\u003eprimary_conninfo\u003c/code\u003e 是空字符串）。如果服务器没有处于备库模式，则此设置无效。\u003c/p\u003e","doc_same_as":""}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["12","13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
