上一篇博客我们介绍了Redis Sentinel的安装配置,详情可参考链接:Redis Sentinel--安装配置,今天主要做几个简单的测试Case

Redis Sentinel API

ping 正常会返回pong
sentinel masters  返回被监视的所有master及状态
sentinel master <master name> 返回指定的master及状态
setntinel slaves <master name> 返回slave及状态
sentinel sentinels <master name> 返回sentinel及状态
sentinel get-master-addr-by-name mymaster 返回现在的master IP和Port
sentinel reset * 清理已经移除的master-slave或者sentinel信息
sentinel failover <master name>手动执行故障转移
sentinel ckquorum <master name> 返回(OK 3 usable Sentinels. Quorum and failover authorization can be reached)
sentinel flushconfig 如果sentinel.conf丢失,可以使用这个命令生成新的配置文件

添加Sentinel

增加一个sentinel很简单,直接配置好sentinel.conf文件,开启一个sentinel即可;

添加时最好一个添加结束后,再添加另外一个,不要同时添加,可以每隔30秒添加一个sentinel;

通过SENTINEL MASTER mastername中的num-other-sentinels来查看是否成功添加sentinel。

[root@sht-sgmhadoopdn-04 redis]# cat sentinel.conf
daemonize yes
port 26379
logfile "sentinel.log"
dir "/usr/local/redis"
protected-mode no
sentinel myid 79393e76e002cb64db92fb8bcb88d79f2d85a82b
sentinel monitor mymaster 172.16.101.59 6379 2[root@sht-sgmhadoopdn-04 redis]# src/redis-sentinel sentinel.conf172.16.101.54:26379> sentinel master mymaster
33) "num-other-sentinels"
34) "3"

移除Sentinel

删除一个sentinel稍微复杂一点,sentinel永远不会删除一个已经存在过的sentinel,即使它已经与组织失去联系

Step:

(1) Stop the Sentinel process of the Sentinel you want to remove.

(2) Send a SENTINEL RESET * command to all the other Sentinel instances (instead of * you can use the exact master name if you want to reset just a single master). One after the other, waiting at least 30 seconds between instances.

(3) Check that all the Sentinels agree about the number of Sentinels currently active, by inspecting the output of SENTINEL MASTER mastername of every Sentinel.

[root@sht-sgmhadoopdn-04 redis]# ps -ef|grep redis
root     17510     1  0 18:34 ?        00:00:03 src/redis-sentinel *:26379 [sentinel]
[root@sht-sgmhadoopdn-04 redis]# kill -9 17510

在其他的每个sentinel节点上,每个隔30s执行

172.16.101.54:26379> sentinel reset *
172.16.101.55:26379> sentinel reset *
172.16.101.56:26379> sentinel reset *
172.16.101.54:26379> sentinel master mymaster
33) "num-other-sentinels"
34) "2"

移除一个老的master或不可用的slave

[root@sht-sgmhadoopdn-01 redis]# ps -ef|grep redis
root     15261     1  0 Aug05 ?        00:05:55 src/redis-server 172.16.101.58:6379
root     19768 19394  0 21:09 pts/2    00:00:00 grep --color=auto redis
[root@sht-sgmhadoopdn-01 redis]# kill -9 15261
172.16.101.54:26379> sentinel masters31) "num-slaves"32) "2"

在每个sentinel节点上,每个隔30s执行

172.16.101.54:26379> sentinel reset mymaster
172.16.101.55:26379> sentinel reset mymaster
172.16.101.56:26379> sentinel reset mymaster172.16.101.54:26379> sentinel masters31) "num-slaves"32) "1"

转载于:https://blog.51cto.com/darrenmemos/2156538

