Project

General

Profile

How to query redis directly?

Added by rigolo@gmail.com almost 6 years ago

When I look at my graphs for today, I see some “straight lines” in the graphs. Sometimes the time difference between the 2 data points in the graph are one hour, sometimes 15 minutes.
But because these are graphs related to my solar production I am not expecting these long periods of “straight lines”. Also when I look at the related kWh counters I do not see those “straight lines”
Is there a way to manually query the data in the redis datastore directly?

I noticed that there is redis-cli .. but then it is unclear to me how the data structure inside redis is set up in order to query for meaningful data.

Any pointers?


Replies (3)

RE: How to query redis directly? - Added by fjhug almost 6 years ago

I personally use rb.php (https://code.google.com/p/php-redis-browser/)
It is a simple client, which allows you to browse the local Redis server and its database.

RE: How to query redis directly? - Added by jcw almost 6 years ago

The data structures in redis are a bit tedious for manual inspection. Here’s a way to get at the list of history ID’s

% redis-cli
select 1
zrange hist:keys 0 –1 withscores

Once you have the ID, say 62, you can see all the stored data using:

zrange hist:62 0 –1 withscores

The “scores” in this case is the time-stamp in milliseconds.

To see all items stores in redis, use:

keys *

All major collections have a “name:ids” key map as well as a hash called “name”. So for example, to brows the “briqs” collection:

hgetall briqs:ids

And then see one entry with data in JSON format:

hget briqs 12

It’d be nice to have some sort of “inspection” briq to perform these lookups from the web browser for figuring out things.

PS. Same problem here: I also see some straight lines in the graphs, even though the system has been collecting (and logging) data without interruption.

RE: How to query redis directly? - Added by lwitt-fr almost 6 years ago

Sorry if my question is a bit silly (i’m a newbie in node.js and redis), but when I look at the explanation about sorted sets in Redis, it says “It is possible to specify multiple score/member pairs. If a specified member is already a member of the sorted set, the score is updated and the element reinserted at the right position to ensure the correct ordering.”

How does it work in Housemon? if you have the same value several times will it not be stored only one time and only the score (the timestamp in our case) to be updated?

    (1-3/3)