Redis installation & configuration & remote connection

1. yum install redis:

Use the command directly to install redis into the linux server:

yum -y install redis

2. Start redis:

In xshell, you can use the following command to start redis in the background:

[root@VM-8-17-centos /]# redis-server /etc/redis.conf &

3. Operation redis:

Start the redis client first:

[root@VM-8-17-centos /]# redis-cli

After starting, you can operate it according to actual needs.

3.1 View built-in information:

Use the following command:

127.0.0.1:6379> info

Note: If you set a password for redis later, you cannot use info directly, but you must first authenticate:

127.0.0.1:6379> auth "yourpassword"
OK
127.0.0.1:6379> info

4. Remote connection:

The above are all local operations. Remote connection requires changing some information in the redis.conf configuration file:

4.1 Steps:

        Enter the /etc/ directory, find the redis.conf file, open it, and modify it as needed:

        Options that must be modified for remote connections:

(1) Comment out "bind 127.0.0.1" in redis.conf;

 (2) Change "protected-mode yes" in redis.conf to "protected-mode no":

        The purpose is to change the protected mode, otherwise you cannot connect remotely

 (3) Close the redis service first

redis-cli shutdown

        Start the redis service again

redis-server /etc/redis.conf

4.3 Release the Redis port:

After the configuration is set, you must also ensure that the redis port is available and prevent the cloud server's firewall from blocking it:

Log in to your cloud server and add a custom rule:

4.3 The last step, connect:

        Use the redis visualization tool Another Redis Desktop Manager:

 connection succeeded:

Guess you like

Origin blog.csdn.net/m0_65190367/article/details/132237600