published under license Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)copy! share!
posted in category Software Development & Programming / Rails Sidekiq & Redis
posted at 24. Aug '21
Howto Inspect Sidekiq Queues Directly With Redis Commands
Because sometimes Sidekiq interface is not available. Commands are specific for types, therefore the most important thing is to list data and it’s type. Using from Redis CLI will be similar.
# rails console
r = Redis.new
# list keys
pp r.keys.select{|k| k !~ /stat/ }.map{|k| [k, r.type(k)]}; nil
[["queue:api", "list"],
["dead", "zset"],
["queues", "set"],
["retry", "zset"],
["ec5ec2a0e9d3:1:fe1000f40d66", "hash"],
["processes", "set"],
["schedule", "zset"]]
=> nil
r.hgetall "ec5ec2a0e9d3:1:fe1000f40d66"
=> {"quiet"=>"false", "info"=>"{\"hostname\":\"ec5ec2a0e9d3\",\"started_at\":1579787753.5046794,\"pid\":1,\"tag\":\"app\",\"concurrency\":25,\"queues\":[\"default\",\"mailers\"],\"labels\":[],\"identity\":\"ec5ec2a0e9d3:1:fe1000f40d66\"}", "beat"=>"1579791952.047832", "busy"=>"0"}
r.lrange "queue:api", 0, 100
=> ["{\"class\":\"ApiWorker\",\"args\":[\"26\"],\"retry\":true,\"queue\":\"api\",\"throttle\":{\"threshold\":4,\"period\":\"15\"},\"backtrace\":true,\"jid\":\"e7b7ca29e568cf1a1fd2570a\",\"created_at\":1562264868.547173,\"enqueued_at\":1562264879.8490522}", "{\"class\":\"ApiWorker\",\"args\":[\"30\"],\"retry\":true,\"queue\":\"api\",\"throttle
r.smembers "processes"
=> ["ec5ec2a0e9d3:1:fe1000f40d66"]
r.smembers "queues"
=> ["default", "mailers", "api"]
Add Comment