Fetching data from redis database

Hello,
I have some data in redis stored in database, how can I fetch that data from that redis in node-red
please help me out...

Please try searching the flow library and the forum first. There are already several nodes available.

https://flows.nodered.org/search?term=redis&type=node

I can recommend node-red-contrib-redis.

1 Like

I have been using this, but how to configure this nodes and fetch the data not getting it, as I'm a newbie regarding redis

You say you have data in redis... did you put it there? What information have you been given about your redis database and where the data is stored?

I'm sure we can help... but at the moment you have not given enough information for us to give you any help other than point you at the redis nodes.

That show the data you want is stored under the field name of imwAccessToken in a hash called IMWhash.

This means he raw redis command to run is HGET IMWhash imwAccessToken - the question is how to do that with the redis nodes.

Using the node-red-contrib-redis module, you have the redis command node. You can use that to do the HGET command to get the value.

First you'll need to configure the server details, then set the Command to HGET and then put something in the Params section. Unfortunately, at this point, I don't know how the node expects you to provide the arguments to the command. It suggests it should be an object, but I don't know how to enter the IMWhash imwAccessToken args to an object. The node doesn't provide any help.

@kuema - have you use this node? Can you provide some guidance?

@knolleary What we have to give in the topic/key section?

Or if there is any alternative you can suggest me and help me out with this

Right at this moment I don't have access to the machine running that flow using Redis.

Yes, the docs leave room for improvement. But the example flows on node-red-contrib-redis (node) - Node-RED should give the general idea about its usage.

with this flows, I had gone through I'm not able to get the data, I'm not getting what to fill in topic/key and params

This is my best guess - I haven't used these nodes and their documentation is terrible:

  • Put IMWhash in the Topic/Key field
  • Put ["imwAccessToken"] in the params field

If that doesn't work, leave the Topic/Key field blank, and put ["IMWhash","imwAccessToken"] in the params field.

With the HGET command, the solution Nick (@knolleary) described should work.

"Topic/Key" is used as name of the Hash, so use IMWhash
"params" is an array, in this case one element with the name of the key in the hash, so imwAccessToken.

Took me some try/error myself back then, the docs (if you could call them that) aren't even up-to-date.

I have worked with this both things but it didn't work out.
I have one doubt in my system I have to install redis server?

I have just tested it, it works for me.

[{"id":"80433c4d.36b5a8","type":"redis-command","z":"7ebee689.bd529","server":"6d99f483.4e4f1c","command":"hget","name":"","topic":"IMWhash","params":"[\"imwAccessToken\"]","paramsType":"json","payloadType":"json","block":false,"x":560,"y":1280,"wires":[["ce325093.9c43a8"]]},{"id":"ce325093.9c43a8","type":"debug","z":"7ebee689.bd529","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":850,"y":1280,"wires":[]},{"id":"88687136.c00c38","type":"inject","z":"7ebee689.bd529","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":310,"y":1280,"wires":[["80433c4d.36b5a8"]]},{"id":"6d99f483.4e4f1c","type":"redis-config","z":"","name":"local","options":"{}","cluster":false,"optionsType":"json"}]

I tried what @kuema have tried but I'm getting null value.

If it returns null, then there is no value for the combination of hash and/or key. You should check the names for typos.

Otherwise, I'm out of suggestions.

as i have shared the screenshot of it there is some value present, so why its giving us a null value

by the way thank you for your suggestions

Is there any alternative rather than using node we can do scripting in function node and we can get?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.