I want to connect my Predis Client (PHP Redis) with node.js via SSL. It already work just on TCP. So I extended my Predis configuration:
$redis = new Predis\Client(array(
'timeout' => 5.0,
'throw_errors' => true,
'scheme' => 'ssl',
'host' => REDIS_HOST, //6379
'port' => REDIS_PORT,
'ssl' => ['local_cert' => APP.'libs/cert.pem'],
));
and I don't change Redis node.js configuration:
var redis = require('redis');
var rClient = redis.createClient();
rClient.subscribe('channel');
I got such errors when I try connect via SSL:
stream_socket_client(): SSL: crypto enabling timeout
stream_socket_client(): Failed to enable crypto
stream_socket_client(): unable to connect to ssl://111.111.111.111:6379 (Unknown error)
This connection work on such configuration (without SSL):
$redis = new Predis\Client(array(
'timeout' => 5.0,
'throw_errors' => true,
'scheme' => 'tcp',
'host' => REDIS_HOST, //6379
'port' => REDIS_PORT,
));
I have tried with 'scheme' => sslv3 and tls - errors were identical. With 'scheme' => sslv2 - error was: stream_socket_client(): failed to create an SSL handle.
The question is: how to configure Predis and Redis on node.js to connecting via SSL?
PS. I use this version of Predis library: https://github.com/RedisLabs/predis and branch: ssl.