Download the Redis installation file

$wget https://download.redis.io/releases/redis-6.2.5.tar.gz $tar XZVF redis - 6.2.5. Tar. Gz $cdRedis - 6.2.5 $makeCopy the code

Generate the bin directory file

$make install PREFIX=/ncayu/redis-6.2. 5

[root@ncayu8847 redis-6.2. 5]# make install  PREFIX=/ncayu/redis-6.2. 5
cd src && make install
make[1]: Entering directory ` / ncayu/redis - 6.2.5 / SRC 'Copy the code

Conf configuration file

It is important to modify the redis.conf configuration file

1.1 NETWORK Settings:

# 1.1NETWORK setting: bind192.168127.128. // Bind IP address,You can run ifconfig to obtain the Ip address (in Linux) port6379 // Retain the default value. You can also change timeout 30 // The timeout period for the Client to be idle and disconnected
Copy the code

1.2 GENERAL Settings:

# 1.2GENERAL Setting: daemonize yes// The default value is no, change the value to yes, and run in background modeLogfile Settings/root/application/program/redis - tool/logs/redis log// Log file locationPid set pidfile /ncayu/redis-6.2. 5/run/redis_6380.pid
Copy the code

1.3 SNAPSHOTTING set

# 1.3SNAPSHOTTING Settings: dir/root/application/program/redis - tool/data//SNAPSHOTTING File path
Copy the code

1.4 appendfsync always

# 1.4APPEND ONLY MODE setting :(this parameter is not modified.) appendonly no// The default value is No, which means that instead of AOF incremental persistence, RDB full persistence is used. Set No to Yes and use the AOF incremental persistence method appendfsync always
Copy the code

1.5 Setting the Password of Redis

# 1.5Set the password requirePass ncayu123456 for RedisCopy the code

File to be created

Conf data logs run # mkdir conf data logs runCopy the code

Connect the redis

Bin /redis-server conf/redis.conf [root@ncayu8847 redis-6.2. 5]# bin/redis-cli -p 6380 -h 172.183.. 0 
172.183.. 0:6380> 
172.183.. 0:6380> 
172.183.. 0:6380> 
172.183.. 0:6380> 
172.183.. 0:6380> set h1 
shanghai OK 
172.183.. 0:6380> get h1 
"shanghai" 
172.183.. 0:6380> ping 
PONG 
172.183.. 0:6380>
Copy the code

Redis – desktop – manager connection

Redis is also available in Redis-desktop-Manager and is now installed. Enjoy using Redis!