Error: "Connection refused" when trying to connect to Supabase database
如果你无法连接到 Supabase 数据库,并且看到下面的某个错误,这可能是因为你的项目中有被封禁的 IP,这是 Fail2ban 造成的,当连续输入两次错误密码时,它就会启动。
🌐 If you're not able to connect to the Supabase database and see one of the errors below, this could be because there are banned IPs on your project caused by Fail2ban as it kicks in when attempting 2 wrong passwords in a row.
connect ECONNREFUSED 1.2.3.4:5432psql: error: connection to server at "db.xxxxxxxxxxxxxxxxxxxx.supabase.co" (1.2.3.4), port 5432 failed: Connection refusedIs the server running on that host and accepting TCP/IP connections?Circuit breaker open: Unable to establish connection to upstream database
这些封禁会在30分钟后解除,但你可以使用 Supabase CLI https://supabase.com/docs/guides/cli 根据以下命令解除 IP 封禁。
🌐 These bans will clear after 30mins but you can unban the IPs using the Supabase CLI https://supabase.com/docs/guides/cli following the commands below.
通过仪表板解封IP #
🌐 Unban IPs using the Dashboard
前往 数据库设置 并点击 解除 IP 封禁。
🌐 Go to Database Settings and click Unban IP.
使用命令行解封IP #
🌐 Unban IPs using the CLI
如何列出被禁止的IP:
🌐 How to list the banned IPs:
1% supabase network-bans get --project-ref <project_reference_id> --experimental如何解封这些IP:
🌐 How to unban the IPs:
1% supabase network-bans remove --db-unban-ip <ip_address> --project-ref <project_reference_id> --experimental