- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我正在尝试使用 sidekiq、icecast 和 redis 对 Rails 应用程序进行 docker 化以进行流式传输。目前卡在一个错误上,我已经搜索了很长一段时间了。错误回溯:
Successfully built 64c7adaf977d
Successfully tagged radiofm20_sidekiq:latest
Recreating radiofm20_radiofm_1 ...
Recreating radiofm20_radiofm_1 ... done
Attaching to radiofm20_sidekiq_1, radiofm20_radiofm_1
sidekiq_1 | 2018-01-17T23:43:11.163Z 1 TID-6x26s INFO: Booting Sidekiq 5.0.5 with redis options {:url=>"redis://redis:6379", :id=>"Sidekiq-server-PID-1"}
sidekiq_1 | getaddrinfo: Name or service not known
sidekiq_1 | /usr/local/bundle/gems/redis-4.0.1/lib/redis/connection/ruby.rb:210:in `getaddrinfo'
sidekiq_1 | /usr/local/bundle/gems/redis-4.0.1/lib/redis/connection/ruby.rb:210:in `connect'
sidekiq_1 | /usr/local/bundle/gems/redis-4.0.1/lib/redis/connection/ruby.rb:293:in `connect'
sidekiq_1 | /usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:334:in `establish_connection'
sidekiq_1 | /usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:99:in `block in connect'
sidekiq_1 | /usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:291:in `with_reconnect'
sidekiq_1 | /usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:98:in `connect'
sidekiq_1 | /usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:363:in `ensure_connected'
sidekiq_1 | /usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:219:in `block in process'
sidekiq_1 | /usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:304:in `logging'
sidekiq_1 | /usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:218:in `process'
sidekiq_1 | /usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:185:in `call_pipelined'
sidekiq_1 | /usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:155:in `block in call_pipeline'
sidekiq_1 | /usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:291:in `with_reconnect'
sidekiq_1 | /usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:153:in `call_pipeline'
sidekiq_1 | /usr/local/bundle/gems/redis-4.0.1/lib/redis.rb:2353:in `block in multi'
sidekiq_1 | /usr/local/bundle/gems/redis-4.0.1/lib/redis.rb:45:in `block in synchronize'
sidekiq_1 | /usr/local/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
sidekiq_1 | /usr/local/bundle/gems/redis-4.0.1/lib/redis.rb:45:in `synchronize'
sidekiq_1 | /usr/local/bundle/gems/redis-4.0.1/lib/redis.rb:2345:in `multi'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-5.0.5/lib/sidekiq/client.rb:184:in `block in raw_push'
sidekiq_1 | /usr/local/bundle/gems/connection_pool-2.2.1/lib/connection_pool.rb:64:in `block (2 levels) in with'
sidekiq_1 | /usr/local/bundle/gems/connection_pool-2.2.1/lib/connection_pool.rb:63:in `handle_interrupt'
sidekiq_1 | /usr/local/bundle/gems/connection_pool-2.2.1/lib/connection_pool.rb:63:in `block in with'
sidekiq_1 | /usr/local/bundle/gems/connection_pool-2.2.1/lib/connection_pool.rb:60:in `handle_interrupt'
sidekiq_1 | /usr/local/bundle/gems/connection_pool-2.2.1/lib/connection_pool.rb:60:in `with'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-5.0.5/lib/sidekiq/client.rb:183:in `raw_push'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-5.0.5/lib/sidekiq/client.rb:74:in `push'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-5.0.5/lib/sidekiq/worker.rb:143:in `client_push'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-5.0.5/lib/sidekiq/worker.rb:87:in `perform_async'
sidekiq_1 | /app/config/initializers/sidekiq.rb:10:in `<top (required)>'
sidekiq_1 | /usr/local/bundle/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
sidekiq_1 | /usr/local/bundle/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `block in load'
sidekiq_1 | /usr/local/bundle/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
sidekiq_1 | /usr/local/bundle/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
sidekiq_1 | /usr/local/bundle/gems/railties-5.1.4/lib/rails/engine.rb:655:in `block in load_config_initializer'
sidekiq_1 | /usr/local/bundle/gems/activesupport-5.1.4/lib/active_support/notifications.rb:168:in `instrument'
sidekiq_1 | /usr/local/bundle/gems/railties-5.1.4/lib/rails/engine.rb:654:in `load_config_initializer'
sidekiq_1 | /usr/local/bundle/gems/railties-5.1.4/lib/rails/engine.rb:612:in `block (2 levels) in <class:Engine>'
sidekiq_1 | /usr/local/bundle/gems/railties-5.1.4/lib/rails/engine.rb:611:in `each'
sidekiq_1 | /usr/local/bundle/gems/railties-5.1.4/lib/rails/engine.rb:611:in `block in <class:Engine>'
sidekiq_1 | /usr/local/bundle/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `instance_exec'
sidekiq_1 | /usr/local/bundle/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `run'
sidekiq_1 | /usr/local/bundle/gems/railties-5.1.4/lib/rails/initializable.rb:59:in `block in run_initializers'
sidekiq_1 | /usr/local/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
sidekiq_1 | /usr/local/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
sidekiq_1 | /usr/local/lib/ruby/2.4.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
sidekiq_1 | /usr/local/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
sidekiq_1 | /usr/local/lib/ruby/2.4.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
sidekiq_1 | /usr/local/bundle/gems/railties-5.1.4/lib/rails/initializable.rb:48:in `each'
sidekiq_1 | /usr/local/bundle/gems/railties-5.1.4/lib/rails/initializable.rb:48:in `tsort_each_child'
sidekiq_1 | /usr/local/lib/ruby/2.4.0/tsort.rb:415:in `call'
sidekiq_1 | /usr/local/lib/ruby/2.4.0/tsort.rb:415:in `each_strongly_connected_component_from'
sidekiq_1 | /usr/local/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
sidekiq_1 | /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `each'
sidekiq_1 | /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `call'
sidekiq_1 | /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
sidekiq_1 | /usr/local/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
sidekiq_1 | /usr/local/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
sidekiq_1 | /usr/local/bundle/gems/railties-5.1.4/lib/rails/initializable.rb:58:in `run_initializers'
sidekiq_1 | /usr/local/bundle/gems/railties-5.1.4/lib/rails/application.rb:353:in `initialize!'
sidekiq_1 | /app/config/environment.rb:5:in `<top (required)>'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-5.0.5/lib/sidekiq/cli.rb:257:in `require'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-5.0.5/lib/sidekiq/cli.rb:257:in `boot_system'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-5.0.5/lib/sidekiq/cli.rb:54:in `run'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-5.0.5/bin/sidekiq:12:in `<top (required)>'
sidekiq_1 | /usr/local/bundle/bin/sidekiq:29:in `load'
sidekiq_1 | /usr/local/bundle/bin/sidekiq:29:in `<main>'
radiofm20_sidekiq_1 exited with code 1
radiofm_1 | /usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:344:in `rescue in establish_connection': Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED) (Redis::CannotConnectError)
radiofm_1 | from /usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:328:in `establish_connection'
radiofm_1 | from /usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:99:in `block in connect'
radiofm_1 | from /usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:291:in `with_reconnect'
radiofm_1 | from /usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:98:in `connect'
radiofm_1 | from /usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:363:in `ensure_connected'
radiofm_1 | from /usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:219:in `block in process'
radiofm_1 | from /usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:304:in `logging'
radiofm_1 | from /usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:218:in `process'
radiofm_1 | from /usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:185:in `call_pipelined'
radiofm_1 | from /usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:155:in `block in call_pipeline'
radiofm_1 | from /usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:291:in `with_reconnect'
radiofm_1 | from /usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:153:in `call_pipeline'
radiofm_1 | from /usr/local/bundle/gems/redis-4.0.1/lib/redis.rb:2353:in `block in multi'
radiofm_1 | from /usr/local/bundle/gems/redis-4.0.1/lib/redis.rb:45:in `block in synchronize'
radiofm_1 | from /usr/local/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
radiofm_1 | from /usr/local/bundle/gems/redis-4.0.1/lib/redis.rb:45:in `synchronize'
radiofm_1 | from /usr/local/bundle/gems/redis-4.0.1/lib/redis.rb:2345:in `multi'
radiofm_1 | from /usr/local/bundle/gems/sidekiq-5.0.5/lib/sidekiq/client.rb:184:in `block in raw_push'
radiofm_1 | from /usr/local/bundle/gems/connection_pool-2.2.1/lib/connection_pool.rb:64:in `block (2 levels) in with'
radiofm_1 | from /usr/local/bundle/gems/connection_pool-2.2.1/lib/connection_pool.rb:63:in `handle_interrupt'
radiofm_1 | from /usr/local/bundle/gems/connection_pool-2.2.1/lib/connection_pool.rb:63:in `block in with'
radiofm_1 | from /usr/local/bundle/gems/connection_pool-2.2.1/lib/connection_pool.rb:60:in `handle_interrupt'
radiofm_1 | from /usr/local/bundle/gems/connection_pool-2.2.1/lib/connection_pool.rb:60:in `with'
radiofm_1 | from /usr/local/bundle/gems/sidekiq-5.0.5/lib/sidekiq/client.rb:183:in `raw_push'
radiofm_1 | from /usr/local/bundle/gems/sidekiq-5.0.5/lib/sidekiq/client.rb:74:in `push'
radiofm_1 | from /usr/local/bundle/gems/sidekiq-5.0.5/lib/sidekiq/worker.rb:143:in `client_push'
radiofm_1 | from /usr/local/bundle/gems/sidekiq-5.0.5/lib/sidekiq/worker.rb:87:in `perform_async'
radiofm_1 | from /app/config/initializers/sidekiq.rb:10:in `<top (required)>'
radiofm_1 | from /usr/local/bundle/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
radiofm_1 | from /usr/local/bundle/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `block in load'
radiofm_1 | from /usr/local/bundle/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
radiofm_1 | from /usr/local/bundle/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
radiofm_1 | from /usr/local/bundle/gems/railties-5.1.4/lib/rails/engine.rb:655:in `block in load_config_initializer'
radiofm_1 | from /usr/local/bundle/gems/activesupport-5.1.4/lib/active_support/notifications.rb:168:in `instrument'
radiofm_1 | from /usr/local/bundle/gems/railties-5.1.4/lib/rails/engine.rb:654:in `load_config_initializer'
radiofm_1 | from /usr/local/bundle/gems/railties-5.1.4/lib/rails/engine.rb:612:in `block (2 levels) in <class:Engine>'
radiofm_1 | from /usr/local/bundle/gems/railties-5.1.4/lib/rails/engine.rb:611:in `each'
radiofm_1 | from /usr/local/bundle/gems/railties-5.1.4/lib/rails/engine.rb:611:in `block in <class:Engine>'
radiofm_1 | from /usr/local/bundle/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `instance_exec'
radiofm_1 | from /usr/local/bundle/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `run'
radiofm_1 | from /usr/local/bundle/gems/railties-5.1.4/lib/rails/initializable.rb:59:in `block in run_initializers'
radiofm_1 | from /usr/local/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
radiofm_1 | from /usr/local/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
radiofm_1 | from /usr/local/lib/ruby/2.4.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
radiofm_1 | from /usr/local/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
radiofm_1 | from /usr/local/lib/ruby/2.4.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
radiofm_1 | from /usr/local/bundle/gems/railties-5.1.4/lib/rails/initializable.rb:48:in `each'
radiofm_1 | from /usr/local/bundle/gems/railties-5.1.4/lib/rails/initializable.rb:48:in `tsort_each_child'
radiofm_1 | from /usr/local/lib/ruby/2.4.0/tsort.rb:415:in `call'
radiofm_1 | from /usr/local/lib/ruby/2.4.0/tsort.rb:415:in `each_strongly_connected_component_from'
radiofm_1 | from /usr/local/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
radiofm_1 | from /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `each'
radiofm_1 | from /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `call'
radiofm_1 | from /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
radiofm_1 | from /usr/local/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
radiofm_1 | from /usr/local/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
radiofm_1 | from /usr/local/bundle/gems/railties-5.1.4/lib/rails/initializable.rb:58:in `run_initializers'
radiofm_1 | from /usr/local/bundle/gems/railties-5.1.4/lib/rails/application.rb:353:in `initialize!'
radiofm_1 | from /app/config/environment.rb:5:in `<top (required)>'
radiofm_1 | from config.ru:3:in `require_relative'
radiofm_1 | from config.ru:3:in `block in <main>'
radiofm_1 | from /usr/local/bundle/gems/rack-2.0.3/lib/rack/builder.rb:55:in `instance_eval'
radiofm_1 | from /usr/local/bundle/gems/rack-2.0.3/lib/rack/builder.rb:55:in `initialize'
radiofm_1 | from config.ru:in `new'
radiofm_1 | from config.ru:in `<main>'
radiofm_1 | from /usr/local/bundle/gems/rack-2.0.3/lib/rack/builder.rb:49:in `eval'
radiofm_1 | from /usr/local/bundle/gems/rack-2.0.3/lib/rack/builder.rb:49:in `new_from_string'
radiofm_1 | from /usr/local/bundle/gems/rack-2.0.3/lib/rack/builder.rb:40:in `parse_file'
radiofm_1 | from /usr/local/bundle/gems/rack-2.0.3/lib/rack/server.rb:319:in `build_app_and_options_from_config'
radiofm_1 | from /usr/local/bundle/gems/rack-2.0.3/lib/rack/server.rb:219:in `app'
radiofm_1 | from /usr/local/bundle/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:24:in `app'
radiofm_1 | from /usr/local/bundle/gems/rack-2.0.3/lib/rack/server.rb:354:in `wrapped_app'
radiofm_1 | from /usr/local/bundle/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:80:in `log_to_stdout'
radiofm_1 | from /usr/local/bundle/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:42:in `start'
radiofm_1 | from /usr/local/bundle/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:135:in `block in perform'
radiofm_1 | from /usr/local/bundle/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `tap'
radiofm_1 | from /usr/local/bundle/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `perform'
radiofm_1 | from /usr/local/bundle/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
radiofm_1 | from /usr/local/bundle/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
radiofm_1 | from /usr/local/bundle/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
radiofm_1 | from /usr/local/bundle/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
radiofm_1 | from /usr/local/bundle/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
radiofm_1 | from /usr/local/bundle/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
radiofm_1 | from /app/bin/rails:9:in `require'
radiofm_1 | from /app/bin/rails:9:in `<top (required)>'
radiofm_1 | from /usr/local/bundle/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
radiofm_1 | from /usr/local/bundle/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
radiofm_1 | from /usr/local/bundle/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
radiofm_1 | from /usr/local/bundle/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
radiofm_1 | from /usr/local/bundle/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
radiofm_1 | from /usr/local/bundle/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
radiofm_1 | from /usr/local/bundle/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
radiofm_1 | from /app/bin/spring:15:in `require'
radiofm_1 | from /app/bin/spring:15:in `<top (required)>'
radiofm_1 | from bin/rails:3:in `load'
radiofm_1 | from bin/rails:3:in `<main>'
radiofm_1 | => Booting Puma
radiofm_1 | => Rails 5.1.4 application starting in development
radiofm_1 | => Run `rails server -h` for more startup options
radiofm_1 | Exiting
radiofm20_radiofm_1 exited with code 1
docker 组成:
radiofm:
build:
context: "./"
dockerfile: Dockerfile-development
volumes:
- .:/src
env_file:
- './src/.env'
environment:
- REDIS-URL=redis://redis:6379/0
ports:
- "3000:3000"
sidekiq:
command: sidekiq -C config/sidekiq.yml.erb
build: .
volumes:
- '.:/src'
env_file:
- './src/.env'
volumes:
postgres:
sidekiq:
Dockerfile(有点乱,多多包涵)
FROM ruby:2.4.3
ENV DEBIAN_FRONTEND noninteractive
ENV BUILD_PACKAGES curl-dev build-base
RUN apt-get update
RUN apt-get install -y libpq-dev git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev
RUN apt-get install -y apt-utils
RUN wget -qO - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
apt-key add -
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update -qq \
&& apt-get install -y --no-install-recommends \
postgresql-client-9.6 \
&& rm -rf /var/lib/apt/lists/*t
# Node.js
RUN apt-get install -y nodejs
# for nokogiri
RUN apt-get install -y libxml2-dev libxslt1-dev
# for capybara-webkit
RUN apt-get install -y libqt4-webkit libqt4-dev xvfb
#For Ruby-shout
RUN apt-get install -y libxml2 libxslt1-dev python-dev
RUN apt-get update && apt-get install -y \
curl
RUN apt-get install -y vorbis-tools
RUN apt-get install -y libshout3-dev
#Icecast
RUN sh -c "echo deb http://download.opensuse.org/repositories/multimedia:/xiph/xUbuntu_16.04/ ./ >>/etc/apt/sources.list.d/icecast.list"
RUN apt install wget
RUN wget -qO - http://icecast.org/multimedia-obs.key | apt-key add -
RUN apt-get update
RUN apt-get install icecast2
RUN rm -rf /var/lib/gems/2.4.1/cache/*
#ICECAST DEPENDENCY INSTALL REDIS+DEPENDENCY ICECAST
RUN apt-get install -y redis-server
RUN redis-server --daemonize yes
# RUN redis-server --version
RUN mkdir /app
WORKDIR /app
COPY /src /app
RUN gem install bundler
RUN gem install rake
RUN bundle install
EXPOSE 3000
CMD rails db:create
CMD rails db:migrate
CMD rails s -p 3000 -b 0.0.0.0
我怎样才能解决这个 getaddrinfo 错误?我的想法是,这是 sidekiq 和 redis 之间的某种连接错误。我的 sidekiq.rb 配置文件中也有这个
Sidekiq.configure_server do |config|
config.redis = { url: 'redis://redis:6379' }
end
提前致谢。抱歉,如果我的帖子有点模棱两可。随便问什么。 :)
编辑:我使用这个 sidekiq.rb 文件部署了基本的 Rails 应用程序(可以在端口 localhost:3000 上收听它)但是现在我得到了这个错误
web_1 | /usr/local/bundle/gems/redis-4.0.1/lib/redis/connection/ruby.rb:210:in `getaddrinfo': getaddrinfo: Name or service not known (SocketError)
sidekiq.rb 文件:
Sidekiq.configure_server do |config|
config.redis = { url: 'redis://redis:6379' }
end
Sidekiq.configure_client do |config|
config.redis = { url: 'redis://redis:6379'}
end
RadioWorker.perform_async
TestWorker.perform_async
JazzWorker.perform_async
更新:修复了 redis 错误现在面临 dockerizing POSTGRES 的问题在 localhost:3000 上运行应用程序时,我收到此错误消息:https://imgur.com/a/YXw8N
我的 docker-compose 文件:
version: "3.0"
services:
postgres:
image: 'postgres:9.6'
environment:
- PGDATA=/var/lib/postgresql/data/pgdata
- POSTGRES_PASSWORD=
- POSTGRES_USER=postgres
networks:
- default
volumes:
- 'postgres:/var/lib/postgresql/data'
labels:
description: "Postgresql Database"
service: "postgresql"
redis:
image: redis
ports:
- 6379:6379
volumes:
- 'redis:/data'
command: redis-server --appendonly yes
web:
build:
context: "./"
dockerfile: Dockerfile-development
volumes:
- .:/src
env_file:
- './src/.env'
environment:
- REDIS-URL=redis://redis:6379/
- POSTGRES-URL=postgres://postgres:5432/
depends_on:
- redis
- postgres
ports:
- "3000:3000"
volumes:
redis:
postgres:
最佳答案
Dockerfile 用于构建镜像,而不是用于运行守护进程。 docker build 的结果是一个静态的东西(docker image)。我建议你直接从 docker-compose.yml 运行 redis
redis:
image: redis
radiofm:
(...)
depends_on: redis
(...)
PostgreSQL 的情况类似。如果你真的想在容器启动时设置你的图像以运行守护进程,你应该用脚本调整 CMD。
此外,您只能使用一次 CMD。
关于ruby-on-rails - Dockerise rails/redis/sidekiq/postgres 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48311901/
我有一个关于 Redis Pubsub 的练习,如下所示: 如果发布者发布消息但订阅者没有收到服务器崩溃。订阅者如何在重启服务器时收到该消息? 请帮帮我,谢谢! 最佳答案 在这种情况下,消息将永远消失
我们正在使用 Service Stack 的 RedisClient 的 BlockingDequeue 来保存一些数据,直到它可以被处理。调用代码看起来像 using (var client =
我有一个 Redis 服务器和多个 Redis 客户端。每个 Redis 客户端都是一个 WebSocket+HTTP 服务器,其中包括管理 WebSocket 连接。这些 WebSocket+HTT
我有多个 Redis 实例。我使用不同的端口创建了一个集群。现在我想将数据从预先存在的 redis 实例传输到集群。我知道如何将数据从一个实例传输到集群,但是当实例多于一个时,我无法做到这一点。 最佳
配置:三个redis集群分区,跨三组一主一从。当 Master 宕机时,Lettuce 会立即检测到中断并开始重试。但是,Lettuce 没有检测到关联的 slave 已经将自己提升为 master
我想根据从指定集合中检索这些键来删除 Redis 键(及其数据集),例如: HMSET id:1 password 123 category milk HMSET id:2 password 456
我正在编写一个机器人(其中包含要禁用的命令列表),用于监视 Redis。它通过执行禁用命令,例如 (rename-command ZADD "")当我重新启动我的机器人时,如果要禁用的命令列表发生变化
我的任务是为大量听众使用发布/订阅。这是来自 docs 的订阅的简化示例: r = redis.StrictRedis(...) p = r.pubsub() p.subscribe('my-firs
我一直在阅读有关使用 Redis 哨兵进行故障转移的内容。我打算有1个master+1个slave,如果master宕机超过1分钟,就把slave变成master。我知道这在 Sentinel 中是
与仅使用常规 Redis 和创建分片相比,使用 Redis 集群有哪些优势? 在我看来,Redis Cluster 更注重数据安全(让主从架构解决故障)。 最佳答案 我认为当您需要在不丢失任何数据的情
由于 Redis 以被动和主动方式使 key 过期, 有没有办法得到一个 key ,即使它的过期时间已过 (但 在 Redis 中仍然存在 )? 最佳答案 DEBUG OBJECT myKey 将返回
我想用redis lua来实现monitor命令,而不是redis-cli monitor。但我不知道怎么办。 redis.call('monitor') 不起作用。 最佳答案 您不能从 Redis
我读过 https://github.com/redisson/redisson 我发现有几个 Redis 复制设置(包括对 AWS ElastiCache 和 Azure Redis 缓存的支持)
Microsoft.AspNet.SignalR.Redis 和 StackExchange.Redis.Extensions.Core 在同一个项目中使用。前者需要StackExchange.Red
1. 认识 Redis Redis(Remote Dictionary Server)远程词典服务器,是一个基于内存的键值对型 NoSQL 数据库。 特征: 键值(key-value)型,value
1. Redis 数据结构介绍 Redis 是一个 key-value 的数据库,key 一般是 String 类型,但 value 类型多种多样,下面就举了几个例子: value 类型 示例 Str
1. 什么是缓存 缓存(Cache) 就是数据交换的缓冲区,是存贮数据的临时地方,一般读写性能较高。 缓存的作用: 降低后端负载 提高读写效率,降低响应时间 缓存的成本: 数据一致性成本 代码维护成本
我有一份记录 list 。对于我的每条记录,我都需要进行一些繁重的计算,因为我要在Redis中创建反向索引。为了达到到达记录,需要在管道中执行多个redis命令(sadd为100 s + set为1
我有一个三节点Redis和3节点哨兵,一切正常,所有主服务器和从属服务器都经过验证,并且哨兵配置文件已与所有Redis和哨兵节点一起更新,但是问题是当Redis主服务器关闭并且哨兵希望选举失败者时再次
我正在尝试计算Redis中存储的消息之间的响应时间。但是我不知道该怎么做。 首先,我必须像这样存储chat_messages的时间流 ZADD conversation:CONVERSATION_ID
我是一名优秀的程序员,十分优秀!