转载自 杨一DBA https://cloud.tencent.com/developer/article/2329798
随着云计算的发展,各大云厂商都提供了 Redis like 数据库产品,对于要上云的 客户来说,本来使用的Redis 数据库,要迁移到云上的数据库时,都会面临如下问题:
为了解决 业务上云的稳定性,便捷性(不用修改代码,只需修改数据库连接串) ,热心网友 开发一款测试 各个云厂商 Redis like 数据库兼容性的开源工具 : compatibility-test-suite-for-redis (这个工具看看起来是阿里云tair团队开源的)
二 工具
python 环境要求3.7以上
git clone https://github.com/tair-opensource/compatibility-test-suite-for-redis.git
安装相关依赖:
pip3 install -r requirements.txt
复制
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 数据库的连接,然后集中测试多种数据库的兼容性。
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 文件里面 目标数据库的连接方式。
github链接: https://github.com/tair-opensource/compatibility-test-suite-for-redis
兼容性矩阵:https://tair-opensource.github.io/compatibility-test-suite-for-redis/ (下图内容可能随时间变化而腐化)
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。