Ale*_*lex 7 virtualbox postgresql vagrant
我在 vagrant 创建的虚拟机中有一个 postgresql 服务器。
我还通过 Vagrant 文件设置了从盒子内的 5432 到主机系统上的 15432 的端口转发。
通过连接时 psql
$ psql dbname username -h 127.0.0.1 -p 15432
psql: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
Run Code Online (Sandbox Code Playgroud)
服务器和客户端都运行 Ubuntu 12.04(postgresql-9.1,版本:9.1+129ubuntu1)
在虚拟机内部连接到端口 5432 工作正常。
自行转发的端口似乎并没有完全出错,因为当我尝试到另一个端口时,我得到“连接被拒绝”)
小智 7
您是否将 Postgres 配置为在公共接口上侦听?默认情况下,它仅在环回适配器上侦听
如果您使用 Postgres 说明书,则需要设置属性:
set['postgresql']['config']['listen_addresses'] = '*'
Run Code Online (Sandbox Code Playgroud)
这对应于 postgresql.conf 中的 listen_addresses 参数
并且可能向 Postgres 认为您的连接正在进入的网络打开 pg_hba:
同样,Chef 属性:
set['postgresql']['pg_hba'] = [
{:type => 'local', :db => 'all', :user => 'all', :addr => nil, :method => 'trust'},
{:type => 'host', :db => 'all', :user => 'all', :addr => '127.0.0.1/32', :method => 'trust'},
{:type => 'host', :db => 'all', :user => 'all', :addr => '10.0.0.0/16', :method => 'trust'}
]
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
6919 次 |
最近记录: |