github地址: https://github.com/throne-developer/redis_cluster_multi_op
對redis集羣執行批量操作,解決redis集羣不能使用pipeline的問題。
使用方法: (1)修改config.json,設置redis集羣的ip列表和密碼,以及要執行的命令文件路徑
{
"redis_addrs":[
"10.11.3.104:6000",
"10.11.3.125:6000",
"10.11.3.104:6000"
],
"redis_pwd":"pass",
"command_file":"commands.csv"
}
(2)準備命令文件,每一行爲一條命令,用逗號分隔,比如 "set key1 abc" 這條命令在文件爲 "set,key1,abc",如下所示:
set,key1,11
set,key2,22
set,key3,11
(3)go build得到exe程序,也可以直接使用編譯好的redis_cluster_multiop程序(linux版本),將config.json和exe放在同一目錄下,然後執行exe,輸出如下:
2020-03-27 18:06:24 [info] loadFile commands.csv 3
reply 0 OK
reply 1 OK
reply 2 OK
done count 3