角色          ip       port
master      127.0.0.1  6379  
slave-1     127.0.0.1  6380  
slave-2     127.0.0.1  6381  
sentinel-1  127.0.0.1  26379  
sentinel-2  127.0.0.1  26380  
sentinel-3  127.0.0.1  26381

/etc/redis_6379.conf 文件配置
port 6379
daemonize yes
pidfile /var/run/redis_6379.pid
logfile "6379.log"
dbfilename "dump-6379.rdb"
dir "/data/redis/6379/"

/etc/redis_6380.conf 文件配置
port 6380
daemonize yes
pidfile /var/run/redis_6380.pid
logfile "6380.log"
dbfilename "dump-6380.rdb"
dir "/data/redis/6380/"
slaveof 127.0.0.1 6379

/etc/redis_6381.conf 文件配置
port 6381
daemonize yes
pidfile /var/run/redis_6380.pid
logfile "6381.log"
dbfilename "dump-6381.rdb"
dir "/data/redis/6381/"
slaveof 127.0.0.1 6379

/etc/redis_sentinel_26379.conf 文件配置
port 26379
daemonize yes
dir /data/redis/26379/
logfile "26379.log"
sentinel monitor mymaster 127.0.0.1 6379 2
sentinel down-after-milliseconds mymaster 30000
sentinel parallel-syncs mymaster 1
sentinel failover-timeout mymaster 180000

/etc/redis_sentinel_26380.conf 文件配置  
port 26380
daemonize yes
dir /data/redis/26380/
logfile "26380.log"
sentinel monitor mymaster 127.0.0.1 6380 2
sentinel down-after-milliseconds mymaster 30000
sentinel parallel-syncs mymaster 1
sentinel failover-timeout mymaster 180000

/etc/redis_sentinel_26381.conf 文件配置  
port 26381
daemonize yes
dir /data/redis/26381/
logfile "26381.log"
sentinel monitor mymaster 127.0.0.1 6381 2
sentinel down-after-milliseconds mymaster 30000
sentinel parallel-syncs mymaster 1
sentinel failover-timeout mymaster 180000

启动redis节点
redis-server /etc/redis_6379.conf &
redis-server /etc/redis_6380.conf &
redis-server /etc/redis_6381.conf &

启动sentinel节点
redis-sentinel /etc/redis_sentinel_26379.conf &
redis-sentinel /etc/redis_sentinel_26380.conf &
redis-sentinel /etc/redis_sentinel_26381.conf &

或者也可以使用此命令
redis-server /etc/redis_sentinel_26379.conf --sentinel &
redis-server /etc/redis_sentinel_26380.conf --sentinel &
redis-server /etc/redis_sentinel_26381.conf --sentinel &

确认
[root@lgj01 ~]# redis-cli -h 127.0.0.1 -p 6379 ping
PONG
[root@lgj01 ~]# redis-cli -h 127.0.0.1 -p 6380 ping
PONG
[root@lgj01 ~]# redis-cli -h 127.0.0.1 -p 6381 ping
PONG

[root@lgj01 ~]# redis-cli -h 127.0.0.1 -p 26379 info sentinel
# Sentinel
sentinel_masters:1
sentinel_tilt:0
sentinel_running_scripts:0
sentinel_scripts_queue_length:0
sentinel_simulate_failure_flags:0
master0:name=mymaster,status=ok,address=127.0.0.1:6379,slaves=2,sentinels=3

[root@lgj01 ~]# redis-cli -h 127.0.0.1 -p 26380 info sentinel
# Sentinel
sentinel_masters:1
sentinel_tilt:0
sentinel_running_scripts:0
sentinel_scripts_queue_length:0
sentinel_simulate_failure_flags:0
master0:name=mymaster,status=sdown,address=127.0.0.1:6380,slaves=0,sentinels=2

[root@lgj01 ~]# redis-cli -h 127.0.0.1 -p 26381 info sentinel
# Sentinel
sentinel_masters:1
sentinel_tilt:0
sentinel_running_scripts:0
sentinel_scripts_queue_length:0
sentinel_simulate_failure_flags:0
master0:name=mymaster,status=sdown,address=127.0.0.1:6381,slaves=0,sentinels=2

[root@lgj01 etc]# ps -ef|grep redis
root      3667     1  0 10:05 ?        00:00:00 /usr/local/redis/bin/redis-server 127.0.0.1:6379
root      3675     1  0 10:05 ?        00:00:00 /usr/local/redis/bin/redis-server 127.0.0.1:6380
root      3684     1  0 10:05 ?        00:00:00 /usr/local/redis/bin/redis-server 127.0.0.1:6381
root      4091     1  0 10:13 ?        00:00:00 redis-sentinel *:26379 [sentinel]
root      4108     1  0 10:13 ?        00:00:00 redis-sentinel *:26380 [sentinel]
root      4116     1  0 10:13 ?        00:00:00 redis-sentinel *:26381 [sentinel]
root      4128   781  0 10:13 pts/0    00:00:00 grep --color=auto redis

[root@lgj01 ~]# netstat -tnlp|grep redis
tcp        0      0 0.0.0.0:26379           0.0.0.0:*               LISTEN      4091/redis-sentinel
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      3667/redis-server 1
tcp        0      0 0.0.0.0:26380           0.0.0.0:*               LISTEN      4108/redis-sentinel
tcp        0      0 127.0.0.1:6380          0.0.0.0:*               LISTEN      3675/redis-server 1
tcp        0      0 0.0.0.0:26381           0.0.0.0:*               LISTEN      4116/redis-sentinel
tcp        0      0 127.0.0.1:6381          0.0.0.0:*               LISTEN      3684/redis-server 1
tcp6       0      0 :::26379                :::*                    LISTEN      4091/redis-sentinel
tcp6       0      0 :::26380                :::*                    LISTEN      4108/redis-sentinel
tcp6       0      0 :::26381                :::*                    LISTEN      4116/redis-sentinel

