How to connect to Redis from 3rd party client?

I want to view the data inside of Redis. I’ve tried connecting using redis://localhost:6379 but I’m not sure of the credentials to use.

Where can I locate them?

The default for redis is no password.

If you are on a mac, you can use a gui like: https://apps.apple.com/us/app/red-ui-for-redis/id1491764008?mt=12

I just tried it out and could see all the keys inside a local redis.

1 Like

Thanks @mebeingken. For some reason, it’s not working for me. I’m on PC and using RESP.app which works for other redis instances.

If you use the Redis option in Wappler to install it with docker - there is also a Redis terminal available where you can execute directly all Redis commands like GET and KEYS to display data and stored keys.

1 Like

Thanks George. I found that, but I was trying to connect a GUI to more easily see the data – https://resp.app/

I’m guessing the port isn’t exposed outside of docker?

@George related to this, is there any reason I should not be able to connect to a docker redis container from the web container?

I have a custom module working in a local node server configuration using a redis connection string of: redis://localhost:6379

When I try to do the same thing with a docker desktop configuration I use a redis connection string of: redis://redis

The process just spins forever trying to connect, and I can’t figure out why.

Anybody have ideas on why?

That is all what is needed within docker. This is how we use it as well.
The container is names redis and accessible within the other docker containers like the web one.

1 Like

Thanks, that helped.

Is there an environment variable or something in the express request that will give me the redis connection host and port for the target in use?

There is no environment variable, but if you want to use it in a custom module for server connect then you can access the client with global.redisClient.

1 Like

Related to this @patrick and @mebeingken. There is shortcoming for redis connection string.

In the meantime I have another deviation from the core.

lib/setup/redis.js

const config = require('./config');

if (config.redis) {
    const redis = require('redis');
    global.redisClient = redis.createClient(config.redis === true ? 'redis://redis' : process.env.REDIS_URL);
}

module.exports = global.redisClient;

If Wappler UI flag for redis is true it will remain the same. If not it will read from the environment variable which is what I normally use.

1 Like

@kfawcett did you manage to connect to Redis in the end? I’m trying with Redis’ own redisinsight but any of the variables here, and those found online I keep getting a Could Not Connect error.

I’m using Redis with Docker on my local machine for a Node project.

Hey @mgaussie, I did not get RESP.app (now part of redisinsight) to work with redis inside of Wappler’s docker container. At the time, I believe I just used commands using the Redis CLI in Wappler to look at the data.

image

Make sure you expose a redis port (and only do for your development target)

You can then use an app to connect to the redis inside docker. I use Red on a Mac. https://echodot.com/red/

2 Likes

Thanks Ken, I ended up exposing the port and this worked.