Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 4 Rails 4.2:sidekiq无法连接到由foreman启动的Redis(Errno::EconRefused)_Ruby On Rails 4_Redis_Sidekiq_Foreman - Fatal编程技术网

Ruby on rails 4 Rails 4.2:sidekiq无法连接到由foreman启动的Redis(Errno::EconRefused)

Ruby on rails 4 Rails 4.2:sidekiq无法连接到由foreman启动的Redis(Errno::EconRefused),ruby-on-rails-4,redis,sidekiq,foreman,Ruby On Rails 4,Redis,Sidekiq,Foreman,在localhost(OS X)上的开发模式下,我使用 foreman start 我的文件是: postgresql:postgres-D供应商/postgresql redis:redis服务器供应商/redis/db/redis.conf redis slave:redis服务器供应商/redis slave/db/redis.conf sidekiq:sidekiq-C config/sidekiq.yml-q designe,1-q default-q mailer sidekiq_

在localhost(OS X)上的开发模式下,我使用

foreman start
我的文件是: postgresql:postgres-D供应商/postgresql redis:redis服务器供应商/redis/db/redis.conf redis slave:redis服务器供应商/redis slave/db/redis.conf sidekiq:sidekiq-C config/sidekiq.yml-q designe,1-q default-q mailer sidekiq_web:thin-R sidekiq.ru start-p 9292 邮件:mailcatcher-f web:bundle exec unicorn-p 3001-c./config/unicorn.rb rails:bundle exec rails s unicorn

