{"id":17441,"date":"2025-05-26T20:59:18","date_gmt":"2025-05-26T12:59:18","guid":{"rendered":"https:\/\/92it.top\/?p=17441"},"modified":"2025-05-26T20:59:33","modified_gmt":"2025-05-26T12:59:33","slug":"redis%e7%9a%84-%e5%a4%9a%e6%95%b0%e6%8d%ae%e5%ba%93-multiple-databases","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=17441","title":{"rendered":"Redis\u7684 \u591a\u6570\u636e\u5e93  (Multiple Databases)"},"content":{"rendered":"\n<p>\u5728 Redis \u4e2d\uff0c<strong>\u591a\u6570\u636e\u5e93\uff08Multiple Databases\uff09<\/strong>&nbsp;\u662f\u4e00\u79cd\u5c06\u6570\u636e\u903b\u8f91\u9694\u79bb\u7684\u673a\u5236\uff0c\u5141\u8bb8\u7528\u6237\u5728\u5355\u4e2a Redis \u5b9e\u4f8b\u4e2d\u521b\u5efa\u591a\u4e2a\u72ec\u7acb\u7684\u547d\u540d\u7a7a\u95f4\u3002\u6bcf\u4e2a\u6570\u636e\u5e93\u901a\u8fc7\u6570\u5b57\u7d22\u5f15\uff08\u4ece&nbsp;<code>0<\/code>&nbsp;\u5f00\u59cb\uff09\u6807\u8bc6\uff0c\u4f8b\u5982&nbsp;<code>0<\/code>\u3001<code>1<\/code>\u3001<code>2<\/code>&nbsp;\u7b49\u3002\u4ee5\u4e0b\u662f\u8be6\u7ec6\u89e3\u6790<\/p>\n\n\n\n<p><strong>\u4e00\u3001\u591a\u6570\u636e\u5e93\u7684\u57fa\u672c\u6982\u5ff5<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<ul>\n<li><strong>\u6570\u636e\u5e93\u6570\u91cf\u9650\u5236<\/strong>\n<ul>\n<li>Redis \u9ed8\u8ba4\u652f\u6301&nbsp;<strong>16 \u4e2a\u6570\u636e\u5e93<\/strong>\uff08\u901a\u8fc7&nbsp;<code>databases 16<\/code>&nbsp;\u914d\u7f6e\uff09\uff0c\u7f16\u53f7\u4ece&nbsp;<code>0<\/code>&nbsp;\u5230&nbsp;<code>15<\/code>\u3002<\/li>\n\n\n\n<li>\u4e0d\u540c\u6570\u636e\u5e93\u7684\u6570\u636e\u76f8\u4e92\u9694\u79bb\uff0c\u76f8\u540c\u7684\u952e\u540d\u53ef\u4ee5\u5b58\u5728\u4e8e\u4e0d\u540c\u6570\u636e\u5e93\u4e2d\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u5ba2\u6237\u7aef\u9009\u62e9\u6570\u636e\u5e93<\/strong>\n<ul>\n<li>\u4f7f\u7528&nbsp;<code>SELECT &lt;db&gt;<\/code>&nbsp;\u547d\u4ee4\u5207\u6362\u6570\u636e\u5e93\uff08\u9ed8\u8ba4\u8fde\u63a5\u5230&nbsp;<code>0<\/code>&nbsp;\u53f7\u5e93\uff09\uff1a<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">redis-cli SELECT 1  # \u5207\u6362\u5230 1 \u53f7\u6570\u636e\u5e93\nSET key \"value\"     # \u5728 1 \u53f7\u5e93\u4e2d\u8bbe\u7f6e\u952e\u503c<\/pre>\n\n\n\n<ul>\n<li><strong>\u6570\u636e\u9694\u79bb\u6027<\/strong>\n<ul>\n<li>\u4e0d\u540c\u6570\u636e\u5e93\u7684\u6570\u636e\u7269\u7406\u4e0a\u5b58\u50a8\u5728\u540c\u4e00\u5b9e\u4f8b\u4e2d\uff0c\u4f46\u903b\u8f91\u4e0a\u76f8\u4e92\u72ec\u7acb\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">redis-cli -n 0 SET user:1 \"Alice\"  # \u5728 0 \u53f7\u5e93\u8bbe\u7f6e user:1\nredis-cli -n 1 SET user:1 \"Bob\"    # \u5728 1 \u53f7\u5e93\u8bbe\u7f6e\u76f8\u540c\u952e\u540d\nredis-cli -n 0 GET user:1          # \u8fd4\u56de \"Alice\"\nredis-cli -n 1 GET user:1          # \u8fd4\u56de \"Bob\"<\/pre>\n\n\n\n<p><strong>\u4e8c\u3001\u6570\u636e\u5e93\u7f16\u53f7\u7684\u542b\u4e49<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<ul>\n<li><strong><code>0<\/code>&nbsp;\u548c&nbsp;<code>1<\/code>&nbsp;\u7684\u533a\u522b<\/strong>\uff1a\n<ul>\n<li><code>0<\/code>\uff1a\u9ed8\u8ba4\u6570\u636e\u5e93\uff0c\u5ba2\u6237\u7aef\u8fde\u63a5\u540e\u76f4\u63a5\u4f7f\u7528\u7684\u6570\u636e\u5e93\u3002<\/li>\n\n\n\n<li><code>1<\/code>\uff1a\u7528\u6237\u53ef\u81ea\u5b9a\u4e49\u7528\u9014\u7684\u6570\u636e\u5e93\uff0c\u4f8b\u5982\u5b58\u50a8\u7f13\u5b58\u6570\u636e\u3001\u4f1a\u8bdd\u4fe1\u606f\u7b49\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u5178\u578b\u7528\u9014\u793a\u4f8b<\/strong>\uff1a<\/li>\n<\/ul>\n\n\n\n<p><table style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); border-collapse: collapse; border-spacing: 0px; display: block; overflow: auto; width: max-content; max-width: max-content; text-align: left; overflow-anchor: auto; color: rgba(0, 0, 0, 0.85); font-family: Inter, -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;SF Pro SC&quot;, &quot;SF Pro Display&quot;, &quot;SF Pro Icons&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;\"><thead style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); overflow-anchor: auto;\"><tr style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); border-top: 0px; overflow-anchor: auto; background-color: var(--color-table-header);\"><th style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); padding: 12px 18px; font-size: var(--md-box-samantha-normal-text-font-size); font-weight: 600; line-height: var(--md-box-samantha-normal-text-line-height); color: var(--md-box-samantha-deep-text-color) !important; border-top: 0px; border-right: 1px solid var(--s-color-border-tertiary,rgba(0,0,0,.08)); border-bottom: 0px; border-left: 0px; border-image: initial; max-width: calc(var(--table-column-max-width) - 32px); overflow-anchor: auto;\">\u6570\u636e\u5e93\u7f16\u53f7<\/th><th style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); padding: 12px 18px; font-size: var(--md-box-samantha-normal-text-font-size); font-weight: 600; line-height: var(--md-box-samantha-normal-text-line-height); color: var(--md-box-samantha-deep-text-color) !important; border-top: 0px; border-right: 1px solid var(--s-color-border-tertiary,rgba(0,0,0,.08)); border-bottom: 0px; border-left: 0px; border-image: initial; max-width: calc(var(--table-column-max-width) - 32px); overflow-anchor: auto;\">\u5e38\u89c1\u7528\u9014<\/th><th style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); padding: 12px 18px; font-size: var(--md-box-samantha-normal-text-font-size); font-weight: 600; line-height: var(--md-box-samantha-normal-text-line-height); color: var(--md-box-samantha-deep-text-color) !important; border: 0px; max-width: calc(var(--table-column-max-width) - 32px); overflow-anchor: auto;\">\u793a\u4f8b\u573a\u666f<\/th><\/tr><\/thead><tbody style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); overflow-anchor: auto;\"><tr style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); border-top: 1px solid var(--s-color-border-tertiary,rgba(0,0,0,.08)); overflow-anchor: auto;\"><td style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); padding: 12px 18px; font-size: var(--md-box-samantha-normal-text-font-size); font-weight: 400; line-height: var(--md-box-samantha-normal-text-line-height); color: var(--md-box-samantha-normal-text-color) !important; border-top: 0px; border-right: 1px solid var(--s-color-border-tertiary,rgba(0,0,0,.08)); border-bottom: 0px; border-left: 0px; border-image: initial; max-width: calc(var(--table-column-max-width) - 32px); overflow-anchor: auto;\"><code style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); background: var(--color-inline-code-background); border-radius: 4px; color: var(--color-text-primary); font-size: 14px; font-family: Menlo, Monaco, Consolas, &quot;Courier New&quot;, monospace; overflow-anchor: auto;\">0<\/code><\/td><td style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); padding: 12px 18px; font-size: var(--md-box-samantha-normal-text-font-size); font-weight: 400; line-height: var(--md-box-samantha-normal-text-line-height); color: var(--md-box-samantha-normal-text-color) !important; border-top: 0px; border-right: 1px solid var(--s-color-border-tertiary,rgba(0,0,0,.08)); border-bottom: 0px; border-left: 0px; border-image: initial; max-width: calc(var(--table-column-max-width) - 32px); overflow-anchor: auto;\">\u9ed8\u8ba4\u6570\u636e\u5e93<\/td><td style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); padding: 12px 18px; font-size: var(--md-box-samantha-normal-text-font-size); font-weight: 400; line-height: var(--md-box-samantha-normal-text-line-height); color: var(--md-box-samantha-normal-text-color) !important; border: 0px; max-width: calc(var(--table-column-max-width) - 32px); overflow-anchor: auto;\">\u672a\u6307\u5b9a\u6570\u636e\u5e93\u65f6\u7684\u9ed8\u8ba4\u5b58\u50a8\u4f4d\u7f6e<\/td><\/tr><tr style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); border-top: 1px solid var(--s-color-border-tertiary,rgba(0,0,0,.08)); overflow-anchor: auto;\"><td style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); padding: 12px 18px; font-size: var(--md-box-samantha-normal-text-font-size); font-weight: 400; line-height: var(--md-box-samantha-normal-text-line-height); color: var(--md-box-samantha-normal-text-color) !important; border-top: 0px; border-right: 1px solid var(--s-color-border-tertiary,rgba(0,0,0,.08)); border-bottom: 0px; border-left: 0px; border-image: initial; max-width: calc(var(--table-column-max-width) - 32px); overflow-anchor: auto;\"><code style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); background: var(--color-inline-code-background); border-radius: 4px; color: var(--color-text-primary); font-size: 14px; font-family: Menlo, Monaco, Consolas, &quot;Courier New&quot;, monospace; overflow-anchor: auto;\">1<\/code><\/td><td style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); padding: 12px 18px; font-size: var(--md-box-samantha-normal-text-font-size); font-weight: 400; line-height: var(--md-box-samantha-normal-text-line-height); color: var(--md-box-samantha-normal-text-color) !important; border-top: 0px; border-right: 1px solid var(--s-color-border-tertiary,rgba(0,0,0,.08)); border-bottom: 0px; border-left: 0px; border-image: initial; max-width: calc(var(--table-column-max-width) - 32px); overflow-anchor: auto;\">\u7f13\u5b58\u6570\u636e<\/td><td style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); padding: 12px 18px; font-size: var(--md-box-samantha-normal-text-font-size); font-weight: 400; line-height: var(--md-box-samantha-normal-text-line-height); color: var(--md-box-samantha-normal-text-color) !important; border: 0px; max-width: calc(var(--table-column-max-width) - 32px); overflow-anchor: auto;\">\u5b58\u50a8\u4e34\u65f6\u7f13\u5b58\uff08\u5982\u7528\u6237\u4f1a\u8bdd\u3001API \u54cd\u5e94\uff09<\/td><\/tr><tr style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); border-top: 1px solid var(--s-color-border-tertiary,rgba(0,0,0,.08)); overflow-anchor: auto;\"><td style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); padding: 12px 18px; font-size: var(--md-box-samantha-normal-text-font-size); font-weight: 400; line-height: var(--md-box-samantha-normal-text-line-height); color: var(--md-box-samantha-normal-text-color) !important; border-top: 0px; border-right: 1px solid var(--s-color-border-tertiary,rgba(0,0,0,.08)); border-bottom: 0px; border-left: 0px; border-image: initial; max-width: calc(var(--table-column-max-width) - 32px); overflow-anchor: auto;\"><code style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); background: var(--color-inline-code-background); border-radius: 4px; color: var(--color-text-primary); font-size: 14px; font-family: Menlo, Monaco, Consolas, &quot;Courier New&quot;, monospace; overflow-anchor: auto;\">2<\/code><\/td><td style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); padding: 12px 18px; font-size: var(--md-box-samantha-normal-text-font-size); font-weight: 400; line-height: var(--md-box-samantha-normal-text-line-height); color: var(--md-box-samantha-normal-text-color) !important; border-top: 0px; border-right: 1px solid var(--s-color-border-tertiary,rgba(0,0,0,.08)); border-bottom: 0px; border-left: 0px; border-image: initial; max-width: calc(var(--table-column-max-width) - 32px); overflow-anchor: auto;\">\u961f\u5217\u6570\u636e<\/td><td style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); padding: 12px 18px; font-size: var(--md-box-samantha-normal-text-font-size); font-weight: 400; line-height: var(--md-box-samantha-normal-text-line-height); color: var(--md-box-samantha-normal-text-color) !important; border: 0px; max-width: calc(var(--table-column-max-width) - 32px); overflow-anchor: auto;\">\u5b58\u50a8\u4efb\u52a1\u961f\u5217\uff08\u5982 Redis List \u5b9e\u73b0\u7684\u961f\u5217\uff09<\/td><\/tr><tr style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); border-top: 1px solid var(--s-color-border-tertiary,rgba(0,0,0,.08)); overflow-anchor: auto;\"><td style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); padding: 12px 18px; font-size: var(--md-box-samantha-normal-text-font-size); font-weight: 400; line-height: var(--md-box-samantha-normal-text-line-height); color: var(--md-box-samantha-normal-text-color) !important; border-top: 0px; border-right: 1px solid var(--s-color-border-tertiary,rgba(0,0,0,.08)); border-bottom: 0px; border-left: 0px; border-image: initial; max-width: calc(var(--table-column-max-width) - 32px); overflow-anchor: auto;\"><code style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); background: var(--color-inline-code-background); border-radius: 4px; color: var(--color-text-primary); font-size: 14px; font-family: Menlo, Monaco, Consolas, &quot;Courier New&quot;, monospace; overflow-anchor: auto;\">3<\/code><\/td><td style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); padding: 12px 18px; font-size: var(--md-box-samantha-normal-text-font-size); font-weight: 400; line-height: var(--md-box-samantha-normal-text-line-height); color: var(--md-box-samantha-normal-text-color) !important; border-top: 0px; border-right: 1px solid var(--s-color-border-tertiary,rgba(0,0,0,.08)); border-bottom: 0px; border-left: 0px; border-image: initial; max-width: calc(var(--table-column-max-width) - 32px); overflow-anchor: auto;\">\u76d1\u63a7\u6307\u6807<\/td><td style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); padding: 12px 18px; font-size: var(--md-box-samantha-normal-text-font-size); font-weight: 400; line-height: var(--md-box-samantha-normal-text-line-height); color: var(--md-box-samantha-normal-text-color) !important; border: 0px; max-width: calc(var(--table-column-max-width) - 32px); overflow-anchor: auto;\">\u5b58\u50a8\u7cfb\u7edf\u76d1\u63a7\u6570\u636e\uff08\u5982 QPS\u3001\u5185\u5b58\u4f7f\u7528\uff09<\/td><\/tr><tr style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); border-top: 1px solid var(--s-color-border-tertiary,rgba(0,0,0,.08)); overflow-anchor: auto;\"><td style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); padding: 12px 18px; font-size: var(--md-box-samantha-normal-text-font-size); font-weight: 400; line-height: var(--md-box-samantha-normal-text-line-height); color: var(--md-box-samantha-normal-text-color) !important; border-top: 0px; border-right: 1px solid var(--s-color-border-tertiary,rgba(0,0,0,.08)); border-bottom: 0px; border-left: 0px; border-image: initial; max-width: calc(var(--table-column-max-width) - 32px); overflow-anchor: auto;\"><code style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); background: var(--color-inline-code-background); border-radius: 4px; color: var(--color-text-primary); font-size: 14px; font-family: Menlo, Monaco, Consolas, &quot;Courier New&quot;, monospace; overflow-anchor: auto;\">15<\/code><\/td><td style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); padding: 12px 18px; font-size: var(--md-box-samantha-normal-text-font-size); font-weight: 400; line-height: var(--md-box-samantha-normal-text-line-height); color: var(--md-box-samantha-normal-text-color) !important; border-top: 0px; border-right: 1px solid var(--s-color-border-tertiary,rgba(0,0,0,.08)); border-bottom: 0px; border-left: 0px; border-image: initial; max-width: calc(var(--table-column-max-width) - 32px); overflow-anchor: auto;\">\u6d4b\u8bd5\u73af\u5883<\/td><td style=\"-webkit-font-smoothing: antialiased; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); padding: 12px 18px; font-size: var(--md-box-samantha-normal-text-font-size); font-weight: 400; line-height: var(--md-box-samantha-normal-text-line-height); color: var(--md-box-samantha-normal-text-color) !important; border: 0px; max-width: calc(var(--table-column-max-width) - 32px); overflow-anchor: auto;\">\u5f00\u53d1 \/ \u6d4b\u8bd5\u65f6\u4f7f\u7528\uff0c\u907f\u514d\u6c61\u67d3\u751f\u4ea7\u6570\u636e<\/td><\/tr><\/tbody><\/table><\/p>\n\n\n\n<p><strong>\u4e09\u3001\u591a\u6570\u636e\u5e93\u7684\u4f18\u7f3a\u70b9<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>\u4f18\u70b9<\/strong><\/p>\n\n\n\n<ol>\n<li><strong>\u7b80\u5355\u9694\u79bb<\/strong>\uff1a\u65e0\u9700\u989d\u5916\u914d\u7f6e\uff0c\u901a\u8fc7\u6570\u5b57\u7d22\u5f15\u5feb\u901f\u9694\u79bb\u6570\u636e\u3002<\/li>\n\n\n\n<li><strong>\u540c\u4e00\u5b9e\u4f8b\u5171\u4eab\u8d44\u6e90<\/strong>\uff1a\u591a\u4e2a\u6570\u636e\u5e93\u5171\u4eab\u5185\u5b58\u3001CPU \u7b49\u8d44\u6e90\uff0c\u9002\u5408\u8f7b\u91cf\u7ea7\u9694\u79bb\u3002<\/li>\n\n\n\n<li><strong>\u539f\u5b50\u64cd\u4f5c\u652f\u6301<\/strong>\uff1a\u53ef\u5728\u5355\u4e2a\u4e8b\u52a1\u4e2d\u8de8\u6570\u636e\u5e93\u6267\u884c\u547d\u4ee4\uff08\u5982&nbsp;<code>MULTI\/EXEC<\/code>\uff09\u3002<\/li>\n<\/ol>\n\n\n\n<p><strong>\u7f3a\u70b9<\/strong><\/p>\n\n\n\n<ol>\n<li><strong>\u7f3a\u4e4f\u547d\u540d\u7a7a\u95f4\u8bed\u4e49<\/strong>\uff1a\u6570\u636e\u5e93\u7f16\u53f7\u53ea\u662f\u6570\u5b57\uff0c\u65e0\u6cd5\u76f4\u89c2\u8868\u8fbe\u7528\u9014\uff08\u5982&nbsp;<code>users<\/code>\u3001<code>sessions<\/code>\uff09\u3002<\/li>\n\n\n\n<li><strong>\u8d44\u6e90\u65e0\u6cd5\u9694\u79bb<\/strong>\uff1a\u6240\u6709\u6570\u636e\u5e93\u5171\u4eab\u5b9e\u4f8b\u8d44\u6e90\uff0c\u53ef\u80fd\u5bfc\u81f4\u76f8\u4e92\u5f71\u54cd\uff08\u5982\u67d0\u4e2a\u5e93\u5360\u7528\u8fc7\u591a\u5185\u5b58\uff09\u3002<\/li>\n\n\n\n<li><strong>\u4e0d\u652f\u6301\u5206\u5e03\u5f0f<\/strong>\uff1a\u591a\u6570\u636e\u5e93\u4ec5\u5728\u5355\u673a\u6709\u6548\uff0cRedis Cluster \u6a21\u5f0f\u4e0b\u4e0d\u652f\u6301\u6b64\u529f\u80fd\u3002<\/li>\n\n\n\n<li><strong>\u7ba1\u7406\u4e0d\u4fbf<\/strong>\uff1a\u751f\u4ea7\u73af\u5883\u4e2d\u96be\u4ee5\u9488\u5bf9\u7279\u5b9a\u6570\u636e\u5e93\u8fdb\u884c\u76d1\u63a7\u6216\u5907\u4efd\u3002<\/li>\n<\/ol>\n\n\n\n<p><strong>\u56db\u3001\u66ff\u4ee3\u65b9\u6848\uff1a\u4f7f\u7528\u547d\u540d\u7a7a\u95f4\uff08Prefix\uff09<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u73b0\u4ee3 Redis \u5b9e\u8df5\u4e2d\uff0c\u66f4\u63a8\u8350\u4f7f\u7528&nbsp;<strong>\u952e\u540d\u524d\u7f00\uff08Prefix\uff09<\/strong>&nbsp;\u66ff\u4ee3\u591a\u6570\u636e\u5e93\uff1a<\/p>\n\n\n\n<p>\u793a\u4f8b\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># \u4f7f\u7528\u524d\u7f00\u533a\u5206\u4e0d\u540c\u4e1a\u52a1\u6570\u636e\nuser:1           # \u7528\u6237\u6570\u636e\nsession:abc123   # \u4f1a\u8bdd\u6570\u636e\ncache:product:1  # \u5546\u54c1\u7f13\u5b58<\/pre>\n\n\n\n<p>\u5de5\u5177\u652f\u6301\uff1a<\/p>\n\n\n\n<ul>\n<li>\u4f7f\u7528&nbsp;<code>SCAN<\/code>&nbsp;\u547d\u4ee4\u6309\u524d\u7f00\u641c\u7d22\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SCAN 0 MATCH \"user:*\"  # \u626b\u63cf\u6240\u6709\u7528\u6237\u6570\u636e<\/pre>\n\n\n\n<ul>\n<li>\u4f7f\u7528&nbsp;<code>KEYS<\/code>&nbsp;\u547d\u4ee4\uff08\u4ec5\u5efa\u8bae\u5728\u5f00\u53d1\u73af\u5883\u4f7f\u7528\uff09\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">KEYS \"cache:*\"         # \u83b7\u53d6\u6240\u6709\u7f13\u5b58\u952e\n<\/pre>\n\n\n\n<ul>\n<li><strong>\u4f18\u70b9<\/strong>\uff1a\n<ul>\n<li>\u66f4\u7075\u6d3b\uff1a\u53ef\u6839\u636e\u4e1a\u52a1\u9700\u6c42\u52a8\u6001\u521b\u5efa\u524d\u7f00\uff0c\u65e0\u9700\u9884\u5206\u914d\u6570\u636e\u5e93\u3002<\/li>\n\n\n\n<li>\u9002\u7528\u4e8e\u96c6\u7fa4\uff1aRedis Cluster \u4e0d\u652f\u6301\u591a\u6570\u636e\u5e93\uff0c\u4f46\u524d\u7f00\u65b9\u5f0f\u5b8c\u5168\u517c\u5bb9\u3002<\/li>\n\n\n\n<li>\u8bed\u4e49\u660e\u786e\uff1a\u901a\u8fc7\u524d\u7f00\u76f4\u89c2\u533a\u5206\u6570\u636e\u7c7b\u578b\uff08\u5982&nbsp;<code>user:<\/code>\u3001<code>order:<\/code>\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p><strong>\u4e94\u3001\u751f\u4ea7\u73af\u5883\u5efa\u8bae<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<ol>\n<li><strong>\u4f18\u5148\u4f7f\u7528\u524d\u7f00\u800c\u975e\u591a\u6570\u636e\u5e93<\/strong>\uff1a\n<ul>\n<li>\u5bf9\u4e8e\u5927\u591a\u6570\u573a\u666f\uff0c\u4f7f\u7528\u952e\u540d\u524d\u7f00\uff08\u5982&nbsp;<code>user:1<\/code>\u3001<code>session:token<\/code>\uff09\u5df2\u8db3\u591f\u6ee1\u8db3\u9694\u79bb\u9700\u6c42\u3002<\/li>\n\n\n\n<li>\u591a\u6570\u636e\u5e93\u4ec5\u4f5c\u4e3a\u5386\u53f2\u9057\u7559\u7279\u6027\u4fdd\u7559\uff0c\u65b0\u5e94\u7528\u5e94\u907f\u514d\u4f9d\u8d56\u6b64\u529f\u80fd\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Redis Cluster \u573a\u666f<\/strong>\uff1a\n<ul>\n<li>Redis Cluster \u4e0d\u652f\u6301\u591a\u6570\u636e\u5e93\uff08\u6bcf\u4e2a\u8282\u70b9\u4ec5\u6709\u4e00\u4e2a\u6570\u636e\u5e93\uff09\uff0c\u5fc5\u987b\u4f7f\u7528\u524d\u7f00\u65b9\u5f0f\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># \u5728 Cluster \u4e2d\u4f7f\u7528\u524d\u7f00\u533a\u5206\u6570\u636e\napp1:user:1    # \u5e94\u75281\u7684\u7528\u6237\u6570\u636e\napp2:user:1    # \u5e94\u75282\u7684\u7528\u6237\u6570\u636e<\/pre>\n\n\n\n<p>    3.<strong>\u76d1\u63a7\u4e0e\u7ef4\u62a4<\/strong>\uff1a<\/p>\n\n\n\n<ul>\n<li>\u4f7f\u7528&nbsp;<code>INFO keyspace<\/code>&nbsp;\u547d\u4ee4\u67e5\u770b\u5404\u6570\u636e\u5e93\u7684\u952e\u6570\u91cf\u548c\u5185\u5b58\u4f7f\u7528\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">redis-cli INFO keyspace\n# \u8f93\u51fa\u793a\u4f8b\uff1a\n# db0:keys=100,expires=5,avg_ttl=1000000\n# db1:keys=50,expires=0,avg_ttl=0<\/pre>\n\n\n\n<p><strong>\u516d\u3001\u603b\u7ed3<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>Redis \u7684\u591a\u6570\u636e\u5e93\uff08<code>0<\/code>\u3001<code>1<\/code>&nbsp;\u7b49\u7f16\u53f7\uff09\u662f\u4e00\u79cd\u7b80\u5355\u7684\u903b\u8f91\u9694\u79bb\u673a\u5236\uff0c\u4f46\u5b58\u5728\u529f\u80fd\u5c40\u9650\uff0c\u5c24\u5176\u5728\u96c6\u7fa4\u73af\u5883\u4e2d\u4e0d\u88ab\u652f\u6301\u3002\u73b0\u4ee3\u5b9e\u8df5\u4e2d\uff0c\u63a8\u8350\u4f7f\u7528&nbsp;<strong>\u952e\u540d\u524d\u7f00 + \u903b\u8f91\u547d\u540d\u7a7a\u95f4<\/strong>&nbsp;\u66ff\u4ee3\u591a\u6570\u636e\u5e93\uff0c\u4ee5\u83b7\u5f97\u66f4\u597d\u7684\u6269\u5c55\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u3002\u7406\u89e3\u8fd9\u4e24\u79cd\u9694\u79bb\u65b9\u5f0f\u7684\u9002\u7528\u573a\u666f\uff0c\u6709\u52a9\u4e8e\u8bbe\u8ba1\u66f4\u5065\u58ee\u7684 Redis \u6570\u636e\u67b6\u6784\u3002\u7f16\u8f91\u5206\u4eab<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 Redis \u4e2d\uff0c\u591a\u6570\u636e\u5e93\uff08Multiple Databases\uff09&nbsp;\u662f\u4e00\u79cd\u5c06\u6570\u636e\u903b\u8f91\u9694\u79bb\u7684\u673a\u5236\uff0c\u5141 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/17441"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=17441"}],"version-history":[{"count":4,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/17441\/revisions"}],"predecessor-version":[{"id":17445,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/17441\/revisions\/17445"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=17441"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=17441"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=17441"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}