Redisslots迁移丢key问题排查
10页1、RedisslotsRedisslots 迁移丢迁移丢 keykey 问题排查问题排查1.1.问题问题redis slots 迁移的时候,在迁移之后 key 数量会变少.2.2.排查排查2.12.1 思考思考redis 3.x 也是比较成熟的产品了,为什么会丢 key?别人有没有遇到同样的问题?假设丢 key 了,如果 key 是因为 expire 丢失,那应该是正常,如果没有 expire 丢失,就是问题了,首先复现问题。2.22.2 复现问题复现问题0.0.准备集群准备集群造了两个节点的集群:10.0.0.10:20003 和 10.0.0.10:20004,最大可使用内存200M,并保证在测试过程中不会导致内存满等其他问题? 1 2 310.0.0.10:20004 cluster nodes 2aed426536067077179a3d23875b93b223802dea 10.0.0.10:20003 master - 0 1482132098352 6 connected 03a53320815d8b5f774810f2d41329007d60ebf4 10.0.0.10:
2、20004 myself,master - 0 0 7 connected 0-16383key 格式:test_i, 保证所有的 key 使用同一个 slot。test_i 的 slot 为 6918,并且测试前 slot 里面没有 key.? 1 2 3 4 5 6 7 8 9 10 1110.0.0.10:20004 cluster keyslot test_i (integer) 6918 10.0.0.10:20004 cluster countkeysinslot 6918 (integer) 0 10.0.0.10:20003 cluster countkeysinslot 6918 (integer) 0# 迁移函数,配合 redis-trib fix 迁移 def migrate_from_4_to_3(slot):cmd=“cluster setslot %s migrating 2aed426536067077179a3d23875b93b223802dea“ % (slot,)12 13 14 15 16 17 18 19cli4.execute_command
3、(cmd)cmd=“cluster setslot %s importing 03a53320815d8b5f774810f2d41329007d60ebf4“ % (slot,)cli3.execute_command(cmd)def migrate_from_3_to_4(slot):cmd=“cluster setslot %s migrating 03a53320815d8b5f774810f2d41329007d60ebf4“ % (slot,)cli3.execute_command(cmd)cmd=“cluster setslot %s importing 2aed426536067077179a3d23875b93b223802dea“ % (slot,)cli4.execute_command(cmd)1.1.非过期非过期 keykey 测试测试 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2210.0.0.10:20003 cluster countkeysinslot 6918 (integer)
4、 0 10.0.0.10:20004 cluster countkeysinslot 6918 (integer) 0# 向 10.0.0.10:20004 写入 20000 个不带过期时间的 keyfor i in range(20000):cmd=“set test_%s %s“ % (i, i)print cmd, cli4.execute_command(cmd)10.0.0.10:20004 cluster countkeysinslot 6918 (integer) 20000# 迁移 slot 6918 migrate_from_4_to_3(6918) redis-trib fix 10.0.0.10:20004#check 10.0.0.10:20003 cluster countkeysinslot 6918 (integer) 20000 10.0.0.10:20004 cluster countkeysinslot 6918 (integer) 0结论: 20000 个 key 全部迁移,没有问题。638 棋牌 http:/2.2.部分带过期时间的部分带过期时间
《Redisslots迁移丢key问题排查》由会员m****分享,可在线阅读,更多相关《Redisslots迁移丢key问题排查》请在金锄头文库上搜索。
DB2发生死锁情况时应该怎么处理
Python 为何能成最强编程语言
面试前必须要知道的Redis面试
MySQL下自动删除指定时间以前的记录的操作方法
深入理解FastCGI协议以及在PHP中的实现
MySQL数据库性能优化之硬件瓶颈分析
NoSQL数据库大全收集整理
2018 – 2019 年前端 JavaScript 面试题
PHP文件包含漏洞的形式总结
5种使用Python代码轻松实现数据可视化的方法
改进JavaScript和Bust的互操作性:深入认识wasm-bindgen组件
C#图片缩放平移从功能分析到编码实现
详解网络蜘蛛的安全隐患及预防方法
利用NAP解除安全隐患自动隐藏你的IP地址
解决分布式数据库和离线网络中原子性问题的新方法
bbed恢复数据遇到延迟块清除的问题
Oracle Data Redaction数据加密
linux下du和df结果不一致的原因及处理
基于QMP实现对qemu虚拟机进行交互
解读Java并发队列BlockingQueue
2023-06-30 7页
2022-09-15 93页
2022-06-04 27页
2022-04-25 3页
2022-03-24 7页
2022-03-24 7页
2022-03-24 8页
2022-03-24 4页
2022-03-24 43页
2022-03-24 7页