前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Redis like 数据库产品兼容性测试工具

Redis like 数据库产品兼容性测试工具

作者头像
用户1278550
发布2023-09-17 15:58:21
2330
发布2023-09-17 15:58:21
举报
文章被收录于专栏:idbaidba

一 背景

随着云计算的发展,各大云厂商都提供了 Redis like 数据库产品,对于要上云的 客户来说,本来使用的Redis 数据库,要迁移到云上的数据库时,都会面临如下问题:

  1. 业务代码是否需要修改
  2. Redis 的字段类型是否兼容
  3. 运维操作数据对象的命令的兼容性

为了解决 业务上云的稳定性,便捷性(不用修改代码,只需修改数据库连接串) ,热心网友 开发一款测试 各个云厂商 Redis like 数据库兼容性的开源工具 : compatibility-test-suite-for-redis

github 地址 https://github.com/tair-opensource/compatibility-test-suite-for-redis (访问 阅读原文 可直达)

二 工具

2.1 下载 和安装

python 环境要求3.7以上

代码语言:javascript
复制
git clone https://github.com/tair-opensource/compatibility-test-suite-for-redis.git

安装相关依赖:

pip3 install -r requirements.txt
2.2 使用
代码语言:javascript
复制
optional arguments:
  -h, --help            show this help message and exit
  --host HOST           the redis host
  --port PORT           the redis port
  --password PASSWORD   the redis password
  --testfile TESTFILE   the redis compatibility test cases
  --specific-version {1.0.0,2.8.0,3.2.0,4.0.0,5.0.0,6.0.0,6.2.0,7.0.0,7.2.0}
                        the redis version
  --show-failed         show details of failed tests
  --cluster             server is a node of the Redis cluster
  --ssl                 open ssl connection
  --genhtml             generate test report in html format
使用案例

不指定版本进行 Redis 兼容性测试

python3 redis_compatibility_test.py --testfile cts.json

测试 目标 数据库 对 Redis 6.2.0 的兼容性

python3 redis_compatibility_test.py --testfile cts.json --specific-version 6.2.0

测试 目标 数据库 对 Redis 6.2.0 的兼容性 打印出来相关 不兼容的选项

python3 redis_compatibility_test.py --testfile cts.json --specific-version 6.2.0 --show-failed

测试 某个 Redis 集群的兼容性

python3 redis_compatibility_test.py --testfile cts.json --host 127.0.0.1 --port 30001 --cluster

注意: 使用 genhtml 参数时候, 会去读 config.yml 文件 ,里面配置各个 Redis like 数据库的连接,然后集中测试多种数据库的兼容性。

代码语言:javascript
复制
python3 redis_compatibility_test.py  --host   127.0.0.1 --port 6379 --testfile cts.json --specific-version 6.2.0 --show-failed --cluster
test: del command passed
test: unlink command passed
test: rename command failed
test: rename command tags skipped
test: renamenx command failed
test: renamenx command tags skipped
test: randomkey command passed
test: exists command passed
test: ttl command passed
test: pttl command passed
test: expire command passed
-------- The result of tests --------
Summary: version: 6.2.0, total tests: 260, passed: 198, rate: 76.15%
This is failed tests for 6.2.0:
FailedTest(name='touch command', reason=ResponseError("unknown command 'TOUCH'",))
FailedTest(name='copy command', reason=AttributeError("'int' object has no attribute 'isupper'",))

三 小结

该工具比较方便而且针对性的测试某个Redis like 数据库产品的 兼容性。如果要同时测试多款数据库产品,建议配置好 config.yaml 文件里面 目标数据库的连接方式。

git 地址: https://github.com/tair-opensource/compatibility-test-suite-for-redis

欢迎有兴趣的朋友 进行测试和使用。

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2023-09-05 23:20,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 yangyidba 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 一 背景
  • 二 工具
    • 2.1 下载 和安装
      • 2.2 使用
        • 使用案例
    • 三 小结
    相关产品与服务
    云数据库 Redis
    腾讯云数据库 Redis(TencentDB for Redis)是腾讯云打造的兼容 Redis 协议的缓存和存储服务。丰富的数据结构能帮助您完成不同类型的业务场景开发。支持主从热备,提供自动容灾切换、数据备份、故障迁移、实例监控、在线扩容、数据回档等全套的数据库服务。
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档