redis cluster command
来源:互联网 发布:机械工业出版社 知乎 编辑:程序博客网 时间:2024/05/16 19:44
1.列出集群中的slot分配
cluster slots
1) 1) (integer) 10923 2) (integer) 16383 3) 1) "127.0.0.1" 2) (integer) 7002 4) 1) "127.0.0.1" 2) (integer) 70052) 1) (integer) 5461 2) (integer) 10922 3) 1) "127.0.0.1" 2) (integer) 7001 4) 1) "127.0.0.1" 2) (integer) 70043) 1) (integer) 0 2) (integer) 5460 3) 1) "127.0.0.1" 2) (integer) 7000 4) 1) "127.0.0.1" 2) (integer) 7003
2.列出集群中的节点
Cluster nodes
10332dcc956ed930789572f431d25730b9341ba9 127.0.0.1:7002 master - 0 1428550980814 3 connected 10923-16383e956d0f4cbe4a0ee688d7d561088d8878738274b 127.0.0.1:7001 master - 0 1428550982315 2 connected 5461-1092288a78c882554a45039967becd489c27b120cf8ff 127.0.0.1:7000 myself,master - 0 0 1 connected 0-5460a86e9770d1783edc1ed3753a4b784c1a41126cdc 127.0.0.1:7005 slave 10332dcc956ed930789572f431d25730b9341ba9 0 1428550982815 6 connected130e772599b1f0fce606f58794ebd962d0ab8963 127.0.0.1:7003 slave 88a78c882554a45039967becd489c27b120cf8ff 0 1428550982815 4 connecteddfa1b2444a1c3200a9d1c9be858b47f0e3756f3f 127.0.0.1:7004 slave e956d0f4cbe4a0ee688d7d561088d8878738274b 0 1428550981315 5 connected
3.查看集群信息
cluster info
cluster_state:okcluster_slots_assigned:16384cluster_slots_ok:16384cluster_slots_pfail:0cluster_slots_fail:0cluster_known_nodes:6cluster_size:3cluster_current_epoch:6cluster_my_epoch:1cluster_stats_messages_sent:291518cluster_stats_messages_received:291518
4.查询key的keyslot值
cluster keyslot “hello”
127.0.0.1:7000> cluster keyslot hello(integer) 866
5.执行failover
CLUSTER FAILOVER [FORCE|TAKEOVER]
FORCE 直接进入第4步,特别适用于主挂了的情况,特别注意,主服务要数量能够达到failover最低值。
TAKEOVER 慎用,适用于FOECE搞不定的情况。
failover过程:
1.The slave tells the master to stop processing queries from clients.从告诉主停止处理客户端请求。2.The master replies to the slave with the current replication offset.主服务告诉从服务现在的复制偏移量(就是复制到哪了,主会记录每个从的复制进度)。3.The slave waits for the replication offset to match on its side, to make sure it processed all the data from the slave before to continue.从服务根据主服务返回的复制偏移量和自己保存的值对比,确保数据一致。4.The slave starts a failover, obtains a new configuration epoch from the majority of the masters, and broadcast the new configuration.启动failover就,获取投票epoch,广播配置。 5.The old master receives the configuration update: unblocks its clients and start replying with redirection messages so that they'll continue the chat with the new master.旧主收到配置更新,下台。
0 0
- redis cluster command
- redis cluster command
- redis cluster
- redis cluster
- redis cluster
- redis cluster
- redis cluster
- redis cluster
- redis cluster
- redis cluster
- Redis Cluster
- redis cluster
- redis-cluster
- Redis Cluster
- redis cluster
- Redis --- Redis Cluster
- redis command
- redis-cluster的搭建
- maven3 手动安装本地jar到仓库
- linux下logrotate 配置和理解
- A Guided Tour of WPF By Josh Smith
- opencv配置经常遇到的错误
- 开心的四月
- redis cluster command
- ClassNotFoundException:org.springframework.web.context.ContextLoaderListener
- 擅长排列的小明
- 清明节待客哭坟业务 1分钟300元免费播放音乐
- web 程序中翻页选中问题
- oracle面试题库集锦
- java操作Excel文件
- zoj 3175 Number of Containers (大数灵活题,除2改成平方根)
- Centos 64下实现socket通信