docker 安装redis 挂载文件
docker 安装redis 挂载文件准备挂载目录mkdir -p /root/app/redis/confmkdir -p /root/app/redis/data下载redis.confwget http://download.redis.io/redis-stable/redis.conf更改以下内容vim redis.confbind 127.0.0.1 #注释掉这部分,这是限制redis
·
docker 安装redis 挂载文件
准备挂载目录
mkdir -p /root/app/redis/conf
mkdir -p /root/app/redis/data
下载redis.conf
wget http://download.redis.io/redis-stable/redis.conf
更改以下内容
vim redis.conf
bind 127.0.0.1 #注释掉这部分,这是限制redis只能本地访问
protected-mode no #默认yes,开启保护模式,限制为本地访问
daemonize no#默认no,改为yes意为以守护进程方式启动,可后台运行,除非kill进程(可选),改为yes会使配置文件方式启动redis失败
dir ./ #输入本地redis数据库存放文件夹(可选)
appendonly yes #redis持久化(可选)
不能下载的把下面内容写入redis.conf
protected-mode no
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 0
loglevel notice
logfile ""
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir ./
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
appendonly yes
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
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
aof-rewrite-incremental-fsync yes
daemonize no
将文件拷贝到conf包
mv redis.conf /root/app/redis/conf
安装启动redis
docker run -d --privileged=true -p 16379:6379 --restart always -v /root/app/redis/conf/redis.conf:/etc/redis/redis.conf -v /root/app/redis/data:/data --name myredis redis redis-server /etc/redis/redis.conf --appendonly yes
测试连接
更多推荐
已为社区贡献2条内容
所有评论(0)