1. Download
Open Official Website: https://redis.io/
Download---Stable---Download3.2.8, download the latest stable version, this is 3.2.8
2. Installation
When the download is complete, open the command line tool and perform the decompression command
tar zxvf redis-3.2. 8. tar. gz
Put the extracted folder to/usr/local
MV redis-3.2. 8 /usr/local/
Switch to the appropriate directory
cd/usr/local/redis-3.2. 8/
Compiling tests
sudo make Test
Compiling the installation
sudo Make Install
Start Redis
Redis-server
3. Configuration
Create a bin,etc,db three directory under the Redis directory
sudo mkdir /usr/local/redis-3.2. 8/binsudomkdir /usr/local/redis-3.2. 8/etcsudomkdir /usr/local/redis-3.2. 8/db
Copy the Mkreleasehdr.sh,redis-benchmark, Redis-check-rdb, REDIS-CLI, redis-server from the/USR/LOCAL/REDIS/SRC directory to the bin directory
CP /usr/local/redis-3.2 . 8 /src/mkreleasehdr. sh CP /usr/local/redis-3.2 . 8 /src/redis-benchmark. CP /usr/local/redis-3.2 . 8 /src/redis-check-rdb. CP /usr/local/redis-3.2 . 8 /src/redis-cli. CP /usr/local/redis-3.2 . 8 /src/redis-server.
Copy redis.conf to/usr/local/redis/etc
CP /usr/local/redis-3.2. 8/redis.conf/usr/local/redis-3.2. 8/etc
Modify Redis.conf
#修改为守护模式daemonize yes# To set the process lock file Pidfile/usr/local/redis-3.2.8/redis.pid# Ports Port6379#客户端超时时间timeout -#日志级别loglevel debug# log file location logfile/usr/local/redis-3.2.8/log-redis.log# Set the number of databases, the default database is 0, you can use select<dbid>command to specify a database on a connection iddatabases# #指定在多长时间内, the number of update operations to synchronize data to a data file, multiple conditions can be combined #save<seconds> <changes>#Redis默认配置文件中提供了三个条件: Save the 1Save - TenSave - 10000#指定存储至本地数据库时是否压缩数据, the default is Yes,redis with LZF compression, if you want to save CPU time, #可以关闭该 # option, but will cause the database file to become huge rdbcompression yes# Specify local database file name dbfilename dump.rdb# specify local database pathdir/usr/local/redis-3.2.8/db/#指定是否在每次更新操作后进行日志记录, Redis asynchronously writes data to disk by default and, if not turned on, may cause data loss over a period of time when power is lost. Because the Redis itself synchronizes data files in sync with the save conditions above, the data for # will only exist in memory for a period of time appendonly no# Specify update log conditions, there are 3 optional values: #no: Indicates that the data cache of the operating system is synchronized to disk (FAST) # Always: Represents a manual call to Fsync () to write data to disk (slow, secure) after each update operation #everysec: Indicates synchronization once per second (tradeoff, default) Appendfsync everysec
Start the service
./bin/redis-server etc/redis.conf
View Logs
tail -F Log-redis.log
Open the Redis client
./bin/redis-cli
Execute Redis command
Let's do it.
Mac System Installation Redis