redisazure-redis-cache

Connection refused on Azure Redis Cache


From my managed web server, I am trying to connect to my Azure Redis Cache. From my web space, I use this php script:

<?php

$redisHost = 'yyy.redis.cache.windows.net';
$redisPort = 6379;

$redis = new Redis();

try {
    $redis->connect($redisHost, $redisPort);
    $redis->auth('xxx');
    echo 'Connected to Redis successfully!';
} catch (Exception $e) {
    echo 'Failed to connect to Redis. Error: ' . $e->getMessage();
}
?>

From phpinfo() I know that redis is indeed enabled on the server. But when I execute the above php script, I get: Connection refused. Notice that yyy and xxx are definitely correct.

My Azure Redis Cache is up and running. I have also activated the non-SSL port 6379.

What else could be the problem?


Solution

  • It turns out that my hosting provider blocked port 6379.