+------------------------------------------------+
| +--------------------------+ +---------------+ |
| | Source Redis | | Target Redis | |
| + ------------^--------^-^-+ +-------------^-+ |
+---------------|----------\-\---------------|---+
| redis \ \ twemproxy |
1(scan) (type)2 3 3(length + content)
| \ \ |
| \ \ |
+---------------|-------------------------+-\+---+
| | | |
| +yingyan------------------+ +yingyan_agent--+ |
| |+----------+ +----------+| | +-----------+ | |
| ||scan_group| |scan_shard|| | | key_check | | |
| |+--+-------+ +--+----+--+| | +-----+-----+ | |
| +---|------------|----|---+ +-------|-------+ |
+-----|------------|----|--------------|---------+
| | | |
(1)push| (2)pull| |(2)push |(3)pull
| | | |
| | | |
| | | |
+MQ---V------------V----V--------------V---------+
| +---------+ |
| |Twemproxy| \ |
| +--+---+--+ +----------+ |
| | | |Metaserver| |
| +--V---V--+ +----------+ |
| | Redis | / |
| +---------+ |
+------------------------------------------------+
(1) scan_group(src_group, dst_group)
获取源集群 redis shard 从库 ip port
(2) scan_shard(src_group, dst_group, src_ip, src_port)
对从库进行 scan 获取 key,每 1000 个 key 进行打包发到队列(同时包含 src_ip, src_port, dst_ip, dst_port)
(3) key_check(src_ip, src_port, dst_ip, dst_port, key_list)
从源集群获取集群 type
根据 type 对集群的 key 的 value 进行检查长度,
若长度不一则进行记录
目标 value 长度为 0: 则记录为 lack_target
目标 value 长度为其他 length: 则记录为 length
目标 value 中含 "WRONGTYPE": 则记录为 type
目标 value 异常:则记录为 "other"
长度一致
若检查内容,则对比内容的 md5 值