How can I check what redis port and instance sidekiq is connected to?
Asked Answered
M

3

6

I'm working with sidekiq and redis. I'm trying to find out and debug some issues but for that, I'd like to know what URL sidekiq is connecting to. I know i can check it in the file where i set my server and client, but is there a function I can use ala Resque.redis that will show what redis instance sidekiq is connected to?

Misdeal answered 4/3, 2013 at 23:28 Comment(0)
I
23

The URL info is shown at the bottom of the Web UI. Or you can use this code snippet:

Sidekiq.redis { |c| p c.client.location }
Iormina answered 5/3, 2013 at 0:34 Comment(3)
That's exactly what I was looking for! Thank you so much Mike. I knew the url was display on the web, but I didn't wanna have to go through the web panel each time.Misdeal
Does this guarantee that my Rails is success connected to redis?Cothurnus
Sidekiq 7.1.1: Sidekiq.redis {|r| puts r.config.server_url }Gametangium
G
5

With recent versions of Sidekiq, you need to use:

Sidekiq.redis { |conn| p conn.connection[:location] }

If you want to get the hash with more information:

Sidekiq.redis { |conn| p conn.connection }

Gaiseric answered 8/1, 2021 at 21:3 Comment(1)
i believe this doesn't produce a URL with the password thoughCharlenacharlene
C
2

This seems to work, clearly not intended to be a public API.

Sidekiq.redis{ |conn| conn }._client.options[:url]
Charlenacharlene answered 8/3, 2023 at 6:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.