当我运行
时,sidekiq和sidekiq-scheduler出了点问题bundle exec sidekiq -C config/sidekiq.yml
但我没有找到webui的任务,就像这样:
并且sidekiq正在运行,如下所示:
现在下面是我的配置:
配置/ redis.yml
development: 'redis://127.0.0.1:6379/10'
test: 'redis://127.0.0.1:6379/10'
production: 'redis://127.0.0.1:6379/10'
配置/初始化/ sidekiq.rb
Sidekiq.configure_server do |config|
redis_config = YAML.load_file(Rails.root.to_s + "/config/redis.yml")[Rails.env.to_s]
redis_conn = proc{
Redis.new(url: redis_config)
}
Sidekiq.configure_client do
config.redis = ConnectionPool.new(size: 5,&redis_conn)
end
Sidekiq.configure_server do
config.redis = ConnectionPool.new(size: 10,&redis_conn)
end
Sidekiq.default_worker_options = { :backtrace => true }
# start onece job
SidekiqInitAppJob.set(wait: 2.minutes).perform_later
end
配置/ sidekiq.yml
:verbose: false
:pidfile: ./tmp/pids/sidekiq.pid
:logfile: ./log/sidekiq.log
:concurrency: 5
:queues:
- default
- [mailers,2]
development:
:concurrency: 5
production:
:concurrency: 5
# bundle exec sidekiq -C config/sidekiq.yml
#sidekiq-scheduler
tasks: &tasks
FetchBaiduHotMusicJob:
# every: ["10s"]
cron: '0 0 2 * * 1 Beijing'
queue: default
description: '热歌榜'
FetchBaiduNewestMusicJob:
# every: ["10s"]
cron: '0 0 2 * * 2 Beijing'
queue: default
description: '新歌榜'
BuildSearchMusicJob:
# every: ["10s"]
cron: '0 0 2 * * 3 Beijing'
queue: default
description: '热搜榜'
FetchBaiduPopMusicJob:
# every: ["10s"]
cron: '0 0 2 * * 4 Beijing'
queue: default
description: '流行榜'
FetchBaiduKtvMusicJob:
# every: ["10s"]
cron: '0 0 2 * * 5 Beijing'
queue: default
description: 'KTV'
FetchBaiduMovieMusicJob:
# every: ["10s"]
cron: '0 0 2 * * 6 Beijing'
queue: default
description: '影视金曲榜'
FetchBaiduChineseMusicJob:
# every: ["10s"]
cron: '0 0 2 * * 7 Beijing'
queue: default
description: '华语金曲榜'
FetchBaiduForeignMusicJob:
# every: ["10s"]
cron: '0 0 3 * * 1 Beijing'
queue: default
description: '外语金曲榜'
FetchBaiduClassicMusicJob:
# every: ["10s"]
cron: '0 0 3 * * 2 Beijing'
queue: default
description: '经典老歌榜'
FetchBaiduRockMusicJob:
# every: ["10s"]
cron: '0 0 3 * * 3 Beijing'
queue: default
description: '摇滚榜'
FetchBaiduDuetMusicJob:
# every: ["10s"]
cron: '0 0 3 * * 4 Beijing'
queue: default
description: '情歌对唱榜'
FetchBaiduJazzMusicJob:
# every: ["10s"]
cron: '0 0 3 * * 5 Beijing'
queue: default
description: '爵士榜'
FetchBaiduNetMusicJob:
# every: ["10s"]
cron: '0 0 3 * * 6 Beijing'
queue: default
description: '网络红歌榜'
:schedule:
<<: *tasks
**我发现它像这样运行,但在网络上也找不到重复工作**
FetchBaiduNetMusicJob:
every: ["10s"]
#cron: '0 0 3 * * 6 Beijing'
queue: default
description: '网络红歌榜'
在运行sidekiq之前,我命令redis到 flushall 删除所有数据,那我该怎么办?我用rails做了什么重复工作让它在windows和ubuntu之间运行?
请帮助我。
非常感谢!