linux installation, startup, redis

First follow the link to download redis

Insert picture description here

Upload to any directory on the server according to xshell

Insert picture description here

Then unzip and download the tar package
tar -zvxf redis-5.0.7.tar.gz
and then move the pressurized file to the /usr/local/ directory and rename it to redis (convenient)
mv /root/redis-6.2.4 /usr /local/redis

Insert picture description here

Since redis is written in C language, its operation requires a C environment, so we need to install gcc first. The installation command is as follows:
yum install gcc-c++
enter the redis directory and execute the make command: make
make PREFIX=/usr/local/redis install

Create a folder: mkdir etc
transplant redis.conf under the etc directory.
Edit the configuration file. It is recommended to download it directly. The content of the configuration file is too much to find.
③ Modify the startup default configuration (from top to bottom):
bind #Comment Remove this part, this is to restrict redis to only local access
protected-mode no
#default yes, open protected mode, restricted to local access daemonize no#default no, changed to yes means to start as a daemon process, can run in the background, unless Kill process
databases 16 #Number of databases (optional), I modified this just to see if it took effect. .
dir ./
#Enter the local redis database storage folder (optional) appendonly yes #redis persistence (optional)
slave-read-only is no, then the slave node can also write the
port port number setting

Set boot up automatically:
vi /etc/rc.d/rc.local
Add /usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf to /etc/rc.d/ In rc.local:

Enter the bin directory to start ridis
./redis-server /usr/local/redis/etc/redis.conf to
view the redis process
ps -ef|grep redis

redis redis-cli -h specify ip -p specify port -a specify password
If it is the default port number 6379, you can directly execute redis-cli

Connect remote

redis-cli -h -p 56379

Connect locally


set password

config set requirepass pass_123456

Get password

config get requirepass

log in

auth pass_123456