gpt4 book ai didi

ruby-on-rails - Sidekiq 在本地而不是远程寻找 redis

转载 作者:IT王子 更新时间:2023-10-29 06:03:15 26 4
gpt4 key购买 nike

我的 sidekiq 初始化程序中有这个:

Sidekiq.configure_server do |config|
config.redis = { url: "redis://#{ENV['REDIS_PORT_6379_TCP_ADDR']}:#{ENV['REDIS_PORT_6379_TCP_PORT']}/0", namespace: 'Tyresearch' }
end

当我启动 sidekiq 时,它会在正确的主机和端口上正常启动:

INFO: Booting Sidekiq 3.2.4 with redis options {:url=>"redis://172.17.0.6:6379/0", :namespace=>"Tyresearch"}

然而,当我尝试启动一个 worker 或访问 sidekiq 管理面板时,我收到此错误:

Redis::CannotConnectError at /sidekiq
Error connecting to Redis on 127.0.0.1:6379 (ECONNREFUSED)

因此,出于某种原因,它现在尝试连接到 127.0.0.1 而不是 172.17.0.6

这是我的环境(该应用程序由 vagrant 管理的链接 docker 容器组成)

{"ADMIN_EMAIL"=>"user@example.com",
"ADMIN_NAME"=>"First User",
"ADMIN_PASSWORD"=>"changeme",
"BUNDLE_BIN_PATH"=>
"/opt/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.7.4/bin/bundle",
"BUNDLE_GEMFILE"=>"/var/www/Gemfile",
"COLUMNS"=>"135",
"GEM_HOME"=>"/var/bundle/ruby/2.1.0",
"GEM_PATH"=>"",
"GMAIL_PASSWORD"=>"Your_Password",
"GMAIL_USERNAME"=>"Your_Username",
"HOME"=>"/home/web",
"HOSTNAME"=>"223b7ef7396f",
"LESSCLOSE"=>"/usr/bin/lesspipe %s %s",
"LESSOPEN"=>"| /usr/bin/lesspipe %s",
"LINES"=>"43",
"LS_COLORS"=>
"rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=
01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:
*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=0
1;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.
flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:
*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:",
"NODE_PATH"=>"/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript",
"PATH"=>
"/var/bundle/ruby/2.1.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/rubies/ruby-2.1.2/bin",
"POSTGRES_ENV_PASSWORD"=>"password",
"POSTGRES_ENV_USERNAME"=>"postgres",
"POSTGRES_ENV_VERSION"=>"9.3",
"POSTGRES_NAME"=>"/tyresearch/postgres",
"POSTGRES_PORT"=>"tcp://172.17.0.5:5432",
"POSTGRES_PORT_5432_TCP"=>"tcp://172.17.0.5:5432",
"POSTGRES_PORT_5432_TCP_ADDR"=>"172.17.0.5",
"POSTGRES_PORT_5432_TCP_PORT"=>"5432",
"POSTGRES_PORT_5432_TCP_PROTO"=>"tcp",
"PWD"=>"/var/www",
"REDIS_NAME"=>"/tyresearch/redis",
"REDIS_PORT"=>"tcp://172.17.0.6:6379",
"REDIS_PORT_6379_TCP"=>"tcp://172.17.0.6:6379",
"REDIS_PORT_6379_TCP_ADDR"=>"172.17.0.6",
"REDIS_PORT_6379_TCP_PORT"=>"6379",
"REDIS_PORT_6379_TCP_PROTO"=>"tcp",
"ROLES"=>"[\"admin\", \"user\", \"VIP\"]",
"RUBYLIB"=>
"/opt/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.7.4/lib",
"RUBYOPT"=>"-rbundler/setup",
"SELENIUM_ENV_CHROME_DRIVER_VERSION"=>"2.12",
"SELENIUM_ENV_DEBCONF_NONINTERACTIVE_SEEN"=>"true",
"SELENIUM_ENV_DEBIAN_FRONTEND"=>"noninteractive",
"SELENIUM_ENV_DISPLAY"=>":20.0",
"SELENIUM_ENV_LANG"=>"en_US.UTF-8",
"SELENIUM_ENV_LANGUAGE"=>"en_US.UTF-8",
"SELENIUM_ENV_SCREEN_DEPTH"=>"24",
"SELENIUM_ENV_SCREEN_HEIGHT"=>"1020",
"SELENIUM_ENV_SCREEN_WIDTH"=>"1360",
"SELENIUM_ENV_SELENIUM_PORT"=>"4444",
"SELENIUM_ENV_TZ"=>"\"US/Pacific\"",
"SELENIUM_NAME"=>"/tyresearch/selenium",
"SELENIUM_PORT"=>"tcp://172.17.0.7:4444",
"SELENIUM_PORT_4444_TCP"=>"tcp://172.17.0.7:4444",
"SELENIUM_PORT_4444_TCP_ADDR"=>"172.17.0.7",
"SELENIUM_PORT_4444_TCP_PORT"=>"4444",
"SELENIUM_PORT_4444_TCP_PROTO"=>"tcp",
"SELENIUM_PORT_5900_TCP"=>"tcp://172.17.0.7:5900",
"SELENIUM_PORT_5900_TCP_ADDR"=>"172.17.0.7",
"SELENIUM_PORT_5900_TCP_PORT"=>"5900",
"SELENIUM_PORT_5900_TCP_PROTO"=>"tcp",
"SHLVL"=>"1",
"TERM"=>"xterm",
"_"=>"/opt/rubies/ruby-2.1.2/bin/bundle",
"_FIGARO_ADMIN_EMAIL"=>"user@example.com",
"_FIGARO_ADMIN_NAME"=>"First User",
"_FIGARO_ADMIN_PASSWORD"=>"changeme",
"_FIGARO_GMAIL_PASSWORD"=>"Your_Password",
"_FIGARO_GMAIL_PASSWORD"=>"Your_Password",
"_FIGARO_GMAIL_USERNAME"=>"Your_Username",
"_FIGARO_ROLES"=>"[\"admin\", \"user\", \"VIP\"]",
"_ORIGINAL_GEM_PATH"=>""}

最佳答案

好吧,我错过了仔细阅读文档并没有配置sidekiq客户端:

Sidekiq.configure_server do |config|
config.redis = { url: "redis://#{ENV['REDIS_PORT_6379_TCP_ADDR']}:#{ENV['REDIS_PORT_6379_TCP_PORT']}/0", namespace: 'Tyresearch' }
end
Sidekiq.configure_client do |config|
config.redis = { url: "redis://#{ENV['REDIS_PORT_6379_TCP_ADDR']}:#{ENV['REDIS_PORT_6379_TCP_PORT']}/0", namespace: 'Tyresearch' }
end

关于ruby-on-rails - Sidekiq 在本地而不是远程寻找 redis,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26833831/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com