一切都开始顺利,但sidekiq无法连接到正在运行的Redis实例,因此它将带着代码退出 但是,如果我在不同的窗口中启动每个进程,它会正常运行……我的foreman脚本会有什么问题

         $ foreman start
        01:19:21 postgresql.1  | started with pid 48166
        01:19:21 redis.1       | started with pid 48167
        01:19:21 redis-slave.1 | started with pid 48168
        01:19:21 sidekiq.1     | started with pid 48169
        01:19:21 sidekiq_web.1 | started with pid 48170
        01:19:21 mail.1        | started with pid 48171
        01:19:21 web.1         | started with pid 48172
        01:19:21 rails.1       | started with pid 48173
        01:19:21 redis-slave.1 | 48168:S 16 Aug 01:19:21.220 * Increased maximum number of open files to 10032 (it was originally set to 2560).
        01:19:21 redis-slave.1 |                 _._
        01:19:21 redis-slave.1 |            _.-``__ ''-._
        01:19:21 redis-slave.1 |       _.-``    `.  `_.  ''-._           Redis 3.0.1 (00000000/0) 64 bit
        01:19:21 redis-slave.1 |   .-`` .-```.  ```\/    _.,_ ''-._
        01:19:21 redis-slave.1 |  (    '      ,       .-`  | `,    )     Running in standalone mode
        01:19:21 redis-slave.1 |  |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6380
        01:19:21 redis-slave.1 |  |    `-._   `._    /     _.-'    |     PID: 48168
        01:19:21 redis-slave.1 |   `-._    `-._  `-./  _.-'    _.-'
        01:19:21 redis-slave.1 |  |`-._`-._    `-.__.-'    _.-'_.-'|
        01:19:21 redis-slave.1 |  |    `-._`-._        _.-'_.-'    |           http://redis.io
        01:19:21 redis-slave.1 |   `-._    `-._`-.__.-'_.-'    _.-'
        01:19:21 redis-slave.1 |  |`-._`-._    `-.__.-'    _.-'_.-'|
        01:19:21 redis-slave.1 |  |    `-._`-._        _.-'_.-'    |
        01:19:21 redis-slave.1 |   `-._    `-._`-.__.-'_.-'    _.-'
        01:19:21 redis-slave.1 |       `-._    `-.__.-'    _.-'
        01:19:21 redis-slave.1 |           `-._        _.-'
        01:19:21 redis-slave.1 |               `-.__.-'
        01:19:21 redis-slave.1 |
        01:19:21 redis-slave.1 | 48168:S 16 Aug 01:19:21.248 # Server started, Redis version 3.0.1
        01:19:21 redis-slave.1 | 48168:S 16 Aug 01:19:21.275 * DB loaded from disk: 0.028 seconds
        01:19:21 redis-slave.1 | 48168:S 16 Aug 01:19:21.275 * The server is now ready to accept connections on port 6380
        01:19:21 postgresql.1  | LOG:  database system was shut down at 2015-08-16 01:12:29 CEST
        01:19:21 postgresql.1  | LOG:  database system is ready to accept connections
        01:19:21 postgresql.1  | LOG:  autovacuum launcher started
        01:19:22 redis-slave.1 | 48168:S 16 Aug 01:19:22.254 * Connecting to MASTER localhost:6379
        01:19:22 redis-slave.1 | 48168:S 16 Aug 01:19:22.255 * MASTER <-> SLAVE sync started
        01:19:22 redis-slave.1 | 48168:S 16 Aug 01:19:22.255 * Non blocking connect for SYNC fired the event.
        01:19:22 redis-slave.1 | 48168:S 16 Aug 01:19:22.256 * Master replied to PING, replication can continue...
        01:19:22 redis-slave.1 | 48168:S 16 Aug 01:19:22.256 * Partial resynchronization not possible (no cached master)
        01:19:22 redis-slave.1 | 48168:S 16 Aug 01:19:22.268 * Full resync from master: 337a934fccebc3e0ad1627e6f06f0e061b0515e2:1
        01:19:22 redis-slave.1 | 48168:S 16 Aug 01:19:22.374 * MASTER <-> SLAVE sync: receiving 18 bytes from master
        01:19:22 redis-slave.1 | 48168:S 16 Aug 01:19:22.374 * MASTER <-> SLAVE sync: Flushing old data
        01:19:22 redis-slave.1 | 48168:S 16 Aug 01:19:22.374 * MASTER <-> SLAVE sync: Loading DB in memory
        01:19:22 redis-slave.1 | 48168:S 16 Aug 01:19:22.378 * MASTER <-> SLAVE sync: Finished with success
        01:19:23 sidekiq_web.1 | /Users/yves/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thin-1.6.3/lib/thin/backends/base.rb:103: warning: epoll is not supported on this platform
        01:19:23 sidekiq.1     | exited with code 0
        01:19:23 system        | sending SIGTERM to all processes
        01:19:23 postgresql.1  | LOG:  received smart shutdown request
        01:19:23 redis-slave.1 | 48168:signal-handler (1439680763) Received SIGTERM scheduling shutdown...
        01:19:23 postgresql.1  | LOG:  autovacuum launcher shutting down
        01:19:23 postgresql.1  | LOG:  shutting down
        01:19:23 redis.1       | exited with code 0
        01:19:23 redis-slave.1 | 48168:S 16 Aug 01:19:23.505 # Connection with master lost.
        01:19:23 redis-slave.1 | 48168:S 16 Aug 01:19:23.505 * Caching the disconnected master state.
        01:19:23 web.1         | terminated by SIGTERM
        01:19:23 mail.1        | terminated by SIGTERM
        01:19:23 rails.1       | terminated by SIGTERM
        01:19:23 sidekiq_web.1 | terminated by SIGTERM
        01:19:23 postgresql.1  | LOG:  database system is shut down
        01:19:23 postgresql.1  | exited with code 0
        01:19:23 redis-slave.1 | 48168:S 16 Aug 01:19:23.575 # User requested shutdown...
        01:19:23 redis-slave.1 | 48168:S 16 Aug 01:19:23.575 # Redis is now ready to exit, bye bye...
        01:19:23 redis-slave.1 | exited with code 0
        yves@MacMini: recommence $ ps aux | grep redis
        yves            48330   0.0  0.0  2441988    672 s000  S+    1:26AM   0:00.01 grep redis
        yves@MacMini: recommence $ foreman start
        01:26:26 postgresql.1  | started with pid 48353
        01:26:26 redis.1       | started with pid 48354
        01:26:26 redis-slave.1 | started with pid 48355
        01:26:26 sidekiq.1     | started with pid 48356
        01:26:26 sidekiq_web.1 | started with pid 48357
        01:26:26 mail.1        | started with pid 48358
        01:26:26 web.1         | started with pid 48359
        01:26:26 rails.1       | started with pid 48360
        01:26:26 redis-slave.1 | 48355:S 16 Aug 01:26:26.464 * Increased maximum number of open files to 10032 (it was originally set to 2560).
        01:26:26 redis-slave.1 |                 _._
        01:26:26 redis-slave.1 |            _.-``__ ''-._
        01:26:26 redis-slave.1 |       _.-``    `.  `_.  ''-._           Redis 3.0.1 (00000000/0) 64 bit
        01:26:26 redis-slave.1 |   .-`` .-```.  ```\/    _.,_ ''-._
        01:26:26 redis-slave.1 |  (    '      ,       .-`  | `,    )     Running in standalone mode
        01:26:26 redis-slave.1 |  |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6380
        01:26:26 redis-slave.1 |  |    `-._   `._    /     _.-'    |     PID: 48355
        01:26:26 redis-slave.1 |   `-._    `-._  `-./  _.-'    _.-'
        01:26:26 redis-slave.1 |  |`-._`-._    `-.__.-'    _.-'_.-'|
        01:26:26 redis-slave.1 |  |    `-._`-._        _.-'_.-'    |           http://redis.io
        01:26:26 redis-slave.1 |   `-._    `-._`-.__.-'_.-'    _.-'
        01:26:26 redis-slave.1 |  |`-._`-._    `-.__.-'    _.-'_.-'|
        01:26:26 redis-slave.1 |  |    `-._`-._        _.-'_.-'    |
        01:26:26 redis-slave.1 |   `-._    `-._`-.__.-'_.-'    _.-'
        01:26:26 redis-slave.1 |       `-._    `-.__.-'    _.-'
        01:26:26 redis-slave.1 |           `-._        _.-'
        01:26:26 redis-slave.1 |               `-.__.-'
        01:26:26 redis-slave.1 |
        01:26:26 redis-slave.1 | 48355:S 16 Aug 01:26:26.467 # Server started, Redis version 3.0.1
        01:26:26 redis-slave.1 | 48355:S 16 Aug 01:26:26.467 * DB loaded from disk: 0.000 seconds
        01:26:26 redis-slave.1 | 48355:S 16 Aug 01:26:26.467 * The server is now ready to accept connections on port 6380
        01:26:26 redis-slave.1 | 48355:S 16 Aug 01:26:26.469 * Connecting to MASTER localhost:6379
        01:26:26 redis-slave.1 | 48355:S 16 Aug 01:26:26.470 * MASTER <-> SLAVE sync started
        01:26:26 redis-slave.1 | 48355:S 16 Aug 01:26:26.470 * Non blocking connect for SYNC fired the event.
        01:26:26 redis-slave.1 | 48355:S 16 Aug 01:26:26.470 * Master replied to PING, replication can continue...
        01:26:26 redis-slave.1 | 48355:S 16 Aug 01:26:26.471 * Partial resynchronization not possible (no cached master)
        01:26:26 redis-slave.1 | 48355:S 16 Aug 01:26:26.471 * Full resync from master: f55a717fbd36511c5581e081e154c8e557499754:1
        01:26:26 postgresql.1  | LOG:  database system was shut down at 2015-08-16 01:19:23 CEST
        01:26:26 postgresql.1  | LOG:  autovacuum launcher started
        01:26:26 postgresql.1  | LOG:  database system is ready to accept connections
        01:26:26 redis-slave.1 | 48355:S 16 Aug 01:26:26.557 * MASTER <-> SLAVE sync: receiving 18 bytes from master
        01:26:26 redis-slave.1 | 48355:S 16 Aug 01:26:26.558 * MASTER <-> SLAVE sync: Flushing old data
        01:26:26 redis-slave.1 | 48355:S 16 Aug 01:26:26.558 * MASTER <-> SLAVE sync: Loading DB in memory
        01:26:26 redis-slave.1 | 48355:S 16 Aug 01:26:26.558 * MASTER <-> SLAVE sync: Finished with success
        01:26:27 sidekiq_web.1 | /Users/yves/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thin-1.6.3/lib/thin/backends/base.rb:103: warning: epoll is not supported on this platform
        01:26:27 sidekiq.1     | exited with code 0
        01:26:27 system        | sending SIGTERM to all processes
        01:26:27 postgresql.1  | LOG:  received smart shutdown request
        01:26:27 redis-slave.1 | 48355:signal-handler (1439681187) Received SIGTERM scheduling shutdown...
        01:26:27 postgresql.1  | LOG:  autovacuum launcher shutting down
        01:26:27 postgresql.1  | LOG:  shutting down
        01:26:27 postgresql.1  | LOG:  database system is shut down
        01:26:27 redis.1       | exited with code 0
        01:26:27 redis-slave.1 | 48355:S 16 Aug 01:26:27.991 # Connection with master lost.
        01:26:27 redis-slave.1 | 48355:S 16 Aug 01:26:27.991 * Caching the disconnected master state.
        01:26:27 redis-slave.1 | 48355:S 16 Aug 01:26:27.997 # User requested shutdown...
        01:26:27 redis-slave.1 | 48355:S 16 Aug 01:26:27.997 # Redis is now ready to exit, bye bye...
        01:26:27 redis-slave.1 | exited with code 0
        01:26:27 postgresql.1  | exited with code 0
        01:26:28 mail.1        | terminated by SIGTERM
        01:26:28 sidekiq_web.1 | terminated by SIGTERM
        01:26:28 rails.1       | terminated by SIGTERM
        01:26:28 web.1         | terminated by SIGTERM
尝试“127.0.0.1”或“::1”而不是“localhost”。IPv6与IPv4有时可能会比较棘手。

尝试“127.0.0.1”或“::1”而不是“localhost”。IPv6与IPv4有时会比较棘手

        WARN: Unresolved specs during Gem::Specification.reset:
              minitest (~> 5.1)
        WARN: Clearing out unresolved specs.
        Please report a bug if this causes problems.
        2015-08-15T23:19:29.882Z 48183 TID-oxy6u8hqw INFO: Booting Sidekiq 3.4.2 with redis options {:url=>"redis://localhost:6379/0", :driver=>:hiredis}
        2015-08-15T23:19:32.130Z 48183 TID-oxy6u8hqw INFO: Running in ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
        2015-08-15T23:19:32.130Z 48183 TID-oxy6u8hqw INFO: See LICENSE and the LGPL-3.0 for licensing details.
        2015-08-15T23:19:32.130Z 48183 TID-oxy6u8hqw INFO: Upgrade to Sidekiq Pro for more features and support: http://sidekiq.org/pro
        2015-08-15T23:19:32.235Z 48183 TID-oxy6qw1tk ERROR: Error fetching message: Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED)
        2015-08-15T23:19:32.235Z 48183 TID-oxy6qw1tk ERROR: /Users/yves/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/redis-3.2.1/lib/redis/client.rb:331:in `rescue in establish_connection'