我在 nginx 和 gunicorn 上有一个工作的 Django 站点,转储数据库的正确方法是什么?我是否需要禁用nginx,我只是尝试转储错误,无法连接到服务器:
pg_dump: [archiver (db)] connection to database "mydb" failed: could not connect to server: Connection refused
Is the server running on host "0.0.0.0" and accepting
TCP/IP connections on port 5432?
而不是 0.0.0.0 我的 ip。怎么做才对?提前致谢!
首先,检查 postgresql.conf 指令
listen_addresses。默认情况下,它包含值 'localhost',因此无法在 127.0.0.1 以外的地址连接到 DBMS。如有必要,请更改它。其次,pg_hba.conf需要允许网络连接。更改这两个设置后,必须重新启动 DBMS。