zoukankan      html  css  js  c++  java
  • Centos7搭建redis集群及安装sentinel

    准备三个节点,系统版本为CentOS7.3

    11.0.8.15 	master
    11.0.8.16 	slave01
    11.0.8.17 	slave02
    

    1、安装redis

    # yum install -y redis
    

    2、修改redis的配置文件

    # vim /etc/redis.conf
    #bind 127.0.0.1
    protected-mode no
    daemonize yes
    appendonly yes
    slaveof 11.0.8.15 6379    #从节点需要开启这条指令
    

    3、启动redis服务

    # systemctl start redis && systemctl enable redis
    

    4、查看复制信息

    # redis-cli -h 11.0.8.15 
    11.0.8.15:6379> set name keith
    OK
    11.0.8.15:6379> get name
    "keith"
    11.0.8.15:6379> keys *
    1) "name"
    
    11.0.8.15:6379> info replication
    # Replication
    role:master
    connected_slaves:2
    slave0:ip=11.0.8.16,port=6379,state=online,offset=128,lag=1
    slave1:ip=11.0.8.17,port=6379,state=online,offset=142,lag=1
    master_repl_offset:142
    repl_backlog_active:1
    repl_backlog_size:1048576
    repl_backlog_first_byte_offset:2
    repl_backlog_histlen:141
    

    5、修改sentinel的配置文件

    # vim /etc/redis-sentinel.conf 
    sentinel monitor mymaster 11.0.8.15 6379 2
    

    6、启动sentinel服务

    # systemctl start redis-sentinel && systemctl enable redis-sentinel
    
    # netstat -tnlp
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
    tcp        0      0 0.0.0.0:26379           0.0.0.0:*               LISTEN      41288/redis-sentine 
    tcp        0      0 0.0.0.0:6379            0.0.0.0:*               LISTEN      41220/redis-server  
    tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/systemd           
    tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN      932/dnsmasq         
    tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1555/sshd           
    tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1178/master         
    tcp6       0      0 :::26379                :::*                    LISTEN      41288/redis-sentine 
    tcp6       0      0 :::6379                 :::*                    LISTEN      41220/redis-server  
    tcp6       0      0 :::111                  :::*                    LISTEN      1/systemd           
    tcp6       0      0 :::53                   :::*                    LISTEN      932/dnsmasq         
    tcp6       0      0 :::22                   :::*                    LISTEN      1555/sshd           
    tcp6       0      0 ::1:25                  :::*                    LISTEN      1178/master
    
  • 相关阅读:
    iOS 索引列 使用详解
    iOS 搜索条使用详解
    iOS 百度地图使用详解
    在iOS中使用ZBar扫描二维码和条形码
    自学html-five(锚点、伪类、字符实体)
    自学html-four(css初始化及html语义标签 -> h标签 p标签 img标签 有序列表 无序列表 表格 超链接)
    自学html--htree(CSS)
    自学html--two(盒模型)
    自学html--one(div布局)
    常用控件补充(UIDatePicker、UIWebView)
  • 原文地址:https://www.cnblogs.com/keithtt/p/6719532.html
Copyright © 2011-2022 走看看