2013-03-05 3 views
0

다음은 나의 오류입니다. postgresql에서 오류를 연결할 수 없습니다.

PG::Error - could not connect to server: Connection refused 
    Is the server running on host "localhost" (::1) and accepting 
    TCP/IP connections on port 5432? 
could not connect to server: Connection refused 
    Is the server running on host "localhost" (127.0.0.1) and accepting 
    TCP/IP connections on port 5432? 
could not connect to server: Connection refused 
    Is the server running on host "localhost" (fe80::1) and accepting 
    TCP/IP connections on port 5432? 

나는 그것이 내가 내 bash는 파일이 추가했다이 버전을 인식 얻기 위해/usr/지방/빈/psql의 에 사제를 사용하여 PostgreSQL을 설치했습니다. 내가 http://0.0.0.0:3000에 응용 프로그램을 보려고하면 내 레일 응용 프로그램 및 실행 명령에 내가 CD를

rails s 

는 그런 다음

=> Booting Thin 
=> Rails 4.0.0.beta1 application starting in development on http://0.0.0.0:3000 
=> Call with -d to detach 
=> Ctrl-C to shutdown server 
>> Thin web server (v1.5.0 codename Knife) 
>> Maximum connections set to 1024 
>> Listening on 0.0.0.0:3000, CTRL+C to stop 

으로 시작되면

export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH" 

내가 얻을 위의 오류 사람이 왜 이런 일이 일어날 지 알 것입니다.

답변

0

메시지에 따르면이 오류의 가장 큰 원인은 사용자가 실제로 postgres 서버를 실행하지 않는다는 것입니다. 일반적으로 당신과 함께 *을/etc/init.d를/pg_ctl, *을이 부팅 싶지만 당신이 양조를 통해이 설치되어 있기 때문에, 단지 터미널 창

postgres 

에서 다음 명령을 실행하고 서버가 부팅해야합니다. 시작시 자동으로 시작되도록 설정하지 않은 경우 컴퓨터를 다시 시작한 후에 매번이 명령을 실행해야합니다.

+1

postgres는 서버 구성 파일을 찾을 위치를 알지 못합니다. --config-file 또는 -D 호출 옵션을 지정하거나 PGDATA 환경 변수를 설정해야합니다. – user1096509

+0

명령 줄 'brew info postgres'를 사용하여 시작하는 방법을 찾았습니다. 시작 줄은 'pg_ctl -D/usr/local/var/postgres -l /usr/local/var/postgres/server.log start'입니다. – user1096509

+0

mysql에서 postgres로 변경했을 때 Nitrous.io에서이 오류가 발생했습니다. 상자를 다시 시작하고 database.yml을'host : localhost'로 변경하고'listen address를 '*''로 변경해야했습니다. 최종 해결책은 [여기] (https://serverfault.com/questions/461257/cant-connect-to-postgres-in-production/461265#461265)에서 발견되었습니다. – Shadoath

관련 문제