【发布时间】:2017-11-05 23:23:19
【问题描述】:
我正在我的主机 (Mac OS) 中运行一个 postgresql 实例。我可以使用 Spring Boot 应用程序中的 localhost 属性通过 JDBC 访问此实例
现在我安装了一个来宾 Ubuntu Virtual Box OS。我想从这个操作系统安装相同的实例。
所以我只是将同一应用程序的数据源 url 从 localhost 更改为主机 ip 和 port 。 但是现在当我部署应用程序并尝试运行它时,我收到“连接被拒绝”错误。
从来宾操作系统 (10.0.2.2 5432) Telnet 到主机操作系统工作正常。
我的 pg_hba.conf 文件中的内容
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres md5
#host replication postgres 127.0.0.1/32 md5
#host replication postgres ::1/128 md5
host all all 0.0.0.0/0 md5
host all all ::/0 md5
我的 postgresql.conf 中的连接和身份验证内容
#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------
# - Connection Settings -
listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all
# (change requires restart)
port = 5432 # (change requires restart)
max_connections = 100 # (change requires restart)
#superuser_reserved_connections = 3 # (change requires restart)
#unix_socket_directories = '/tmp' # comma-separated list of directories
# (change requires restart)
#unix_socket_group = '' # (change requires restart)
#unix_socket_permissions = 0777 # begin with 0 to use octal notation
# (change requires restart)
#bonjour = off # advertise server via Bonjour
# (change requires restart)
#bonjour_name = '' # defaults to the computer name
# (change requires restart)
所以我已经将我的 postgrsql 实例配置为接受来自任何 IP 的连接。
我在防火墙后面。
可能我还缺少一些东西
最好的问候, 索拉夫
【问题讨论】:
标签: postgresql