Articles

How to Install Redis

To install the Redis key/value store, log in to your server as the root user and run the following command:

sudo apt-get install redis-server

Once installed, Redis will listen on port 6379.

Only use Redis on a single-app server. The data stored in Redis will be accessible to all apps on your server, so it is not secure to use Redis on a server with more than one app.

Accessing Redis from PHP

To interact with the Redis server from your PHP scripts, you need to install the PHP Redis client extension.

Redis Monitor

While developing or debugging your application, you can view every command processed by the Redis server by running the following command:

$ redis-cli monitor
1339518083.107412 [0 127.0.0.1:60866] "keys" "*"
1339518087.877697 [0 127.0.0.1:60866] "dbsize"
1339518090.420270 [0 127.0.0.1:60866] "set" "x" "6"
1339518096.506257 [0 127.0.0.1:60866] "get" "x"
1339518099.363765 [0 127.0.0.1:60866] "del" "x"
1339518100.544926 [0 127.0.0.1:60866] "get" "x"

Use Ctrl-C to exit monitoring.

Customizing Your Firewall for Redis

The firewall configured by ServerPilot will block all access to Redis from outside of your server. If you need to have other servers access Redis, you'll need to customize your firewall using a tool like HeatShield.

Learn more about customizing your firewall.


Last updated: September 08, 2016