Skip to content
Platform

专用 IPv4 入站地址

Attach an IPv4 address to your database

Supabase 的 IPv4 附加组件为你的 Postgres 数据库连接提供了一个专用的 IPv4 地址。你可以在 附加组件设置 中进行配置。

🌐 The Supabase IPv4 add-on provides a dedicated IPv4 address for your Postgres database connection. It can be configured in the Add-ons Settings.

了解IP地址 #

🌐 Understanding IP addresses

互联网协议(IP)为互联网上的设备分配地址。主要有两个版本:

🌐 The Internet Protocol (IP) addresses devices on the internet. There are two main versions:

  • IPv4:较旧的版本,地址空间有限。
  • IPv6:更新的版本,提供更大的地址空间,是面向未来的选择。

当你需要 IPv4 附加组件时: #

🌐 When you need the IPv4 add-on:

  • 在不兼容 IPv6 的网络中直接使用连接字符串,而不是使用 Supavisor 或客户端库时。
  • 当你需要为你的直接连接字符串分配一个专用IP地址时

启用 IPv4 插件 #

🌐 Enabling the IPv4 add-on

你可以在你项目的附加组件设置中启用 IPv4 附加组件。

🌐 You can enable the IPv4 add-on in your project's add-ons settings.

你也可以使用管理 API 来管理 IPv4 附加组件:

🌐 You can also manage the IPv4 add-on using the Management API:

1
# Get your access token from https://supabase.com/dashboard/account/tokens
2
export SUPABASE_ACCESS_TOKEN="your-access-token"
3
export PROJECT_REF="your-project-ref"
4
5
# Get current IPv4 add-on status
6
curl -X GET "https://api.supabase.com/v1/projects/$PROJECT_REF/billing/addons" \
7
-H "Authorization: Bearer $SUPABASE_ACCESS_TOKEN"
8
9
# Enable IPv4 add-on
10
curl -X PATCH "https://api.supabase.com/v1/projects/$PROJECT_REF/billing/addons" \
11
-H "Authorization: Bearer $SUPABASE_ACCESS_TOKEN" \
12
-H "Content-Type: application/json" \
13
-d '{
14
"addon_variant": "ipv4_default",
15
"addon_type": "ipv4"
16
}'
17
18
# Disable IPv4 add-on
19
curl -X DELETE "https://api.supabase.com/v1/projects/$PROJECT_REF/billing/addons/ipv4_default" \
20
-H "Authorization: Bearer $SUPABASE_ACCESS_TOKEN"

只读副本和 IPv4 附加功能 #

🌐 Read replicas and IPv4 add-on

使用这个插件时,每个数据库(包括只读副本)都会分配一个 IPv4 地址。每增加一个副本,IPv4 的总费用也会增加。

🌐 When using the add-on, each database (including read replicas) receives an IPv4 address. Each replica adds to the total IPv4 cost.

变更和更新 #

🌐 Changes and updates

  • 虽然 IPv4 地址通常保持不变,但像暂停/恢复项目或启用/禁用插件这样的操作可能会导致新的 IPv4 地址出现。

Supabase 和 IPv6 兼容性 #

🌐 Supabase and IPv6 compatibility

默认情况下,Supabase Postgres 使用 IPv6 地址。如果你的系统不支持 IPv6,你有以下几个选择:

🌐 By default, Supabase Postgres use IPv6 addresses. If your system doesn't support IPv6, you have the following options:

  1. Supavisor 连接字符串:Supavisor 连接字符串是与 IPv4 兼容的直接连接替代方案
  2. Supabase 客户端库:这些库兼容 IPv4
  3. 专用 IPv4 附加功能(专业计划及以上):要获得保证的 IPv4 和用于直接连接的静态数据库地址,请启用此付费附加功能。

正在检查你的网络是否支持IPv6 #

🌐 Checking your network IPv6 support

你可以在 https://ipv6test.google.com/ 检查你的个人网络是否支持 IPv6。

🌐 You can check if your personal network is IPv6 compatible at https://ipv6test.google.com/.

检查平台是否支持IPv6: #

🌐 Checking platforms for IPv6 support:

大多数服务都兼容IPv6。不过,有一些主要服务只接受IPv4连接:

🌐 The majority of services are IPv6 compatible. However, there are a few prominent ones that only accept IPv4 connections:

查找你的数据库 IP 地址 #

🌐 Finding your database's IP address

使用 IP 查询网站或这个命令(替换 <PROJECT_REF>):

🌐 Use an IP lookup website or this command (replace <PROJECT_REF>):

1
nslookup db.<PROJECT_REF>.supabase.co

识别你的人脉 #

🌐 Identifying your connections

连接池和直接连接字符串可以在项目连接页面找到:

🌐 The pooler and direct connection strings can be found in the project connect page:

直接连接 #

🌐 Direct connection

除非启用了 IPv4 附加功能,否则使用 IPv6

🌐 IPv6 unless IPv4 Add-On is enabled

1
# Example direct connection string
2
postgresql://postgres:[YOUR-PASSWORD]@db.ajrbwkcuthywfihaarmflo.supabase.co:5432/postgres

交易模式下的Supavisor(端口6543) #

🌐 Supavisor in transaction mode (port 6543)

总是使用 IPv4 地址

🌐 Always uses an IPv4 address

1
# Example transaction string
2
postgresql://postgres.ajrbwkcuthywddfihrmflo:[YOUR-PASSWORD]@aws-0-us-east-1.pooler.supabase.com:6543/postgres

Supavisor 正在会话模式(端口 5432) #

🌐 Supavisor in session mode (port 5432)

总是使用 IPv4 地址

🌐 Always uses an IPv4 address

1
# Example session string
2
postgresql://postgres.ajrbwkcuthywfddihrmflo:[YOUR-PASSWORD]@aws-0-us-east-1.pooler.supabase.com:5432/postgres

价格 #

🌐 Pricing

有关费用是如何计算的详细分解,请参阅 管理 IPv4 使用

🌐 For a detailed breakdown of how charges are calculated, refer to Manage IPv4 usage.