redis / node-redis

Redis Node.js client
https://redis.js.org/
MIT License
16.85k stars 1.87k forks source link

Redis with Digital Ocean SSL_VERIFY_NONE #1552

Open EizFeren opened 3 years ago

EizFeren commented 3 years ago

Issue

Can't use Digital Ocean Redis instance with SSL_VERIFY_NONE. When client does request to redis instance, this request doesn't respond few minutes without error.

If you know how it can be correctly done, please describe.


Environment

ljluestc commented 1 month ago
const redis = require('redis');
const tls = require('tls');

// Redis Client Configuration
const redisClient = redis.createClient({
  host: 'your-digital-ocean-redis-hostname', // Replace with your Digital Ocean Redis hostname
  port: 25061, // Replace with your Redis port
  password: 'your-redis-password', // Replace with your Redis password
  tls: {
    rejectUnauthorized: false
  }
});

redisClient.on('error', err => {
  console.error('ERR:REDIS:', err);
});

redisClient.on('connect', () => {
  console.info('INFO:REDIS:Connected!');
});

// Example Usage
redisClient.set('key', 'value', redis.print);
redisClient.get('key', (err, reply) => {
  if (err) {
    console.error('ERR:REDIS GET:', err);
  } else {
    console.log('Redis GET reply:', reply);
  }
});