好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

NoSQL之redis之哨兵服务

1 安装redis 软件 503 rpm -q gcc || yum - y install gcc 504 tar -zxvf redis- 4.0 . 8 .tar.gz 505 cd redis- 4.0 . 8 / 506 ls 507 make && make install

2 创建并编写哨兵服务的主配置文件

]# vim /etc/ sentinel.conf
bind   192.168 . 4.57   #哨兵服务使用的ip地址
port   26379   #服务端口号
sentinel monitor  plj    192.168 . 4.51   6379    1    #监视的主服务器是谁
sentinel auth -pass  plj  123456    #指定主服务器的连接密码
:wq        
          3   启动哨兵服务
]#redis -sentinel  /etc/sentinel.conf  (启动信息占用终端显示
 4   测试配置
              4.1   停止主服务器51 的redis服务 
]# redis -cli  -h  192.168 . 4.51  -a   123456   shutdown

              4.2   哨兵服务终端 查看监视信息 
                有监视的信息输出
                
              4.3   原先slave角色的主机,角色变为master 
                  192.168 . 4.51 : 6379 >  info replicaiton 
                Role:Master
            
              4.4   查看哨兵服务的主配置文件,会自动监视新的主服务器
                cat  /etc/ sentinel.conf
                
              4.5   宕机master 启动后,自动配置为 当前master 的slave 
                需要手动指定连接当前master 主机的连接密码
              192.168 . 4.51 : 6379 > config  set  masterauth  123456     
             192.168 . 4.51 : 6379 >  config rewirte
              192.168 . 4.51 : 6379 >  info replicaiton
            Role:slave 

 

NoSQL之redis之哨兵服务

标签:宕机   主机   升级   class   info   span   rgba   服务端   yum   

查看更多关于NoSQL之redis之哨兵服务的详细内容...

  阅读:30次