Search The Hostwinds Guides Knowledge Base

Setup Remote Redis Node on Linux VPS

Share This Article [TheChamp-Sharing]

Redis is a flexible, high-performance database engine which supports complex operations and use-cases. You can setup a Redis server to run on your VPS and accept remote commands to modify, read, and perform operations on the database.

Step 1: Install the Redis backend


Distro Command
RHEL / CentOS / Amazon Linux sudo yum install redis
Ubuntu / Debian sudo apt-get install redis-server
Fedora sudo dnf -y install redis

Step 2: Start the Redis server backend service


Distro Command
RHEL / CentOS / Amazon Linux sudo systemctl start redis
Ubuntu / Debian sudo systemctl start redis-server.service
Fedora sudo systemctl start redis

Step 3: Verify the Redis server is running


# ps -aux | grep redis
redis 4348 ... 05:20 0:00 /usr/bin/redis-server 127.0.0.1:6379

You can also verify the server is handling requests by starting the redis-cli and issuing the ping command.

# redis-cli
127.0.0.1:6379> ping
PONG

Step 4: Get public IPv4 address using ifconfig


# ifconfig -a

Step 5: Bind the Redis server to your IPv4 address.


# sudo vi /etc/redis.conf

By default the Redis server will be bound to 127.0.0.1 which is only accessible from the server itself. To make the Redis server publicly accessible, you must bind the server to listen on network interface associated with your public IPv4.

On line 66, modify  bind 127.0.0.1 and replace the IP with your VPS IPv4

Step 6: Restart Redis


Distro Command
RHEL / CentOS / Amazon Linux sudo systemctl restart redis
Ubuntu / Debian sudo systemctl restart redis.service
Fedora sudo systemctl restart redis

Step 7: Verify external host access


Verify the server can be accessed from an external host. Using the redis-cli command on your local machine, you can provide the -h <hostname> argument to connect to the remote Redis server that was just setup on your VPS.

# redis-cli -h 104.168.165.99
104.168.165.99:6379> ping
PONG

You are now able to remotely access your Redis node on your VPS.