Heroku上的Occasional Postgres错误:无法翻译主机名称< pg URL>"地址:姓名或服务未知(PG ::错误) [英] Occasional Postgres error on Heroku: could not translate host name "<pg URL>" to address: Name or service not known (PG::Error)

查看:111
本文介绍了Heroku上的Occasional Postgres错误:无法翻译主机名称< pg URL>"地址:姓名或服务未知(PG ::错误)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在在Heroku上使用共享postgres(dev / free)计划,我在日志中看到这个错误的数量可观。连接到PG数据库通常可以工作,所以我不确定这是否在我的控制范围内。 Heroku Status页面没有列出共享数据库的任何停机时间。



使用Rails 3.1.1和独角兽网络服务器



错误:
无法翻译主机名pg60.sharedpg.heroku.com( http://pg60.sharedpg.heroku.com ) 地址:名称或服务未知(PG ::错误)



我的 Unicorn 配置文件(在环顾Heroku的Unicorn推荐设置后):

  worker_processes 3 #独角兽工人数量增加
超时30#重新启动挂起30秒的工人
preload_app true

before_fork do | server,worker |
#用MongoDB或其他任何
替换(ActiveRecord :: Base)
ActiveRecord :: Base.connection_handler.clear_all_connections!
ActiveRecord :: Base.connection.disconnect!
Rails.logger.info('与ActiveRecord断开')
结束

#如果你使用的是Redis而不是Resque,如果定义了这个
? )
Resque.redis.quit
Rails.logger.info('与Redis断开连接)
结束
结束

服务器,worker |
#用MongoDB或任何
替换(如果已定义)(ActiveRecord :: Base)
ActiveRecord :: Base.establish_connection
ActiveRecord :: Base.connection_handler.verify_active_connections!
Rails.logger.info('Connected to ActiveRecord')
end

#如果你使用的是Redis而不是Resque,如果定义了这个
?(Resque )
Resque.redis = ENV ['REDIS_URI']
Rails.logger.info('Connected to Redis')
结束
结束


$ b

跟踪: $ c> 328 13 2012-08-27T21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http://web.1) - - / app /vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:1032:in`initialize':could not translate host namepg60.sharedpg.heroku.com( (PG ::错误)
219 <13> 1 2012-08-27T21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/ active_record / connection_adapters / postgresql_adapter.rb:1032:in`新'
223 13 1 2012-08-27T21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:1032:in`connect'
225 13 2012 -08-27T21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http://web.1) - - from /app/vendor/bundle/ruby/1.9。 1 / gems / activerecord-3.1.1 / lib / active_record / connection_adapters / postgresql_adapter.rb:301:在`initialize'
217< 13> 1 2012-08-27T21:36:37 + 00:00 d .4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record /connection_adapters/postgresql_adapter.rb:28:in`new'
235 13 1 2012-08-27T21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web。 1(http://web.1) - - 从/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:2 8:在`postgresql_connection'

328 13 1 2012-08-27T21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http ://web.1) - - /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:1032:in`initialize':无法翻译主机名称pg60.sharedpg.heroku.com(http://pg60.sharedpg.heroku.com)地址:姓名或服务未知(PG ::错误)
219 13> 2012- 08-27T21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http://web.1) - - from /app/vendor/bundle/ruby/1.9.1 /gems/activerecord-3.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:1032:in`new'
223 <13> 1 2012-08-27T21:36:37 + 00:00 d。 4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/ connection_adapters / postgresql_adapter.rb:1032:in connect'
225< 13> 1 2012-08-27T21:36:37 + 00:00 d.4122435c-cb44-42 1a-9a7d-a68bb10457d6 app web.1(http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/postgresql_adapter。 rb:301:在'初始化'中
217 13 2012-08-27T21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http: /web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in`new'
235 < 13> 1 2012-08-27T21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http://web.1) - - from / app / vendor / bundle / ruby​​ / 1.9.1 / gems / activerecord-3.1.1 / lib / active_record / connection_adapters / postgresql_adapter.rb:28:在`postgresql_connection'中
235 <13> 1 2012-08-27T21: 37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1 .1 / lib / active_record / connection_adapters / abstract / connection_pool.rb:304:in'new_connection'
244 13> 2012-08- 27T21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems /activerecord-3.1.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:323:in'checkout_new_connection'
249< 13> 1 2012-08-27T21:36:37 + 00:00 d。 4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/ connection_adapters / abstract / connection_pool.rb:265:在结账'块(2级)'中
225< 13> 1 2012-08-27T21:36:37 + 00:00 d.4122435c-cb44-421a -9a7d-a68bb10457d6 app web.1(http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract/connection_pool .rb:261:in`loop'
238 13 2012-08-27T21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http: //web.1) - - 从/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstra ct / connection_pool.rb:261:在'block in checkout'
153 13> 2012-08-27T21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web .1(http://web.1) - - from /usr/local/lib/ruby/1.9.1/monitor.rb:201:in'mon_synchronize'
229 13> 2012-08 -27T21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/ gems / activerecord-3.1.1 / lib / active_record / connection_adapters / abstract / connection_pool.rb:260:在'checkout'中
231< 13> 1 2012-08-27T21:36:37 + 00:00 d .4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record /connection_adapters/abstract/connection_pool.rb:162:in'connection'
240 13> 2012-08-27T21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:409 :in'retrieve_connection'
249 13 2012-08-27T21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http:// web。 1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:107:in`retrieve_connection'
239< ; 13> 1 2012-08-27T21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http://web.1) - - from / app / vendor / bundle /ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:89:in'connection'
194< 13> 1 2012-08-27T21:36 :37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord- 3.1.1 / lib / active_record / base.rb:703:in'table_exists?'
128 13 2012-08-27T21:36:37 + 00:00 d.4122435c-cb44-421a- 9a7d-a68bb10457d6 app web.1(http://web.1) - - from /app/app.rb:38:in'< top(required)>'
116 13 2012 -08-27T 21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http://web.1) - - from config.ru:9(http://config.ru: 9):in'require'
124 13 2012-08-27T21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http:// web.1) - - from config.ru:9(http://config.ru:9):in`block in< main>'
179< 13> 1 2012-08-27T21:36 :37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/rack- 1.4.1 / lib / rack / builder.rb:51:在`instance_eval'
176 13> 2012-08-27T21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d -a68bb10457d6 app web.1(http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `初始化'
112 13 2012-08-27T21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http://web.1) - - from config.ru:1(http://config.ru:1):in`new'
115< 13> 1 2012-08-27T21:36:37 + 00:00 d.4122435c -cb44-421a-9a7d-a68bb10457d6 app web.1(http ://web.1) - - from config.ru:1(http://config.ru:1):in`< main>'
168< 13> 1 2012-08-27T21: 36:37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/unicorn -4.2.0 / lib / unicorn.rb:44:在`eval'
180 13 2012-08-27T21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d- a68bb10457d6 app web.1(http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.2.0/lib/unicorn.rb:44:in`block in builder'
181 13 2012-08-27T21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.2.0/lib/unicorn/http_server.rb:691:in`call'
187 <13> 1 2012-08 -27T21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/ gem / unicorn-4.2.0 / lib / unicorn / http_server.rb:691:in`build_app!'
182 13> 2012-08-27T21:36:37 + 00:00 d.4122435c- cb44-421a-9a7d-a68bb10457d6 ap p web.1(http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.2.0/lib/unicorn/http_server.rb:136:in`start '
178 13 2012-08-27T21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.2.0/bin/unicorn:121:in`< top(required)>'
146 13 2012 -08-27T21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1(http://web.1) - - from /app/vendor/bundle/ruby/1.9。 1 / bin / unicorn:19:在'load'中
148 13 2012-08-27T21:36:37 + 00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/bin/unicorn:19:in`< main>'


解决方案

这是 DNS 错误。这与代码无关。如果您的Rails应用程序和数据库都在Heroku中,请联系Heroku支持。



如果您的Rails应用程序在 之外运行,搜索独角兽这个词表明它可能是; 请链接到这样的事情;不是每个人都知道独角兽是什么),你需要做一些调试来确定DNS问题是。它是你的应用程序使用的递归DNS服务器吗?一些更接近的缓存服务器?一些用于解析Heroku的DNS的中间服务器(不太可能)? Heroku的DNS是它自己的?它是一个数据包丢失问题,服务器响应一个错误的否定,一个在循环群集中的一个错误的服务器,......的问题?希望通过 dig + trace 花费大量时间, traceroute mtr - 假设您可以 ssh 。如果你有root权限, tcpdump tshark 也可能有用,如果您可以访问您正在使用的DNS服务器的日志,也可以查看它们的日志。



如果您没有shell访问权限,几乎不得不错误地支持您所托管的人员。


I'm using the shared postgres (dev / free) plan right now on Heroku and I see this error in my logs a decent amount. Connecting to the PG database does usually work though, so I'm not sure if this is something that's within my control. The Heroku Status page does not list any downtime for the shared databases when these occur.

Using Rails 3.1.1 and the Unicorn web server.

Error: could not translate host name "pg60.sharedpg.heroku.com (http://pg60.sharedpg.heroku.com)" to address: Name or service not known (PG::Error)

My Unicorn config file (after looking around at the recommended settings for Unicorn in Heroku):

worker_processes 3 # amount of unicorn workers to spin up
timeout 30         # restarts workers that hang for 30 seconds
preload_app true

before_fork do |server, worker|
  # Replace with MongoDB or whatever
  if defined?(ActiveRecord::Base)
    ActiveRecord::Base.connection_handler.clear_all_connections!
    ActiveRecord::Base.connection.disconnect!
    Rails.logger.info('Disconnected from ActiveRecord')
  end

  # If you are using Redis but not Resque, change this
  if defined?(Resque)
    Resque.redis.quit
    Rails.logger.info('Disconnected from Redis')
  end
end

after_fork do |server, worker|
  # Replace with MongoDB or whatever
  if defined?(ActiveRecord::Base)
    ActiveRecord::Base.establish_connection
    ActiveRecord::Base.connection_handler.verify_active_connections!
    Rails.logger.info('Connected to ActiveRecord')
  end

  # If you are using Redis but not Resque, change this
  if defined?(Resque)
    Resque.redis = ENV['REDIS_URI']
    Rails.logger.info('Connected to Redis')
  end
end

Trace:

 328 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:1032:in `initialize': could not translate host name "pg60.sharedpg.heroku.com (http://pg60.sharedpg.heroku.com)" to address: Name or service not known (PG::Error)
219 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:1032:in `new'
223 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:1032:in `connect'
225 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:301:in `initialize'
217 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `new'
235 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `postgresql_connection'

328 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:1032:in `initialize': could not translate host name "pg60.sharedpg.heroku.com (http://pg60.sharedpg.heroku.com)" to address: Name or service not known (PG::Error)
219 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:1032:in `new'
223 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:1032:in `connect'
225 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:301:in `initialize'
217 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `new'
235 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `postgresql_connection'
235 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:304:in `new_connection'
244 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:323:in `checkout_new_connection'
249 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `block (2 levels) in checkout'
225 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:261:in `loop'
238 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:261:in `block in checkout'
153 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
229 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:260:in `checkout'
231 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:162:in `connection'
240 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:409:in `retrieve_connection'
249 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:107:in `retrieve_connection'
239 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:89:in `connection'
194 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/base.rb:703:in `table_exists?'
128 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/app.rb:38:in `<top (required)>'
116 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from config.ru:9 (http://config.ru:9):in `require'
124 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from config.ru:9 (http://config.ru:9):in `block in <main>'
179 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
176 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
112 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from config.ru:1 (http://config.ru:1):in `new'
115 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from config.ru:1 (http://config.ru:1):in `<main>'
168 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.2.0/lib/unicorn.rb:44:in `eval'
180 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.2.0/lib/unicorn.rb:44:in `block in builder'
181 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.2.0/lib/unicorn/http_server.rb:691:in `call'
187 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.2.0/lib/unicorn/http_server.rb:691:in `build_app!'
182 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.2.0/lib/unicorn/http_server.rb:136:in `start'
178 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.2.0/bin/unicorn:121:in `<top (required)>'
146 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/bin/unicorn:19:in `load'
148 <13>1 2012-08-27T21:36:37+00:00 d.4122435c-cb44-421a-9a7d-a68bb10457d6 app web.1 (http://web.1) - - from /app/vendor/bundle/ruby/1.9.1/bin/unicorn:19:in `<main>' 

解决方案

That's a DNS error. It's exceedingly unlikely to be anything to do with your code. If both your Rails app and your DB are within Heroku, contact Heroku support.

If your Rails app is running outside the Heroku cloud (as a bit of searching for the term "Unicorn" suggests it could be; please link to things like this; not everyone knows what "unicorn" is), you need to do some debugging to work out where the DNS issues are. Is it the recursive DNS server your app is using? Some closer caching server? Some intermediate server up the chain used to resolve Heroku's DNS (unlikely) ? Heroku's DNS its self? Is it a packet loss issue, an issue where the server responds with a false negative, one bad server in a round-robin cluster, ... ? Expect to spend lots of quality time with dig +trace and with traceroute or mtr - assuming you can ssh in. If you have root, tcpdump and tshark may also be useful, as will examination of the logs of the DNS server you're using if you can get access to them.

If you have no shell access you pretty much have to bug the support of the people you're hosting with.

这篇关于Heroku上的Occasional Postgres错误:无法翻译主机名称&lt; pg URL&gt;&quot;地址:姓名或服务未知(PG ::错误)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