From 22ac89bc2c5488c4ad62b77ffbe5386d63902fd0 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Fri, 10 Nov 2023 00:13:32 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9B=86=E7=BE=A4=E8=8A=82=E7=82=B9=E6=9A=82?= =?UTF-8?q?=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/redis/index.html | 1 + plugins/redis/index.py | 17 ++++++++++++++ plugins/redis/js/redis.js | 33 ++++++++++++++++++++++++++-- plugins/redis/tpl/redis_cluster.conf | 1 - 4 files changed, 49 insertions(+), 3 deletions(-) diff --git a/plugins/redis/index.html b/plugins/redis/index.html index a2b0ad7c2..ec400b9cc 100755 --- a/plugins/redis/index.html +++ b/plugins/redis/index.html @@ -19,6 +19,7 @@

负载状态

复制状态

集群状态

+

集群节点

日志

diff --git a/plugins/redis/index.py b/plugins/redis/index.py index bf55b08b5..6493446a9 100755 --- a/plugins/redis/index.py +++ b/plugins/redis/index.py @@ -393,6 +393,21 @@ def clusterInfo(): return mw.getJson(result) +def clusterNodes(): + s = status() + if s == 'stop': + return mw.returnJson(False, '未启动') + + cmd = getRedisCmd() + cmd = cmd + 'cluster nodes' + + # print(cmd) + data = mw.execShell(cmd)[0] + # print(data) + + data = data.strip().split("\n") + return mw.getJson(data) + def initdStatus(): current_os = mw.getOs() if current_os == 'darwin': @@ -539,6 +554,8 @@ if __name__ == "__main__": print(infoReplication()) elif func == 'cluster_info': print(clusterInfo()) + elif func == 'cluster_nodes': + print(clusterNodes()) elif func == 'conf': print(getConf()) elif func == 'run_log': diff --git a/plugins/redis/js/redis.js b/plugins/redis/js/redis.js index 80ab79e89..70835a7c6 100755 --- a/plugins/redis/js/redis.js +++ b/plugins/redis/js/redis.js @@ -165,8 +165,8 @@ function clusterStatus(version){ 'cluster_stats_messages_received':'接收', 'cluster_current_epoch':'集群当前epoch', 'cluster_my_epoch':'当前我的epoch', - 'cluster_slots_pfail':'处于PFAIL状态的节点槽数', - 'cluster_slots_fail':'处于FAIL状态的节点槽数', + 'cluster_slots_pfail':'处于PFAIL状态的槽数', + 'cluster_slots_fail':'处于FAIL状态的槽数', 'total_cluster_links_buffer_limit_exceeded':'超出缓冲区总数', } @@ -196,6 +196,35 @@ function clusterStatus(version){ $(".soft-man-con").html(con); }); } + +function clusterNodes(version){ + redisPost('cluster_nodes', version, {},function(data){ + var rdata = $.parseJSON(data.data); + + if ('status' in rdata && !rdata.status){ + layer.msg(rdata.msg,{icon:0,time:2000,shade: [0.3, '#000']}); + return; + } + + // console.log(rdata); + var tbody_text = ''; + for (k in rdata){ + tbody_text += ''+ rdata[k] +''; + } + + if (tbody_text == ''){ + tbody_text += '无数据/未设置集群'; + } + + var con = '
\ + \ + \ + '+tbody_text+'\ +
节点信息
'; + $(".soft-man-con").html(con); + }); +} + //redis状态 end //配置修改 diff --git a/plugins/redis/tpl/redis_cluster.conf b/plugins/redis/tpl/redis_cluster.conf index c002bfec6..7c2364132 100644 --- a/plugins/redis/tpl/redis_cluster.conf +++ b/plugins/redis/tpl/redis_cluster.conf @@ -10,7 +10,6 @@ tcp-keepalive 0 bind 127.0.0.1 port 6379 -requirepass {$REDIS_PASS} ################################ SNAPSHOTTING #################################