[英]SocketError at /sidekiq/ getaddrinfo: nodename nor servname provided, or not known
I'm a novice Rails dev building an app connected to redis + sidekiq. 我是一个新手Rails dev构建一个连接到redis + sidekiq的应用程序。 I must have some configuration error, but I'm not sure what exactly it is. 我必须有一些配置错误,但我不确定它究竟是什么。 Below, I'll write about what exactly confuses me here: 下面,我将在这里写下我的确困惑:
Upon running rails s, I get the following error: 在运行rails s时,我收到以下错误:
2016-07-09 08:55:46 - SocketError - getaddrinfo: nodename nor servname provided, or not known:
/Users/rohitrekhi/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/connection/ruby.rb:177:in `getaddrinfo'
/Users/rohitrekhi/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/connection/ruby.rb:177:in `connect'
/Users/rohitrekhi/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/connection/ruby.rb:260:in `connect'
/Users/rohitrekhi/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:336:in `establish_connection'
So I figured it must be a redis connection error. 所以我认为它必须是一个redis连接错误。 When I ping redis to see if connection goes through, it shows the following: 当我ping redis以查看连接是否通过时,它显示以下内容:
$ redis-cli ping
=> PONG
So if the redis connection goes through, maybe it's a Sidekiq issue? 所以如果redis连接通过,也许这是Sidekiq问题?
I implemented the Sidekiq web interface via Sinatra, and got the following error when I tried to view it: 我通过Sinatra实现了Sidekiq Web界面,当我尝试查看它时出现以下错误:
SocketError at /sidekiq/
getaddrinfo: nodename nor servname provided, or not known
So now I'm guessing the error is actually via Sidekiq, but I'm not sure where I dropped the ball via configurations on the host/server/sockets. 所以现在我猜测错误实际上是通过Sidekiq,但我不确定我通过主机/服务器/套接字上的配置丢球。 Any ideas what exactly is causing this and if it's an error with Sidekiq or redis? 究竟是什么导致了这一点,以及是否是Sidekiq或redis的错误?
This is my initializer file for sidekiq in config/initializers/sidekiq.rb: 这是我在config / initializers / sidekiq.rb中为sidekiq创建的初始化文件:
Sidekiq.configure_server do |config|
config.redis = { url: 'redis://redis.example.com:6379/12', network_timeout: 5 }
end
Sidekiq.configure_client do |config|
config.redis = { url: 'redis://redis.example.com:6379/12', network_timeout: 5 }
end
And this is my config/initializer/redis.rb: 这是我的config / initializer / redis.rb:
$redis = Redis.new(:host => 'localhost', :port => 6379)
I've also opened three terminal windows turning on the redis server, sidekiq, and my rails server. 我还打开了三个终端窗口,打开了redis服务器,sidekiq和我的rails服务器。
Thanks in advance! 提前致谢!
This makes no sense: 这毫无意义:
redis://redis.example.com:6379/12
You do not have a Redis server at that URL; 您在该URL上没有Redis服务器; fix the URL. 修复网址。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.