PageSourceSearch

https://montplex.com/static/js/async/5007.6de8c4db.js

js montplex.com collected 2026-10-03 21:17:07 UTC 14,185 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkengula_website=self.webpackChunkengula_website||[]).push([["5007"],{174:function(e,n,s){s.r(n),s.d(n,{default:()=>h});var r=s(2676),d=s(453);function i(e){let n=Object.assign({h1:"h1",a:"a",p:"p",strong:"strong",blockquote:"blockquote",hr:"hr",h2:"h2",ul:"ul",li:"li",code:"code",h3:"h3",table:"table",thead:"thead",tr:"tr",th:"th",tbody:"tbody",td:"td",pre:"pre",ol:"ol"},(0,d.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"redis-6x--72-滚动升级",children:["Redis 6.x → 7.2 滚动升级",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#redis-6x--72-滚动升级",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["迁移第一步「版本升级」的落地步骤。采用 Redis 官方推荐的",(0,r.jsx)(n.strong,{children:"滚动升级"}),":用新版本副本逐个替换旧节点,再计划性切主,全程不停服。"]}),"\n",(0,r.jsxs)(n.p,{children:["主线以 ",(0,r.jsx)(n.strong,{children:"单实例主从"})," 讲清核心流程;",(0,r.jsx)(n.strong,{children:"Redis Cluster"})," 的差异见文末补充章节。"]}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsxs)(n.p,{children:["参考 Redis 官方《",(0,r.jsx)(n.a,{href:"https://redis.io/docs/latest/operate/oss_and_stack/management/admin/",target:"_blank",rel:"noopener noreferrer",children:"Redis administration \xb7 Upgrading without downtime"}),"》。"]}),"\n"]}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsxs)(n.h2,{id:"适用与前提",children:["适用与前提",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#适用与前提",children:"#"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"场景:Redis 6.x(先在同大版本内对齐到 6.2.x)滚动升级到 7.2.x。"}),"\n",(0,r.jsx)(n.li,{children:"前提:主从复制正常、可计划性切主;ä¸
1»èŠ‚ç‚¹å·²å¼€å¯æŒä¹…åŒ–æˆ–ä¸è®¾å´©æºƒè‡ªåŠ¨é‡å¯ï¼ˆé¿å…ç©ºåº“å›žçŒå‰¯æœ¬ï¼‰ã€‚"}),"\n"]}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsxs)(n.h2,{id:"升级前准备",children:["升级前准备",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#升级前准备",children:"#"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"配置对齐"}),"(新旧节点一致):",(0,r.jsx)(n.code,{children:"maxmemory"})," 与淘汰策略、AOF / RDB 策略、",(0,r.jsx)(n.code,{children:"requirepass"})," / ",(0,r.jsx)(n.code,{children:"masterauth"}),"、连接数与超时、TLS、复制 backlog(按内存规模留足)。"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"兼容性核对(高层)"}),":用真实命令日志盘点线上实际用到的命令 / 用法(Lua、Streams、阻塞命令、Module 等重点),对高频与高风险用法做验证;不必逐条比对版本差异清单。"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"备份与基线"}),":升级前 ",(0,r.jsx)(n.code,{children:"BGSAVE"})," 一次;记录拓扑、连接数 / 延迟基线。"]}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"升级友好配置可选",children:["升级友好配置(可选)",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#升级友好配置可选",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["升级 / 加从期间的主要风险是",(0,r.jsx)(n.strong,{children:"全量重同步循环"}),"与主库压力尖峰。以下配置有助于滚动切主更平稳(",(0,r.jsx)(n.strong,{children:"具体值按数据规模压测确定,不要照抄数字"}),"):"]}),"\n",(0,r.jsxs)(n.table,{children:["\n",(0,r.jsxs)(n.thead,{children:["\n",(0,r.jsxs)(n.tr,{children:["\n",(0,r.jsx)(n.th,{children:"配置"}),"\n",(0,r.jsx)(n.th,{children:"作用"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.tbody,{children:["\n",(0,r.jsxs)(n.tr,{children:["\n",(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"repl-backlog-size"})}),"\n",(0,r.jsx)(n.td,{children:"断链后走部分重同步,避免整段全量重同步"}),"\n"]}),"\n",(0,r.jsxs)(n.tr,{children:["\n",(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"client-output-buffer-limit replica …"})}),"\n",(0,r.jsx)(n.td,{children:"高峰写 + 初次同步时,避免复制输出缓冲超限被主库断开、陷入重同步循环"}),"\n"]}),"\n",(0,r.jsxs)(n.tr,{children:["\n",(0,r.jsxs)(n.td,{children:[(0,r.jsx)(n.code,{children:"repl-diskless-sync"})," / ",(0,r.jsx)(n.code,{children:"-delay"})]}),"\n",(0,r.jsx)(n.td,{children:"慢盘环境下全量同步走网络、不落盘,降低主库磁盘压力"}),"\n"]}),"\n",(0,r.jsxs)(n.tr,{children:["\n",(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"repl-timeout"})}),"\n",(0,r.jsx)(n.td,{children:"大数据集 / 慢链路下适度调大,避免误判超时触发重同步"}),"\n"]}),"\n",(0,r.jsxs)(n.tr,{children:["\n",(0,r.jsxs)(n.td,{children:[(0,r.jsx)(n.code,{children:"maxmemory"})," 预留余量"]}),"\n",(0,r.jsx)(n.td,{children:"同步 / RDB 期内存占用可达平时约 2 倍,预留内存余量避免 OOM"}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["安全前提(非调优):主库开启持久化或",(0,r.jsx)(n.strong,{children:"不设崩溃自动重启"}),";升级副本用 ",(0,r.jsx)(n.code,{children:"SHUTDOWN"}),"(save & quit)优雅重启以便部分重同步;切换提主用 ",(0,r.jsx)(n.code,{children:"REPLICAOF NO ONE"}),",",(0,r.jsx)(n.strong,{children:"不要开可写副本作为中间态"}),"。"]}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsxs)(n.p,{children:["依据见 Redis 官方",(0,r.jsx)(n.a,{href:"https://redis.io/docs/latest/operate/oss_and_stack/management/replication/",target:"_blank",rel:"noopener noreferrer",children:"复制"}),"与",(0,r.jsx)(n.a,{href:"https://redis.io/docs/latest/operate/oss_and_stack/management/admin/",target:"_blank",rel:"noopener noreferrer",children:"管理"}),"文档。"]}),"\n"]}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsxs)(n.h2,{id:"升级流程主线单实例主从",children:["升级流程(主线:单实例主从)",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#升级流程主线单实例主从",children:"#"})]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"① 加 7.2 从   新 7.2 实例作为旧 6.x 主的从,追平复制\n② 验证        主从 key 数一致、master_link_status:up、offset 对齐\n③ (可选)压测   模拟业务负载确认稳
1定\n④ 切主        停写 → 等从追平 offset → 提升 7.2 为主 → 客户端指向新主\n⑤ 观察期      保留旧 6.x 节点(时长由业务定),按清单巡检\n⑥ 收尾        下线旧 6.x 节点\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"关键动作(示例命令,按环境调整)"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["加从:新 7.2 实例 ",(0,r.jsx)(n.code,{children:"REPLICAOF <旧主IP> <端口>"}),"(如需鉴权先设 ",(0,r.jsx)(n.code,{children:"masterauth"}),");等初次同步完成。"]}),"\n",(0,r.jsxs)(n.li,{children:["追平判定:",(0,r.jsx)(n.code,{children:"INFO replication"})," 中 ",(0,r.jsx)(n.code,{children:"master_link_status:up"}),"、offset 与主对齐、延迟稳定。"]}),"\n",(0,r.jsxs)(n.li,{children:["切主(先建立一致点,再提主):","\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:["旧主执行 ",(0,r.jsx)(n.code,{children:"CLIENT PAUSE WRITE <ms>"})," 短暂停写(Redis 6.2+)。"]}),"\n",(0,r.jsxs)(n.li,{children:["记录旧主 ",(0,r.jsx)(n.code,{children:"INFO replication"})," 的 ",(0,r.jsx)(n.code,{children:"master_repl_offset"}),"。"]}),"\n",(0,r.jsx)(n.li,{children:"等 7.2 从的复制 offset 追到该值(确认已处理完停写前的复制流)。"}),"\n",(0,r.jsxs)(n.li,{children:["7.2 从执行 ",(0,r.jsx)(n.code,{children:"REPLICAOF NO ONE"})," 提主。"]}),"\n",(0,r.jsx)(n.li,{children:"客户端指向新主。"}),"\n",(0,r.jsx)(n.li,{children:"旧主停止对外写入;如需观察期,再按回滚策略决定去留。"}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:"7.2 能加载 6.x 的 RDB(向前兼容),所以「7.2 从旧 6.x 主」同步没问题。"}),"\n"]}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsxs)(n.h2,{id:"redis-cluster-补充",children:["Redis Cluster 补充",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#redis-cluster-补充",children:"#"})]}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsxs)(n.p,{children:['Cluster 可复用"逐 shard 加从、追平、手动 failover"的思路,但',(0,r.jsx)(n.strong,{children:"上线前建议单独演练"}),",不要把单实例主从的结果直接外推到 Cluster。"]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"核心流程相同,差异在于命令与切流:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"加从"}),":新 7.2 节点 ",(0,r.jsx)(n.code,{children:"CLUSTER MEET"})," 加入后 ",(0,r.jsx)(n.code,{children:"CLUSTER REPLICATE <主节点ID>"}),"。"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"切主"}),":目标 7.2 从上 ",(0,r.jsx)(n.code,{children:"CLUSTER FAILOVER"}),",",(0,r.jsx)(n.strong,{children:"逐 shard"})," 进行(一次一个,切完验证 ",(0,r.jsx)(n.code,{children:"cluster_state:ok"}),"、",(0,r.jsx)(n.code,{children:"role:master"})," 再切下一个)。",(0,r.jsx)(n.code,{children:"CLUSTER FAILOVER"})," 默认会让原主停写、发送 offset、等从追平后再完成,因此",(0,r.jsx)(n.strong,{children:"不必"}),"叠加单实例那种裸 ",(0,r.jsx)(n.code,{children:"CLIENT PAUSE"}),";默认",(0,r.jsx)(n.strong,{children:"不要用"})," ",(0,r.jsx)(n.code,{children:"FORCE"})," / ",(0,r.jsx)(n.code,{children:"TAKEOVER"}),"。slot 随新主自动保留。"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"切流"}),":Cluster 客户端按拓扑自动跟随,",(0,r.jsx)(n.strong,{children:"无需手动重指向"}),"。"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"下线顺序"}),":先移除旧 6.x 从,最后移除旧 6.x 主。"]}),"\n"]}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsxs)(n.h2,{id:"验证检查点",children:["验证检查点",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#验证检查点",children:"#"})]}),"\n",(0,r.jsxs)(n.table,{children:["\n",(0,r.jsxs)(n.thead,{children:["\n",(0,r.jsxs)(n.tr,{children:["\n",(0,r.jsx)(n.th,{children:"阶段"}),"\n",(0,r.jsx)(n.th,{children:"检查"}),"\n",(0,r.jsx)(n.th,{children:"判定"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.tbody,{children:["\n",(0,r.jsxs)(n.tr,{children:["\n",(0,r.jsx)(n.td,{children:"升级前"}),"\n",(0,r.jsx)(n.td,{children:"健康 / 版本 / 复制"}),"\n",(0,r.jsxs)(n.td,{children:["复制正常(Cluster:",(0,r.jsx)(n.code,{children:"cluster_state:ok"}),")"]}),"\n"]}),"\n",(0,r.jsxs)(n.tr,{children:["\n",(0,r.jsx)(n.td,{children:"加从后"}),"\n",(0,r.jsx)(n.td,{children:"复制追平"}),"\n",(0,r.jsxs)(n.td,{children:[(0,r.jsx)(n.code,{children:"master_link_status:up"}),"、offset 对齐"]}),"\n"]}),"\n",(0,r.jsxs)(n.tr,{children:["\n",(0,r.jsx)(n.td,{children:"切主后"}),"\n",(0,r.jsx)(n.td,{children:"新主角色"}),"\n",(0,r.jsxs)(n.td,{children:[(0,r.jsx)(n.code,{children:"role:master"}),"(Cluster:",(0,r.jsx)(n.code,{children:"cluster_state:ok"}),")"]}),"\n"]}),"\n",(0,r.jsxs)(n.tr,{children:["\n",(0,r.jsx)(n.td,{children:"全程"}),"\n",(0,r.jsx)(n.td,{children:"抽样一致性"}),"\n",(0,r.jsx)(n.td,{children:"抽样 Key + Value + TTL 一致"}),"\n"]}),"\n",(0,r.jsxs)(n.tr,{children:["\n",(0,r.jsx)(n.td,{children:"观察期"}),"\n",(0,r.jsx)(n.td,{children:"延迟 / 错误 / 连接 / 内存"}),"\n",(0,r.jsx)(n.td,{children:"无明显劣化、无 ERROR 日志"}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsxs)(n.h2,{id:"回滚",children:["回滚",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#回滚",children:"#"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"观察期内可回退"}
1),":把原 6.x 主重新提主、客户端切回(Cluster:",(0,r.jsx)(n.code,{children:"CLUSTER FAILOVER"})," 回切)。"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"跨大版本的两个约束"}),":","\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["旧 6.x ",(0,r.jsx)(n.strong,{children:"无法加载 7.2 的 RDB"}),",因此不能让 6.x 稳定地做 7.2 的从(一旦触发全量重同步就会失败)。保留的旧节点只是「切主点的数据快照」,",(0,r.jsx)(n.strong,{children:"观察期内不要重启 / 重建旧节点"}),"。"]}),"\n",(0,r.jsxs)(n.li,{children:["因此回滚会",(0,r.jsx)(n.strong,{children:"丢失切主后写入 7.2 的增量"}),"。对一致性敏感的业务,切主时做",(0,r.jsx)(n.strong,{children:"短暂停写"}),",把回滚窗口的不一致降到最小。"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsxs)(n.p,{children:["回到 ",(0,r.jsx)(n.a,{href:"/docs/migration/overview",children:"迁移总览"})," \xb7 下一步 ",(0,r.jsx)(n.a,{href:"/docs/migration/migrate-7-to-engula",children:"Redis 7.2 → Engula"}),"。"]})]})}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(i,{...e})}):i(e)}let h=l;l.__RSPRESS_PAGE_META={},l.__RSPRESS_PAGE_META["zh%2Fdocs%2Fmigration%2Fupgrade-6-to-7.md"]={toc:[{text:"适用与前提",id:"适用与前提",depth:2},{text:"升级前准备",id:"升级前准备",depth:2},{text:"升级友好配置(可选)",id:"升级友好配置可选",depth:3},{text:"升级流程(主线:单实例主从)",id:"升级流程主线单实例主从",depth:2},{text:"Redis Cluster 补充",id:"redis-cluster-补充",depth:2},{text:"验证检查点",id:"验证检查点",depth:2},{text:"回滚",id:"回滚",depth:2}],title:"Redis 6.x → 7.2 滚动升级",headingTitle:"Redis 6.x → 7.2 滚动升级",frontmatter:{}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.