#

Client portal

How to enable Redis

 September 17, 2018     0 Comments

This article will show you how to enable secure Redis for use within your hosting account.

First locate "UNIXy Redis" under the advanced heading in your cpanel and click on it.

Next click on "Enable / Disable Caching" 

Next click on "Enable" and then click the submit button. After the page refreshs you should see the test "(in progress)" next to the current Redis Status. Now click go back.

Next click instance info

Here you find the connection infomation needed to connect to your local Redis server. If at first you don't see the information wait a minute and refresh. If the problem presists go back to the screen in the previous step and make sure the status is "Enabled".

Copy the IP, Port and Auth key into your redis client and connect. The example below uses php (to use this make sure the "Redis" extension is enable in php)


<?php 

print "Starting tests<pre>";

$redis = new Redis();

$ip = "IP_HERE";

$port = PORT_HERE;

$auth = "AUTH_HERE";

$redis->connect($ip, $port );

$redis->auth($auth);

print "String test: {$redis->set('string_test', 'Redis works') } \n";

$redis->delete('h');

$redis->hSet('h', 'a', 'x');

$redis->hSet('h', 'b', 'y');

$redis->hSet('h', 'c', 'z');

$redis->hSet('h', 'd', 't');

print_r([

    'string_test' => $redis->get('string_test'),

    'counter: '   => $redis->incr('key1'),

    'get hash: '  => $redis->hGetAll('h')

]);

print "</pre><br>Tests Finished";


How helpful was this article to you?