1. # 设置后台启动
    2. daemonize yes
    3. # 开启保护模式
    4. protected-mode yes
    5. # 根目录文件件
    6. dir "/home/redis/redis-4.0.10/data"
    7. # pid文件存放位置
    8. pidfile "/home/redis/redis-4.0.10/run/redis.pid"
    9. # 绑定ip
    10. bind 0.0.0.0
    11. # 绑定端口
    12. port 6379
    13. # 当客户端空闲时自动关闭连接的时间,0:永远不关闭
    14. timeout 0
    15. #
    16. tcp-keepalive 0
    17. loglevel notice
    18. # 日志位置
    19. logfile "/home/redis/redis-4.0.10/logs/redis.log"
    20. databases 16
    21. # Snapshotting
    22. save 900 1
    23. save 300 10
    24. save 60 10000
    25. # 停止写操作当bgsave错误
    26. stop-writes-on-bgsave-error yes
    27. # 开启rdb压缩
    28. rdbcompression yes
    29. # 开启rdb校验
    30. rdbchecksum yes
    31. # rdb的导出位置
    32. dbfilename "dump.rdb"
    33. # Limits 最大客户端
    34. maxclients 10000
    35. # allkeys volatile allkeys random
    36. maxmemory-policy noeviction
    37. # Security
    38. #当前redis密码
    39. #requirepass redis123456
    40. # Replication
    41. slave-serve-stale-data yes
    42. slave-read-only yes
    43. repl-disable-tcp-nodelay no
    44. slave-priority 98
    45. min-slaves-max-lag 10
    46. #masterauth redis123456
    47. # Append Only Mode
    48. appendonly yes
    49. # appendfsync always
    50. appendfsync everysec
    51. # appendfsync no
    52. no-appendfsync-on-rewrite no
    53. auto-aof-rewrite-percentage 100
    54. auto-aof-rewrite-min-size 64mb
    55. # Lua 脚本时间限制
    56. lua-time-limit 5000
    57. # Slow Log
    58. slowlog-log-slower-than 10000
    59. slowlog-max-len 128
    60. # Event Notification
    61. notify-keyspace-events ""
    62. # Advanced
    63. hash-max-ziplist-entries 512
    64. hash-max-ziplist-value 64
    65. list-max-ziplist-entries 512
    66. list-max-ziplist-value 64
    67. set-max-intset-entries 512
    68. zset-max-ziplist-entries 128
    69. zset-max-ziplist-value 64
    70. activerehashing yes
    71. client-output-buffer-limit normal 0 0 0
    72. client-output-buffer-limit slave 256mb 64mb 60
    73. client-output-buffer-limit pubsub 32mb 8mb 60
    74. hz 10
    75. aof-rewrite-incremental-fsync yes