关闭 sentinel
redis-cli -p 26379 shutdown

redis三节点sentinel部署的更多相关文章

  1. Redis主从加Sentinel模式部署

    总体部署 一主二从三哨兵 ip地址分配分别为 主 127.0.0.1:6379 从 127.0.0.1:6389 从 127.0.0.1:6399 哨兵 127.0.0.1:26379 哨兵 127. ...

  2. Hadoop 完全分布式部署(三节点)

    用来测试,我在VMware下用Centos7搭起一个三节点的Hadoop完全分布式集群.其中NameNode和DataNode在同一台机器上,如果有条件建议大家把NameNode单独放在一台机器上,因 ...

  3. rancher三节点k8s集群部署例子

    rancher三节点k8s集群部署例子 待办 https://rorschachchan.github.io/2019/07/25/使用Rancher2-1部署k8s/

  4. OceanBase三节点部署&&扩容

    OceanBase三节点部署&&扩容 环境信息搭建三节点(1-1-1)创建资源池和租户查看数据分布 环境信息 IP OB目录 端口 192.168.43.89 /data/observ ...

  5. Redis master/slave,sentinel,Cluster简单总结

    现在互联网项目中大量使用了redis,本文著主要分析下redis 单点,master/slave,sentinel模式.cluster的一些特点. 一.单节点模式 单节点实例还是比较简单的,平时做个测 ...

  6. centos6下redis cluster集群部署过程

    一般来说,redis主从和mysql主从目的差不多,但redis主从配置很简单,主要在从节点配置文件指定主节点ip和端口,比如:slaveof 192.168.10.10 6379,然后启动主从,主从 ...

  7. Redis集群模式部署

    以下以Linux(CentOS)系统为例 1.1 下载和编译 $ wget http://download.redis.io/releases/redis-4.0.7.tar.gz $ tar xzf ...

  8. Linux 下Redis集群安装部署及使用详解(在线和离线两种安装+相关错误解决方案)

    一.应用场景介绍 本文主要是介绍Redis集群在Linux环境下的安装讲解,其中主要包括在联网的Linux环境和脱机的Linux环境下是如何安装的.因为大多数时候,公司的生产环境是在内网环境下,无外网 ...

  9. Redis哨兵(Sentinel)模式快速入门

    更多内容,欢迎关注微信公众号:全菜工程师小辉.公众号回复关键词,领取免费学习资料. 当主服务器宕机后,需要手动把一台从服务器切换为主服务器,这就需要人工干预,费事费力,还会造成一段时间内服务不可用. ...

随机推荐

  1. 存储器的保护(一)——《x86汇编语言:从实模式到保护模式》读书笔记18

    本文是原书第12章的学习笔记. 说句题外话,这篇博文是补写的,因为让我误删了,可恶的是CSDN的回收站里找不到! 好吧,那就再写一遍,我有坚强的意志.司马迁曰:“文王拘而演<周易>:仲尼厄 ...

  2. Layer UI 模块化的用法(转)

    此文章适合入门的同学查看,之前因为项目的原因,在网上找了一套Layer UI做的后台管理系统模板,完全不懂LayUI里面的JS用法,看了官方文档和其它资料后才明白怎么去实现模块化这个例子,但是还是感觉 ...

  3. 利用canvas制作图片(可缩放和平移)+相框+文字

    前言: 公司一个售前问我能不能用H5做一个手机拍照,给相片添加相框和添加文字上传到服务器的功能,我当时一琢磨觉得可行,就利用空余时间做了一个demo,去掉了拍照和上传,如果以后有机会,会给补上,当然对 ...

  4. 流畅的python和cookbook学习笔记(六)

    1.同时迭代多个序列(zip(函数)) 使用zip()函数可以同时迭代多个序列. >>> X = [1, 2, 3, 4, 5, 6] >>> Y = [121, ...

  5. JFrame自适应大小

    pack();函数调用PreferedSize(); 所以对于组件要setPreferedSize();

  6. MVC设计模式实现权限管理登录,超详细

    功能实现:在页面输入给定的用户名之一,可以显示当前用户的权限,也可以在页面更改该用户的权限,更新之后保存.像下面这样. 填写用户名提交: 显示用户AAA的权限: 修改权限(增加article3): 点 ...

  7. my docker note

    环境: docker1.10.3 #hello docker docker run --name myhello docker.io/centos:67591570dd29 /bin/echo 'he ...

  8. html元素 input各种输入限制

    1.取消按钮按下时的虚线框,在input里添加属性值 hideFocus 或者 HideFocus=true <input type="submit" value=" ...

  9. sql: T-SQL parent-child function script

    --Parent-Child reationship --涂聚文 2014-08-25 --得位置的子節點函數表(包含本身) if exists (select * from dbo.sysobjec ...

  10. 记录开发Nodejs c++ addon的一些经验(二、数据类型的转换(尤其是Buffer))

    常见的数据类型的转换基本比较容易,结合nan应该不是一件难事 参考链接: http://blog.jobbole.com/109598/ http://deadhorse.me/nodejs/2012 ...