下载
我的目录是/data/redis/ 这里下载的redis
wget http://download.redis.io/releases/redis-7.0.2.tar.gz
![](https://img-blog.csdnimg.cn/f3bc8a0ddce441b69b28d5bea0d42007.png)
解压
tar -zxvf redis-7.0.2.tar.gz
进入解压目录
cd redis-7.0.2/
编译安装
make MALLOC=libc && make PREFIX=/data/app /redis-7.0.2/ install
查看是否安装完成
cd src
![](https://img-blog.csdnimg.cn/d4114a28af62474f9d41e0c6027ea756.png)
返回安装目录
cd ..
创建data文件夹
mkdir data
编辑配置文件
vi redis.conf
这里有个坑,如果你是拷贝我的所有配置你首先需要将你的配置文件清空
不然会重复,相当于这里有 bind 0.0.0.0 -::1 下面有bind 127.0.0.1 等于没有配置
我就是开始没有删除导致启动外网一直访问不了
![](https://img-blog.csdnimg.cn/e201925d6a93405885a59bc473d49ba5.png)
bind 0.0.0.0 -::1
protected-mode no
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize yes
pidfile /var/run/redis_6379.pid
loglevel notice
logfile "redis-6379.log"
databases 16
always-show-logo no
set-proc-title yes
proc-title-template "{title} {listen-addr} {server-mode}"
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
rdb-del-sync-files no
dir /data/redis-7.0.2/data
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync yes
repl-diskless-sync-delay 5
repl-diskless-sync-max-replicas 0
repl-diskless-load disabled
repl-disable-tcp-nodelay no
replica-priority 100
acllog-max-len 128
requirepass 123456
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
lazyfree-lazy-user-del no
lazyfree-lazy-user-flush no
oom-score-adj no
oom-score-adj-values 0 200 800
disable-thp yes
appendonly no
appendfilename "appendonly.aof"
appenddirname "appendonlydir"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
aof-timestamp-enabled no
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-listpack-entries 512
hash-max-listpack-value 64
list-max-listpack-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-listpack-entries 128
zset-max-listpack-value 64
hll-sparse-max-bytes 3000
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes
jemalloc-bg-thread yes
启动
cd src/
./redis-server ../redis.conf
查看是否成功
ps -ef |grep redis
![](https://img-blog.csdnimg.cn/482d2a82378d471c864d8191b1620b42.png)
|