{"id":98539,"date":"2020-03-29T00:13:54","date_gmt":"2020-03-28T16:13:54","guid":{"rendered":"http:\/\/4563.org\/?p=98539"},"modified":"2020-03-29T00:13:54","modified_gmt":"2020-03-28T16:13:54","slug":"%e6%9b%b4%e6%96%b9%e4%be%bf%e5%9c%b0%e5%a4%84%e7%90%86-redis-%e5%ad%98%e5%82%a8%e7%9a%84-json-protobuf-binary-csv-yaml-%e6%95%b0%e6%8d%ae","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=98539","title":{"rendered":"\u66f4\u65b9\u4fbf\u5730\u5904\u7406 Redis \u5b58\u50a8\u7684 json\/protobuf\/binary\/csv\/yaml \u6570\u636e"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u66f4\u65b9\u4fbf\u5730\u5904\u7406 Redis \u5b58\u50a8\u7684 json\/protobuf\/binary\/csv\/yaml \u6570\u636e               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : scriptB0y <\/span>  <span><i><\/i> 54<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>Redis \u662f binary safe \u7684\uff0c\u6240\u4ee5\u7ecf\u5e38\u5728\u91cc\u9762\u7528 string \u683c\u5f0f\u5b58\u50a8\u4e00\u4e9b json \u7b49\u683c\u5f0f\u5316\u7684\u6570\u636e\u3002\u4f46\u662f\u7528 redis-cli GET \u51fa\u6765\uff0c\u5728 debug \u7684\u65f6\u5019\u5f88\u4e0d\u53cb\u597d\u3002<\/p>\n<p>\u6240\u4ee5\u6211\u5199\u4e86\u4e00\u4e2a\u5ba2\u6237\u7aef\uff0c\u53ef\u4ee5\u548c shell \u8fde\u63a5\u8d77\u6765\uff0c\u7528 <code>|<\/code> \u5c06 Redis \u7684 Response \u901a\u8fc7 pipe \u7528 shell \u7684\u5176\u4ed6\u5de5\u5177\uff0c\u6bd4\u5982 jq\/fx\/rg\/sort\/uniq\/cut\/sed\/awk \u7b49\u5904\u7406\u3002\u5047\u5982\u4f60\u7528\u5176\u4ed6\u683c\u5f0f\u7684\u8bdd\uff0c\u4e5f\u53ef\u4ee5\u5728 <code>GET<\/code> \u540e\u9762\u52a0 shell \u547d\u4ee4\u6765\u5904\u7406\uff0c\u975e\u5e38\u65b9\u4fbf\u3002<\/p>\n<p>\uff08\u89c9\u5f97\u65b9\u4fbf\u7684\u8bdd\u8bf7\u7ed9\u4e00\u4e2a star\uff0c\u8fd8\u652f\u6301\u81ea\u52a8\u8865\u5168\uff0c\u8bed\u6cd5\u9ad8\u4eae\u7b49\u5176\u4ed6\u529f\u80fd\uff0c\u6b22\u8fce\u63d0\u5b9d\u8d35\u5efa\u8bae\uff09<\/p>\n<p>\u9879\u76ee\u5730\u5740\uff1a https:\/\/github.com\/laixintao\/iredis<\/p>\n<p>\u5b89\u88c5\u65b9\u5f0f\uff1a<\/p>\n<pre><code>pip install iredis==0.8.7  # lastest version for now <\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/20200521_5ec6939d14f08.svg\" alt=\"\u66f4\u65b9\u4fbf\u5730\u5904\u7406 Redis \u5b58\u50a8\u7684 json\/protobuf\/binary\/csv\/yaml \u6570\u636e\" \/><\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>10<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"714111\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : miao1007 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u817f\u7279\u7fa4\u4f17                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"714112\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : scriptB0y <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @miao1007 \u8c22\u8c22\u8c22\u8c22\uff01                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"714113\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Maboroshii <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u770b\u8d77\u6765\u5f88 nice\uff0cstar \u4e86\uff0c\u5b66\u4e60\u4e00\u4e0b\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"714114\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : scriptB0y <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Maboroshii                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"714115\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : scriptB0y <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Maboroshii \u624b\u673a\u70b9\u9519\u53d1\u51fa\u53bb\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"714116\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : cxyfreedom <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u63a8\u7279\u770b\u5230\u7684\uff0c\u652f\u6301\u4e00\u4e0b\uff0c\u611f\u89c9\u4e0d\u9519                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"714117\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : binux <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u4e3a\u4ec0\u4e48\u4e0d\u5728 redis-cli \u540e\u9762\u76f4\u63a5\u63a5 command \u518d\u76f4\u63a5 | \uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"714118\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : scriptB0y <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @binux \u4e5f\u53ef\u4ee5\u3002\u4f46\u662f\u8981\u9000\u51fa redis-cli\uff0ciredis \u91cc\u9762\u5982\u679c\u4f60\u4e0d\u77e5\u9053\u8981\u627e\u54ea\u4e2a key \u7684\u8bdd\uff0c\u627e\u5230\u4e86\u53ef\u4ee5\u5728\u91cc\u9762\u5904\u7406\uff0c\u4e0d\u7528\u9000\u51fa\uff0c\u5982\u679c key \u5f88\u957f\u7684\u8bdd\u4e5f\u4e0d\u7528\u590d\u5236\u5230\u547d\u4ee4\u884c\uff0ciredis \u53ef\u4ee5\u81ea\u52a8\u8865\u5168\u3002<\/p>\n<p>\u4f46\u5176\u5b9e\u5e76\u6ca1\u6709 redis-cli \u505a\u4e0d\u5230\u975e iredis \u624d\u80fd\u505a\u5230\u7684\u529f\u80fd\uff0c\u751a\u81f3\u7528 nc \u90fd\u80fd\u63d0\u5230 redis-cli\uff0c\u53ea\u662f\u6709\u4e9b\u5de5\u5177\u66f4\u65b9\u4fbf\uff08\u6211\u7406\u89e3\uff09<\/p>\n<p>btw iredis \u5728\u547d\u4ee4\u884c\u7ba1\u9053\u65b9\u9762\u548c redis-cli \u8868\u73b0\u662f\u4e00\u6837\u7684\uff0ciredis get json \uff5c jq . \u4e5f\u53ef\u4ee5\u7684\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"714119\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : binux <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @scriptB0y #8 \u4e3a\u4ec0\u4e48\u8981\u9000\u51fa\uff1f\u5f00\u4e24\u4e2a\u7a97\u53e3\u4e0d\u5c31\u597d\u4e86\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"714120\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : scriptB0y <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @binux \u662f\u7684\uff0c\u5047\u5982\u662f\u7528 tmux \u8fd9\u6837\u7684\u5de5\u5177\u7684\u8bdd\uff0c\u4e00\u4e2a redis-cli + \u4e00\u4e2a shell \u6548\u679c\u662f\u4e00\u6837\u7684\uff01 \uff08\u4f46\u662f iredis \u53ef\u4ee5\u81ea\u52a8\u8865\u5168\u561b\uff0c\u5c11\u4e86\u4e00\u6b21\u590d\u5236 XD                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u66f4\u65b9\u4fbf\u5730\u5904\u7406 Redis \u5b58\u50a8\u7684 &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/98539"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=98539"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/98539\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=98539"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=98539"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=98539"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}