继吉 发表于 2018-11-2 08:06:31

Redis 之 安装步骤

# cat /etc/redis.conf | grep -v '#' | grep -v '^$'  bind 127.0.0.1          #绑定本机可访问,可修改为本机的IP地址,或0.0.0.0
  protected-mode yes
  port 6379               #redis 启动端口
  tcp-backlog 511
  timeout 0               #会话连接保持时间,0为不限制
  tcp-keepalive 300
  daemonize no      #是否后台运行,应设置为yes
  supervised no
  pidfile /var/run/redis_6379.pid   #redis_pid存放位置
  loglevel notice                              #日志等级
  logfile /var/log/redis/redis.log      #日专存放路径
  databases 16                               #总共有17个数据库
  save 900 1                                 #900秒 有一个key变化,即把内存数据写入dump.rdb文件
  save 300 10                                 #300秒 有10个key变化,即把内存数据写入dump.rdb文件
  save 60 10000                           #60秒有1万个key变化,即把内存数据写入dump.rdb文件
  stop-writes-on-bgsave-error yes
  rdbcompression yes                   #启用压缩
  rdbchecksum yes
  dbfilename dump.rdb               #rdb文件名
  dir /var/lib/redis                           #指定rdb的存放路径
  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 no                        #是否开启aof,永久持久化
  appendfilename "appendonly.aof"         #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

页: [1]
查看完整版本: Redis 之 安装步骤