前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >sentinel 相关api

sentinel 相关api

作者头像
陳斯托洛夫斯記
发布2022-10-27 14:33:00
1440
发布2022-10-27 14:33:00
举报
文章被收录于专栏:XBD
代码语言:javascript
复制
# 
127.0.0.1:26379> sentinel masters
1)  1) "name"
    2) "test"
    3) "ip"
    4) "192.168.1.67"
    5) "port"
    6) "6379"
    7) "runid"
    8) "e41042380e038e28ee3bdb76e0d212eaaabf2491"
    9) "flags"
   10) "master"
   11) "pending-commands"
   12) "0"
   13) "last-ping-sent"
   14) "0"
   15) "last-ok-ping-reply"
   16) "459"
   17) "last-ping-reply"
   18) "459"
   19) "down-after-milliseconds"
   20) "30000"
   21) "info-refresh"
   22) "3591"
   23) "role-reported"
   24) "master"
   25) "role-reported-time"
   26) "114000"
   27) "config-epoch"
   28) "0"
   29) "num-slaves"
   30) "1"
   31) "num-other-sentinels"
   32) "2"
   33) "quorum"
   34) "2"
   35) "failover-timeout"
   36) "180000"
   37) "parallel-syncs"
   38) "1"
2)  1) "name"
    2) "mymaster"
    3) "ip"
    4) "192.168.1.116"
    5) "port"
    6) "6379"
    7) "runid"
    8) "3b5e94fd1e5c50827eb75e5da652b8f53e5e8995"
    9) "flags"
   10) "master"
   11) "pending-commands"
   12) "0"
   13) "last-ping-sent"
   14) "0"
   15) "last-ok-ping-reply"
   16) "458"
   17) "last-ping-reply"
   18) "458"
   19) "down-after-milliseconds"
   20) "30000"
   21) "info-refresh"
   22) "3591"
   23) "role-reported"
   24) "master"
   25) "role-reported-time"
   26) "114000"
   27) "config-epoch"
   28) "0"
   29) "num-slaves"
   30) "1"
   31) "num-other-sentinels"
   32) "2"
   33) "quorum"
   34) "2"
   35) "failover-timeout"
   36) "180000"
   37) "parallel-syncs"
   38) "1"


代码语言:javascript
复制
# 查看指定<master name>主节点状态信息
127.0.0.1:26379> sentinel master test
 1) "name"
 2) "test"
 3) "ip"
 4) "192.168.1.67"
 5) "port"
 6) "6379"
 7) "runid"
 8) "e41042380e038e28ee3bdb76e0d212eaaabf2491"
 9) "flags"
10) "master"
11) "pending-commands"
12) "0"
13) "last-ping-sent"
14) "0"
15) "last-ok-ping-reply"
16) "489"
17) "last-ping-reply"
18) "489"
19) "down-after-milliseconds"
20) "30000"
21) "info-refresh"
22) "4873"
23) "role-reported"
24) "master"
25) "role-reported-time"
26) "235678"
27) "config-epoch"
28) "0"
29) "num-slaves"
30) "1"
31) "num-other-sentinels"
32) "2"
33) "quorum"
34) "2"
35) "failover-timeout"
36) "180000"
37) "parallel-syncs"
38) "1"

代码语言:javascript
复制
# 查看指定<master name>从节点状态信息
127.0.0.1:26379> sentinel slaves test
1)  1) "name"
    2) "192.168.1.167:6379"
    3) "ip"
    4) "192.168.1.167"
    5) "port"
    6) "6379"
    7) "runid"
    8) "ea5e325c52977ebd7d0fba2953d29fc6f2abac68"
    9) "flags"
   10) "slave"
   11) "pending-commands"
   12) "0"
   13) "last-ping-sent"
   14) "0"
   15) "last-ok-ping-reply"
   16) "878"
   17) "last-ping-reply"
   18) "878"
   19) "down-after-milliseconds"
   20) "30000"
   21) "info-refresh"
   22) "6544"
   23) "role-reported"
   24) "slave"
   25) "role-reported-time"
   26) "347755"
   27) "master-link-down-time"
   28) "0"
   29) "master-link-status"
   30) "ok"
   31) "master-host"
   32) "192.168.1.67"
   33) "master-port"
   34) "6379"
   35) "slave-priority"
   36) "100"
   37) "slave-repl-offset"
   38) "325349"

代码语言:javascript
复制
# 查看指定<master name>的sentinel节点信息(不包含当前sentinel节点信息)
127.0.0.1:26379> sentinel sentinels test
1)  1) "name"
    2) "192.168.1.94:26379"
    3) "ip"
    4) "192.168.1.94"
    5) "port"
    6) "26379"
    7) "runid"
    8) "38969a5853bf3d1e6edf730c171af0590329c9ba"
    9) "flags"
   10) "sentinel"
   11) "pending-commands"
   12) "0"
   13) "last-ping-sent"
   14) "0"
   15) "last-ok-ping-reply"
   16) "321"
   17) "last-ping-reply"
   18) "321"
   19) "down-after-milliseconds"
   20) "30000"
   21) "last-hello-message"
   22) "262"
   23) "voted-leader"
   24) "?"
   25) "voted-leader-epoch"
   26) "0"
2)  1) "name"
    2) "192.168.1.58:26379"
    3) "ip"
    4) "192.168.1.58"
    5) "port"
    6) "26379"
    7) "runid"
    8) "86db07d703d1d71657dc826e90afc146e1f5345e"
    9) "flags"
   10) "sentinel"
   11) "pending-commands"
   12) "0"
   13) "last-ping-sent"
   14) "0"
   15) "last-ok-ping-reply"
   16) "321"
   17) "last-ping-reply"
   18) "321"
   19) "down-after-milliseconds"
   20) "30000"
   21) "last-hello-message"
   22) "470"
   23) "voted-leader"
   24) "?"
   25) "voted-leader-epoch"
   26) "0"

代码语言:javascript
复制
# 查看指定<master name>主节点的IP和端口
127.0.0.1:26379> sentinel get-master-addr-by-name test
1) "192.168.1.67"
2) "6379"

代码语言:javascript
复制
# 重置<master name>主节点的配置,包含清除主节点的相关状态(例如故障转移),重新发现从节点和Sentinel节点
127.0.0.1:26379> sentinel reset test

对指定<master name>主节点强制故障转移

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档