postgresql을 사용하여 Vagrant 가상 시스템을 통해이를 내 레일 데이터베이스로 사용하고 싶습니다.Vagranted 가상 머신에서 postgresql에 액세스하는 방법은 무엇입니까?
내가 비슷한 Vagrantfile 사용
Vagrant.configure("2") do |config|
config.vm.network :private_network, ip: "192.168.33.18"
config.vm.provision :chef_solo do |chef|
# I take cookbook from https://github.com/opscode-cookbooks/postgresql
chef.add_recipe "postgresql::server"
chef.json = {
postgresql: {
config: {
ssl: false,
listen_addresses: '*'
},
password: {
postgres: 'postgres'
}
}
}
end
end
다음으로 vagrant up
을하고 다음 database.yml
이 일을 할 것으로 기대 :
development:
database: app_development
adapter: postgresql
host: '192.168.33.18'
username: root
그러나 이런 일이되지 않았습니다 .. 레이크 작업이 오류와 함께 실패 :
could not connect to server: Connection refused
Is the server running on host "192.168.33.18" and accepting
TCP/IP connections on port 5432?
그리고 실제로 포트가 열리지 않은 것을 볼 수 있습니다.
$ nmap -p 5432 192.168.33.18
Starting Nmap 6.25 (http://nmap.org) at 2013-05-07 22:05 FET
Nmap scan report for 192.168.33.18
Host is up (0.00047s latency).
PORT STATE SERVICE
5432/tcp closed postgresql
그리고 vm에서 일부 postgres 프로세스를 볼 수 있습니다. 따라서, Postgres가 정상적으로 작동한다고 생각합니다.
932 postgres 20 0 126m 9.9m 8916 S 0 2.7 0:00.03
postgres
941 postgres 20 0 97460 1348 192 S 0 0.4 0:00.00 postgres
944 postgres 20 0 126m 1728 548 S 0 0.5 0:00.06 postgres
945 postgres 20 0 126m 1488 316 S 0 0.4 0:00.05 postgres
946 postgres 20 0 126m 2768 1000 S 0 0.7 0:00.00 postgres
947 postgres 20 0 97456 1584 352 S 0 0.4 0:00.00 postgres
내 레일 앱에서 가상 머신의 DB를 사용하도록 방글라데시를 설정하는 방법은 무엇입니까?
UPDATE 내 pg_hba.conf
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
###########
# Other authentication configurations taken from chef node defaults:
###########
local all all trust
host all all 0.0.0.0/0 md5
아마도 postgresql 서버를 시작하기위한 몇 가지 설정이 필요할 수 있습니까? 방랑자 로그를 제공 할 수 있습니까? – cmur2
내 vagrantfile을 업데이트합니다 (실제로는 다른 요리 책이 있기 때문에 더 커집니다). 또한 가상 머신 – MikDiet
에서 추가 데이터를 제공합니다. Postgres는 _pg_hba.conf_라는 구성 파일을 사용하여 연결 액세스를 제어합니다. 주방장이나 방랑자가 그 파일을 어떻게 관리하는지 모르겠습니다. 일반 포스트그레스 설치에서는 편집 만하면됩니다. –