postgresql - Postgres 远程连接 - Windows 服务器
问题描述
我在pg_hba.conf
. Postgres 安装在 Windows 服务器上。
# TYPE DATABASE USER ADDRESS METHOD
# IPv4 local connections:
host all all 127.0.0.1/32 md5
#host all all myip md5
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
host replication all 127.0.0.1/32 md5
host replication all ::1/128 md5
我想只允许来自另外一个公共 IP 地址的连接。我怎样才能做到这一点?一旦我启用了上面的线路 IP: Postgres 就不会启动。
寻求一些指导。
解决方案
要打开端口 5432,请编辑您的/Program Files/PostgreSQL/10/data/postgresql.conf
并更改
# Connection Settings -
listen_addresses = '*' # what IP address(es) to listen on;
在/Program Files/PostgreSQL/10/data/pg_hba.conf
# IPv4 local connections:
host all all 0.0.0.0/0 md5
现在重述 Postgres 服务器使用 cmd
pg_ctl -D "C:\Program Files\PostgreSQL\10\data" restart
推荐阅读
- ios - SwiftUI 应用程序崩溃并出现“尝试将第 2 行插入第 0 节,但更新后第 0 节中只有 2 行”错误
- python - 使用 pandas 根据条件选择滞后行和当前行
- amazon-web-services - AWS Cognito:用户创建和用户名
- excel - Excel VBA - 如何根据丢失的工作表重命名工作表
- algorithm - 向后执行的 Fisher-Yates 洗牌的正确性
- python - 根据键更新嵌套字典中的值
- quarkus - 在 Java 16 下构建原生 Quarkus 镜像?
- android - 在 iOS 发布配置中反应原生自定义地图标记问题
- go - go-restful-openapi $refs must reference a valid location in the document
- video - iOS WKWebView 视频自动播放