Pack Hosting Panel

Redis configuration

Setting up your Redis instances using Hipex CI/CD


Many applications use Redis for their caching needs. Because of this, we advice to treat your Redis configuration as code and include it as part of your codebase. In this article we explain how to set this up.


Setting up a Redis instance is as easy as adding a service to your configuration:

$redis = new RedisService('cache', 7000);

Now when your application deploys it will make sure there is a Redis instance running on port 7000 with 4GB memory.

Like any other task or service you can configure redis service for a specific stage or server roles.

$redis = new RedisService('cache', 7000);

Master / Slave setup

When running a cluster you usually run 1 redis instance as master on the load balancer and each app server gets their own redis instance.

$redisMaster = new RedisService('cache', 7000);

$redisSlave = new RedisService('cache', 7000);

The Redis instances on the servers with role ServerRole::APPLICATION will be configured as slaves to the redis instance on production123.hipex.io.


If you use Redis for your sessions (and you should) then saving the sessions to disk from time to time is not a bad idea. Again with a simple call on your Redis configuration is enough.

$redis = new RedisService('cache', 7000);

This will result in saving the Redis database to disk every 60 seconds.