运维Redis集群的核心任务就是配置文件Redis.conf
命令行将现使用的Redis配置参数导出到 redis.conf.bak文件
grep ‘^[^#]‘ /etc/redis/redis-7000.conf > redis.conf.bak
查看文件内容
# 关闭保护模式,让其他主机连接 protected-mode no # 设置端口为7000 port 7000 # tcp 连接等待队列长度 tcp-backlog 511 timeout 0 tcp-keepalive 300 # 开始后台模式 daemonize yes supervised no # 进程文件 pidfile /var/run/redis_7000.pid loglevel notice # 日志文件保存位置 logfile "/usr/local/redis/log/redis-7000.log" databases 16 # 设置多少微秒内发生几次写入内存keys到哈希槽时,执行copy-on-write save 900 1 save 300 10 save 60 10000 # 后台备份出错时,是否停止写入keys到哈希槽 stop-writes-on-bgsave-error yes # 数据文件是否压缩 rdbcompression yes # 数据文件执行校验 rdbchecksum yes # 数据文件保存位置 dbfilename dump-7000.rdb # 数据文件保存的目录 dir /usr/local/redis # 主机授权密码 masterauth foobared 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 # 认证密码 requirepass foobared # 最大客户端连接数 maxclients 4096 # 是否执行边写入keys边吧备份keys到磁盘 appendonly no 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 # 启用集群 cluster-enabled yes # 集群配置文件 cluster-config-file /usr/local/redis/nodes/nodes-7000.conf 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
时间: 2024-09-30 07:03:36