Introduction
Redis is an open source (BSD licensed), in-memory data structure store used as a database, cache, and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperlogs, geospatial indexes with radius queries and streams. Redis has built-in replication, Lua scripts, LRU evictions, transactions and different levels of disk durability, and provides high availability through Redis Sentinel and automatic partitioning using Redis Cluster.
What is redis?
Memory-based key-value database supports automatic/manual persistence.
Performance:
The following is the official benchmark-mark data:
The test was completed with 50 concurrent executions of 100,000 requests.
The value set and obtained is a 256-byte string.
Result: The reading speed is 110000 times/s and the writing speed is 81000 times/s
Supported languages
Redis official website
Redis
redis.io/
Data types supported by Redis
String, hash, list, set, sorted set
Install
Install dependencies
yum install gcc-c -y
Create installation directory, compile and install
download link
wget http://download.redis.io/releases/redis-5.0.5.tar.gz
# -p Make sure the directory name exists, if not, create one
mkdir -p /home/software/redis
# -z: with gzip attribute, -x: decompression, -v: display all processes, -f: use the file name. Remember, this parameter is the last parameter, and can only be followed by the file name
tar zxvf redis-3.0.6.tar.gz
cd redis-3.0.6
# make is used for compilation. It reads instructions from the Makefile and then compiles
# make install is used for installation. It also reads instructions from the Makefile and installs it to the specified location. PREFIX selects the directory to be installed
make && make PREFIX=/home/software/redis install
Copy the configuration file and start
cd redis-5.0.5/
cp redis.conf /home/software/redis/bin
Modify /usr/local/redis/bin/redis.conf (the following modifications are based on redis5.0.5, other versions of redis may have differences)
Use the vim editor and enter: set number to display the number of lines (provided you have vim installed)
# Whether to serve as a daemon thread, Redis will write the pid file in /var/run/ Redis. When monitoring pid
At line 136
daemonize yes
If you need to modify the number of instances
At line 186
databases 32
Comment binding ip, you can connect to redis with ip
#bind 127.0.0.1
Add access password
At line 507
requirepass redis
start up
Switch to the bin directory under the installation directory
Execute the command. This configuration file is the one we just copied from the decompression directory
./redis-server redis.conf
Check the process
ps -ef | grep redis
Test connection
The above is the detailed content of How to install Redis on Centos7. For more information, please follow other related articles on the PHP Chinese website!