wget http://download.redis.io/releases/redis-4.0.2.tar.gz
tar -xvf redis-4.0.2.tar.gz
cd redis-4.0.2
make
src/redis-server [指定配置文件]
netstat -lnpt |grep redis
src/redis-cli [-p 服务监听的端口]
daemonize yes
pidfile /var/run/redis6380.pid
port 6380 # 端口
timeout 0
tcp-keepalive 0
loglevel notice
logfile stdout
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
protected-mode no
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /data/redis/redis6380 # 持久化目录,应当实现创建好这个路径
slave-serve-stale-data yes
slave-read-only yes
repl-disable-tcp-nodelay no
slave-priority 100
appendonly no
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
报如下错,是gcc没有安装
cd src && make all
make[1]: Entering directory `/root/redis-4.0.2/src'
CC Makefile.dep
make[1]: Leaving directory `/root/redis-4.0.2/src'
make[1]: Entering directory `/root/redis-4.0.2/src'
CC adlist.o
/bin/sh: cc: command not found
make[1]: *** [adlist.o] Error 127
make[1]: Leaving directory `/root/redis-4.0.2/src'
make: *** [all] Error 2
yum -y install gcc
make时报如下错误:
zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory
zmalloc.h:55:2: error: #error "Newer version of jemalloc required"
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory `/data0/src/redis-2.6.2/src'
make: *** [all] Error 2
make MALLOC=libc
make之后,会出现一句提示
Hint: To run 'make test' is a good idea ;)
但是不测试,通常是可以使用的。若我们运行make test ,会有如下提示
[devnote@devnote src]$ make test
You need tcl 8.5 or newer in order to run the Redis test
make: ***[test] Error_1
sudo apt install redis-server
sudo /etc/init.d/redis-server start
redis-cli
127.0.0.1:6379>
CONFIG GET *
CONFIG SET CONFIG_SETTING_NAME NEW_CONFIG_VALUE