Skip to content

Postgres 凭据#

¥Postgres credentials

你可以使用以下凭据验证以下节点:

¥You can use these credentials to authenticate the following nodes:

¥Agent

¥PGVector Vector Store

Agent node users

代理节点不支持 SSH 隧道。

¥The Agent node doesn't support SSH tunnels.

先决条件#

¥Prerequisites

创建用户帐号 在 Postgres 服务器上运行。

¥Create a user account on a Postgres server.

支持的身份验证方法#

¥Supported authentication methods

  • 数据库连接

¥Database connection

相关资源#

¥Related resources

有关服务的更多信息,请参阅 Postgres 文档

¥Refer to Postgres's documentation for more information about the service.

使用数据库连接#

¥Using database connection

要配置此凭据,你需要:

¥To configure this credential, you'll need:

  • 服务器的主机名或域名。

¥The Host or domain name for the server.

  • 数据库名称。

¥The Database name.

  • 用户名

¥A User name.

  • 用户密码。

¥A user Password.

  • 忽略 SSL 问题:设置 SSL 验证失败时是否使用凭据连接。

¥Ignore SSL Issues: Set whether the credential connects if SSL validation fails.

  • SSL:选择是否在连接中使用 SSL。

¥SSL: Choose whether to use SSL in your connection.

  • 用于连接的端口号。

¥The Port number to use for the connection.

  • SSH 隧道:选择是否使用 SSH 加密与 Postgres 服务器的网络连接。

¥SSH Tunnel: Choose if you want to use SSH to encrypt the network connection with the Postgres server.

要设置数据库连接:

¥To set up the database connection:

  1. 输入 Postgres 服务器的主机名或域名。你可以运行 /conninfo 命令来确认主机名,或者运行以下查询:

¥Enter the Host or domain name for the Postgres server. You can either run the /conninfo command to confirm the host name or run this query:

1
SELECT inet_server_addr();
  1. 输入数据库名称。运行 /conninfo 命令以确认数据库名称。

¥Enter the Database name. Run the /conninfo command to confirm the database name.

  1. 输入你要连接的用户的用户名。

¥Enter the User name of the user you wish to connect as.

  1. 请输入用户密码。

¥Enter the user's Password.

  1. 忽略 SSL 问题:启用此选项后,即使 SSL 验证失败,凭据仍会连接。

¥Ignore SSL Issues: If you turn this on, the credential will connect even if SSL validation fails.

  1. SSL:选择是否在连接中使用 SSL。有关更多信息,请参阅 Postgres 的 SSL 支持 文档。选项包括:

¥SSL: Choose whether to use SSL in your connection. Refer to Postgres SSL Support for more information. Options include:

  • 允许:将 ssl-mode 参数设置为 allow。首先尝试非 SSL 连接;如果失败,请尝试 SSL 连接。

    ¥Allow: Sets the ssl-mode parameter to allow. First try a non-SSL connection; if that fails, try an SSL connection.

  • 禁用:将 ssl-mode 参数设置为 disable。仅尝试非 SSL 连接。

    ¥Disable: Sets the ssl-mode parameter to disable. Only try a non-SSL connection.

  • 必填:将 ssl-mode 参数设置为 require。仅尝试 SSL 连接。如果存在根 CA 文件,请验证服务器证书是否由受信任的证书颁发机构 (CA) 颁发。

    ¥Require: Sets the ssl-mode parameter to require. Only try an SSL connection. If a root CA file is present, verify that a trusted certificate authority (CA) issued the server certificate.

  1. 输入用于连接的端口号。你可以运行 /conninfo 命令来确认主机名,或者运行以下查询:

¥Enter the Port number to use for the connection. You can either run the /conninfo command to confirm the host name or run this query:

1
SELECT inet_server_port();
  1. SSH 隧道:启用此设置可通过 SSH 连接到数据库。有关使用 SSH 的一些指导,请参阅 SSH 隧道限制。启用后,你需要:

¥SSH Tunnel: Turn this setting on to connect to the database over SSH. Refer to SSH tunnel limitations for some guidance around using SSH. Once turned on, you'll need: 1. 选择“SSH 身份验证”以设置要构建的 SSH 隧道类型:

1
2
3
4
5
6
7
8
9
  ¥Select **SSH Authenticate with** to set the SSH Tunnel type to build:

  * 如果你想使用密码连接到 SSH,请选择“密码”。

    ¥Select **Password** if you want to connect to SSH using a password.

  * 如果你想使用身份文件(私钥)和密码短语连接到 SSH,请选择“私钥”。

    ¥Select **Private Key** if you want to connect to SSH using an identity file (private key) and a passphrase.
  1. 输入要连接的远程绑定地址(作为 SSH 主机)。

    ¥Enter the remote bind address you're connecting to as the SSH Host. 3. SSH 端口:输入 SSH 隧道的本地端口号。

    ¥SSH Port: Enter the local port number for the SSH tunnel. 4. SSH Postgres 端口:输入隧道的远程端,即数据库服务器使用的端口号。

    ¥SSH Postgres Port: Enter the remote end of the tunnel, the port number the database server is using. 5. SSH 用户:输入要登录的用户名。

    ¥SSH User: Enter the username to log in as. 6. 如果你选择“SSH 身份验证密码”,请添加用户的 SSH 密码。

    ¥If you selected Password for SSH Authenticate with, add the user's SSH Password. 7. 如果你选择“SSH 身份验证私钥”:

    ¥If you selected Private Key for SSH Authenticate with: 1. 添加用于 SSH 的私钥或身份文件的内容。

    1
     ¥Add the contents of the **Private Key** or identity file used for SSH.
    
    1. 如果私钥是在创建时设置了密码的,请输入该密码。如果私钥没有密码,请将此字段留空。

      ¥If the Private Key was created with a passphrase, enter that Passphrase. If the Private Key has no passphrase, leave this field blank.

有关更多信息,请参阅 使用 SSH 隧道保护 TCP/IP 连接

¥Refer to Secure TCP/IP Connections with SSH Tunnels for more information.

SSH 隧道限制#

¥SSH tunnel limitations

仅在以下情况下使用 SSH 隧道设置:

¥Only use the SSH Tunnel setting if:

  • 你正在将凭据与 Postgres 节点一起使用(代理节点不支持 SSH 隧道)。

¥You're using the credential with the Postgres node (Agent node doesn't support SSH tunnels).

  • 你的 SSH 服务器与 Postgres 服务器运行在同一台机器上。

¥You have an SSH server running on the same machine as the Postgres server.

  • 你拥有一个可以使用 ssh 登录的用户账户。

¥You have a user account that can log in using ssh.