Redis source package installation

Article Directory

Download the compressed package from the official website

Self upload server

Insert picture description here


tar -zxvf redis-6.2.4.tar.gz

Prepare gcc

Redis is based on c++a must-have gcc c++environment written to be able to run.


yum install gcc-c++

Check gccversion

gcc -v
Insert picture description here

Switch to the installation directory to execute compilation

Insert picture description here

make install

redisDefault installation directory

cd /usr/local/bin/


Insert picture description here

Prepare configuration file (not required)

[[email protected] bin]# mkdir redis-conf
[[email protected] bin]# cd redis-conf/
[[email protected] redis-conf]# ll
total 0
[[email protected] redis-conf]# cp /home/dw/soft/redis-6.2.4/redis.conf .
[[email protected] redis-conf]# ll
total 92
-rw-r--r--. 1 root root 93724 Jun  6 13:35 redis.conf

Modify the configuration file to start in the background

daemonize yes

bindConfiguration (this service can be accessed by the recipient ip)

# 表示所有IP都可以访问

Turn off protection mode

protected-mode no	

Turn on data persistence

appendonly yes

The modified configuration file starts

redis-server redis-conf/redis.conf 


[[email protected] bin]# redis-server redis-conf/redis.conf 
[[email protected] bin]# redis-cli> ping

Check the redisprocess

ps -ef | grep redis
Insert picture description here

redis-benchmarkPerformance Testing


Serial numberOptionsdescriptionDefaults
1-hSpecify the server host name127.0.0.1
2-pSpecify server port6379
3-sSpecify server socket
4-cSpecify the number of concurrent connections50
5-nSpecify the number of requests10000
6-dSpecify the data size of the SET/GET value in bytes2
7-k1=keep alive 0=reconnect1
8-rSET/GET/INCR uses random keys, SADD uses random values
9-PPipeline requests1
10-qForce redis to exit. Only display query/sec value
11–CsvOutput in CSV format
12* -l* (lowercase letter of L)Generate loops and execute tests forever
13-tOnly run a comma-separated list of test commands.
14* -I* (the capital letter of i)Idle mode. Only open N idle connections and wait.

Case study

# 测试:100个并发连接 100000请求
redis-benchmark -h localhost -p 6379 -c 100 -n 100000
Insert picture description here

Exit the client

[[email protected] bin]# redis-cli> exit
[[email protected] bin]# 

Turn off service

[[email protected] bin]# 
[[email protected] bin]# redis-cli> shutdown
not connected> 
not connected> 
not connected> 
[[email protected] bin]# 
[[email protected] bin]# ps -ef | grep redis
root      73766   8673  0 13:55 pts/1    00:00:00 grep --color=auto redis
[[email protected] bin]#