2011-10-18 4 views
10

저는 직원을 관리 할 수 ​​있었지만 문제없이 (개발 중에) 실행했지만 지금은 생산 또는 개발 단계에 있지 않습니다 (SQlite3에서 PostgreSQL).PostgreSQL 서버에서 Resque 작업자가 실패했습니다

나는 rake resque:work QUEUE=*와 노동자를 실행하는 레이크 명령을 실행하면 나는 다음과 같은 오류 및 스택 추적 얻을 : 큐에 대기중인 근로자를 테스트하기 위해 콘솔에서 heroku rake resque:work QUEUE=*을 실행할 때

getaddrinfo: nodename nor servname provided, or not known 

나는 다음과 같은 오류를 얻을 수를 .

Class   SentimentJob 
Arguments  [4, 5, 6] 
Exception  ActiveRecord::StatementInvalid 
Error   PGError: server closed the connection unexpectedly This probably means 
       the server terminated abnormally before or while processing the request. 
       : SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, 
       a.attnotnull FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = 
       d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"taggings"'::regclass 
       AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum 

그리고 내 페이스 북 노동자에 대한

:

Class   FBConnectionsJob 
Arguments  1 
Exception  OpenSSL::SSL::SSLError 
Error   SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: 
       certificate verify failed 

Class   FBConnectionsJob 
Arguments  1 
Exception  ActiveRecord::StatementInvalid 
Error   PGError: server closed the connection unexpectedly This probably means 
       the server terminated abnormally before or while processing the request. 
       : SELECT tablename FROM pg_tables WHERE schemaname = ANY 
       (current_schemas(false)) 

이유는 서로 다른 환경에서 서로 다른 오류를받을 수 있나요? 내 이니셜 라이저 파일은 다음과 같습니다.

여기에 ENV 사양을 추가해야합니까?

Resque.rb

uri = URI.parse(ENV["REDISTOGO_URL"]) 
Resque.redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password) 
Dir["#{Rails.root}/app/jobs/*.rb"].each { |file| require file } 

Redis.rb

uri = URI.parse(ENV["REDISTOGO_URL"]) 
REDIS = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password) 
Resque.redis = REDIS 

환경/production.rb 파일 레디 스 내 환경/개발에 대한 참조가 없습니다. rb 파일은 Redis 설정을 위해 다음과 같습니다.

ENV["REDISTOGO_URL"] = 'redis://username:[email protected]:6789' 
+0

저에게 Redis보다는 데이터베이스 연결에 문제가있는 것 같습니다. 비표준 설정을 사용하고 있습니까? –

+0

책으로 나갔다. – Simpleton

답변

29

내 Rakefile에 다음을 추가를 Resque 이전의 PostgreSQL은 작업자 생성 프로세스를 강제합니다.

0

앱이 Redis 서버에 연결할 수없는 것 같습니다. 프로덕션 환경에 대한 유효한 연결 세부 정보를 제공 했습니까? Redis 서버를 사용할 수 있습니까? 방화벽 뒤에서 개인 네트워크가 아닌가?

프로덕션 PostgreSQL 서버와 동일한 문제 일 수 있습니다.

+0

실제로 Heroku와 개발중인 Redis 서버에 액세스 할 수 있습니다. localhost 환경에서 아무 것도 변경하지 않았으므로 변경되지 않습니다. – Simpleton

+1

내가 뭔가를 놓친 건가? Redis 관련 오류가 표시되지 않습니다. –

0

이니셜 라이저를 다음과 같이 변경 했으므로 이제 localhost에서 작동하므로 @mirtinciu가 서버 연결에 대한 것입니다. 아직 프로덕션 서버에서 잘못된 점을 파악해야합니다.

if Rails.env.development? 
    uri = URI.parse(ENV["REDISTOGO_URL"]) 
    Resque.redis = Redis.new(:host => 'localhost', :port => '6379') 
else 
    uri = URI.parse(ENV["REDISTOGO_URL"]) 
    Resque.redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password) 
end 
관련 문제