Getting Redis up and running with the default out of box configuration file is straightforward and easy. Once you have it working, we recommend you follow the Learn how to Tune Redis learning path to improve Redis performance.
By default Redis runs on localhost (127.0.0.1
) on port 6379. As a result, port 6379 becomes unavailable for binding with the public IP of the remote server. You need to set the bind configuration option in the redis.conf
file to 0.0.0.0
.
For a single-node Redis server, set the following configuration options as shown in the redis.conf
file:
bind 0.0.0.0
port 6379
protected-mode yes
cluster-enabled no
daemonize yes
appendonly no
To connect to the remote Redis server, you need to use Redis Client (redis-cli
) with:
Execute the steps below to connect to the remote Redis server from your local machine.
sudo apt install redis-tools
redis-cli
:
redis-cli -h <public-IP-address> -p 6379
The output from this command will be similar to:
ubuntu@ip-172-31-38-39:~$ redis-cli -h 172.31.30.40 -p 6379
172.31.30.40:6379>
playbook.yaml
file using AUTH
.
An example of authorizing Redis is shown below:
172.31.30.40:6379> ping
(error) NOAUTH Authentication required.
172.31.30.40:6379> AUTH 123456789
OK
172.31.30.40:6379> ping
PONG
172.31.30.40:6379> set name test
OK
172.31.30.40:6379> get name
"test"
172.31.30.40:6379>
You have successfully installed Redis in a single-node configuration.