Redis Sentinel--运维管理相关推荐

  1. Docker容器虚拟化技术---Docker运维管理(Docker Compose)4

    Docker容器虚拟化技术-Docker运维管理(Docker Compose)4 Docker Compose 通过前面的讲解我们知道使用一个Dockerfile模板文件,可以很方便地定义一个单独的 ...

  2. 您所知道的IT运维管理

    <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />  网络规模的发 ...

  3. 记一次redis规模化运维讨论会

    http://www.10tiao.com/html/490/201608/2648672432/1.html 7月29日下午,在滴滴,有幸邀请到了业界的一些同学,一起就「redis规模化运维」踩过的 ...

  4. 科技推动时代发展,浅谈IT技术如何改善数据中心运维管理

    伴随现代化社会不断发展,众多企业逐渐扩大规模,业务剧增,数据中心的重要性由此可见,同时数据中心设施.规模都逐渐丰富起来,企业核心数据也更加集中.此时,对于数据中心的管理者职责和压力更是加剧,这也就要求 ...

  5. 问答|数据中心运维管理VIP学习群

    今天在数据中心运维管理VIP学习群里有群友提问现在北京的数据中心是否可以申请降低基础电费?群里的张总已经回答:三个月可以申请一次调整基础容量. 数据中心一旦运行,永不停歇,所以数据中心是用电大户也被称 ...

  6. 数据中心基础设施及日常运维管理

    资料免费送(点击链接下载) 史上最全,数据中心机房标准及规范汇总(下载) 数据中心运维管理 | 资料汇总(2017.7.2版本) 加入运维管理VIP群(点击链接查看) <数据中心运维管理> ...

  7. 机房运维很枯燥?来看看中国银行数据中心基础设施可视化运维管理

    谁说高大上的机房不能炫!设备环境团队联合运营平台研发.网络.系统三.系统二等团队,历经一年的时间.7轮次需求细化讨论.11次版本更新,精雕细琢.倾尽洪荒之力打造了中国银行数据中心基础设施可视化平台!这 ...

  8. “数据中心运维管理VIP学习群”问题汇总(一)

    针对群友提出问题以及回答作了汇总,方便大家交流与学习,另外,一些未得到解答的问题或者是答案不够准确地也希望同行们能够献策献计,把自己的运维经验分享出来,共同进步. Q1:WDZA和WDZN电缆有什么区 ...

  9. 不吹不黑,赞一下应用运维管理的cassacdra

    不吹不黑的为菊厂的应用运维管理AOM点个赞.Why? 某菊厂应用运维管理工具AOM每天处理着亿级条数据,这么多数据是怎么存储的呢? 说到数据存储就会想到关系型数据库,比如mysql,oracle,sy ...

  10. zookeeper运维管理

    目录: 1.运维管理 2.淘宝的关于zookeeper的多篇文章: link:http://nileader.blog.51cto.com/1381108/1068033 zookeeper 运维管理 ...

最新文章

  1. linux 下面安装mysql
  2. oracle取出对应时间间隔内的数据 between-and
  3. SQL Server 自增字段重置
  4. 袁亚湘:愿为数学做更多
  5. 数据库(mysql)基本语句操作
  6. Linux 建立文件夹的链接
  7. xp的guest访问
  8. 拉普拉斯(逆)变换的计算
  9. python爬虫爬取网站视频
  10. 若依设置匿名访问路径
  11. mysql 修改校对规则_调整MYSQL校对规则
  12. juniper防火墙外部网址设置
  13. 「CodePlus 2017 11 月赛」大吉大利,晚上吃鸡!(dij+bitset)
  14. 修改Worldpress主题的Footer/Header部分
  15. python 正则表达式 匹配身份证号
  16. 扁平化数据处理成tree树形结构
  17. might和could的区别用法_情态动词could,would,might等的用法区别
  18. 我的天!Win10可以从应用商店安装Ubuntu了
  19. 【Java异常】Cannot deserialize value of type `java.util.Date` from String “2020-04-27T19:43:05.000+0800
  20. 听完计算机讲座的感想,听讲座心得体会5篇

热门文章

  1. Windows 7 IIS (HTTP Error 500.21 - Internal Server Error)解决
  2. Linux下oracle 9i图文安装二
  3. 如何将mysql卸载干净
  4. Github多人合作用法
  5. angular的路由
  6. sqlserver 把两个sql查询语句查询出来的两张表合并成一张表
  7. s2 devMode cmdshell
  8. [恢]hdu 1412
  9. 《敏捷开发绩效管理》扩展阅读(敏捷开发绩效管理,敏捷团队绩效管理)
  10. VC10中的C++0x特性简介