Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to query a specific db inside same redis single node #34

Closed
marcossv9 opened this issue Aug 6, 2020 · 4 comments · Fixed by #35
Closed

How to query a specific db inside same redis single node #34

marcossv9 opened this issue Aug 6, 2020 · 4 comments · Fixed by #35
Assignees
Labels
documentation Improvements or additions to documentation
Milestone

Comments

@marcossv9
Copy link

Summary

We are testing this data source with a single redis node with two DBs (db1 and db2).
When running SCARD command for several KEYS in a new panel we don't know against which db is executing the command either db1 or db2.
We would like to set a specific db to run the command/query against.

Relevant information

Grafana 7.1.1
Imported dashboard is the one that comes with datasource
A new panel inside this dashboard has been created to run command and show SCARD results.

Please do let me know if you need any additional information.
Regards,

@marcossv9
Copy link
Author

Update:
We managed to get it working changing the datasource URL using the following syntax:

redis://redis-server:6379?db=1

The downside is that we need to create a specific datasource for every db.

Also should be good to show this on the datasource docs.
Regards,

@mikhail-vl mikhail-vl self-assigned this Aug 6, 2020
@mikhail-vl mikhail-vl added the documentation Improvements or additions to documentation label Aug 6, 2020
@mikhail-vl mikhail-vl added this to the Version 1.2 milestone Aug 6, 2020
@mikhail-vl
Copy link
Contributor

@marcossv9 Thank you for testing the data source and submitting the issue. Please let me know if you find anything else.

Answering your first question, by default, new connections always use database 0 (https://redis.io/commands/select). Adding select to support multiple databases can add complexity and it's not supported in the Redis Cluster, non-OSS Redis.

Why is it downside? There are no problems using multiple data sources with repeat rows for Datasource variables to show all of the them. It's the same as using multiple Redis instances.

Thank you for the tip, I will update README.

@mikhail-vl
Copy link
Contributor

@marcossv9 README updated with How to connect to Redis logical database? section.

@marcossv9
Copy link
Author

@marcossv9 Thank you for testing the data source and submitting the issue. Please let me know if you find anything else.

Answering your first question, by default, new connections always use database 0 (https://redis.io/commands/select). Adding select to support multiple databases can add complexity and it's not supported in the Redis Cluster, non-OSS Redis.

Why is it downside? There are no problems using multiple data sources with repeat rows for Datasource variables to show all of the them. It's the same as using multiple Redis instances.

Thank you for the tip, I will update README.

Thanks for your answer and clarification @mikhailredis.

For me the ideal escenario could be using same redis datasource (single redis node) and then have the option to select to which db we want to query/consult in a Dashboard instead of creating a new datasource for every db.

Having said that I think I can use Grafana variables to solve that as you said.

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants