首页 > 数据库 >redis搭建集群

redis搭建集群

时间:2023-02-16 09:22:35浏览次数:54  
标签:node 31.33 redis 192.168 cluster 集群 master slots 搭建

##################

 

 

 

 

添加从库点给指定主库:

[[email protected] redis_7001]$ ./bin/redis-cli -a 'jJAV0kTokNb8iZvwfqniCxmFZEsbOH5n' --cluster add-node 192.168.31.33:7004 192.168.31.33:7001  --cluster-slave --cluster-master-id 06f1a071ffac504d14f6448fd08bc56a12ee4c2e
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
>>> Adding node 192.168.31.33:7004 to cluster 192.168.31.33:7001
>>> Performing Cluster Check (using node 192.168.31.33:7001)
M: 06f1a071ffac504d14f6448fd08bc56a12ee4c2e 192.168.31.33:7001
   slots:[0-5460] (5461 slots) master
M: 3b2010b088f81db2dbae5f674f133aeef293d2e8 192.168.31.33:7002
   slots:[5461-10922] (5462 slots) master
M: 331628fcc89591eafd378d5c4bf15c67be4a60d7 192.168.31.33:7003
   slots:[10923-16383] (5461 slots) master
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
>>> Send CLUSTER MEET to node 192.168.31.33:7004 to make it join the cluster.
Waiting for the cluster to join

>>> Configure node as replica of 192.168.31.33:7001.
[OK] New node added correctly.
[[email protected] redis_7001]$ ./bin/redis-cli -a 'jJAV0kTokNb8iZvwfqniCxmFZEsbOH5n' --cluster add-node 192.168.31.33:7005 192.168.31.33:7002  --cluster-slave --cluster-master-id 3b2010b088f81db2dbae5f674f133aeef293d2e8
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
>>> Adding node 192.168.31.33:7005 to cluster 192.168.31.33:7002
>>> Performing Cluster Check (using node 192.168.31.33:7002)
M: 3b2010b088f81db2dbae5f674f133aeef293d2e8 192.168.31.33:7002
   slots:[5461-10922] (5462 slots) master
S: 930b0fb946cd67aaae5642d4cf306638e11913a3 192.168.31.33:7004
   slots: (0 slots) slave
   replicates 06f1a071ffac504d14f6448fd08bc56a12ee4c2e
M: 331628fcc89591eafd378d5c4bf15c67be4a60d7 192.168.31.33:7003
   slots:[10923-16383] (5461 slots) master
M: 06f1a071ffac504d14f6448fd08bc56a12ee4c2e 192.168.31.33:7001
   slots:[0-5460] (5461 slots) master
   1 additional replica(s)
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
>>> Send CLUSTER MEET to node 192.168.31.33:7005 to make it join the cluster.
Waiting for the cluster to join

>>> Configure node as replica of 192.168.31.33:7002.
[OK] New node added correctly.
[[email protected] redis_7001]$ ./bin/redis-cli -a 'jJAV0kTokNb8iZvwfqniCxmFZEsbOH5n' --cluster add-node 192.168.31.33:7006 192.168.31.33:7003  --cluster-slave --cluster-master-id 331628fcc89591eafd378d5c4bf15c67be4a60d7
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
>>> Adding node 192.168.31.33:7006 to cluster 192.168.31.33:7003
>>> Performing Cluster Check (using node 192.168.31.33:7003)
M: 331628fcc89591eafd378d5c4bf15c67be4a60d7 192.168.31.33:7003
   slots:[10923-16383] (5461 slots) master
M: 3b2010b088f81db2dbae5f674f133aeef293d2e8 192.168.31.33:7002
   slots:[5461-10922] (5462 slots) master
   1 additional replica(s)
S: 3fd90616dada7055d874dc92b6c5ef15fc060b8e 192.168.31.33:7005
   slots: (0 slots) slave
   replicates 3b2010b088f81db2dbae5f674f133aeef293d2e8
M: 06f1a071ffac504d14f6448fd08bc56a12ee4c2e 192.168.31.33:7001
   slots:[0-5460] (5461 slots) master
   1 additional replica(s)
S: 930b0fb946cd67aaae5642d4cf306638e11913a3 192.168.31.33:7004
   slots: (0 slots) slave
   replicates 06f1a071ffac504d14f6448fd08bc56a12ee4c2e
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
>>> Send CLUSTER MEET to node 192.168.31.33:7006 to make it join the cluster.
Waiting for the cluster to join

>>> Configure node as replica of 192.168.31.33:7003.
[OK] New node added correctly.
[[email protected] redis_7001]$ 

 

 

查看集群节点信息:

127.0.0.1:7001> cluster nodes
930b0fb946cd67aaae5642d4cf306638e11913a3 192.168.31.33:7004@17004 slave 06f1a071ffac504d14f6448fd08bc56a12ee4c2e 0 1676509675000 1 connected
3fd90616dada7055d874dc92b6c5ef15fc060b8e 192.168.31.33:7005@17005 slave 3b2010b088f81db2dbae5f674f133aeef293d2e8 0 1676509676153 2 connected
3c2b55d4b06fc23510bfe94d803763e6f1c72d2a 192.168.31.33:7006@17006 slave 331628fcc89591eafd378d5c4bf15c67be4a60d7 0 1676509674133 3 connected
3b2010b088f81db2dbae5f674f133aeef293d2e8 192.168.31.33:7002@17002 master - 0 1676509673122 2 connected 5461-10922
06f1a071ffac504d14f6448fd08bc56a12ee4c2e 192.168.31.33:7001@17001 myself,master - 0 1676509674000 1 connected 0-5460
331628fcc89591eafd378d5c4bf15c67be4a60d7 192.168.31.33:7003@17003 master - 0 1676509675143 3 connected 10923-16383

 

 

查看集群信息:

 

127.0.0.1:7001> cluster info
cluster_state:ok
cluster_slots_assigned:16384
cluster_slots_ok:16384
cluster_slots_pfail:0
cluster_slots_fail:0
cluster_known_nodes:6
cluster_size:3
cluster_current_epoch:3
cluster_my_epoch:1
cluster_stats_messages_ping_sent:1924
cluster_stats_messages_pong_sent:1939
cluster_stats_messages_sent:3863
cluster_stats_messages_ping_received:1936
cluster_stats_messages_pong_received:1924
cluster_stats_messages_meet_received:3
cluster_stats_messages_received:3863
total_cluster_links_buffer_limit_exceeded:0

 

 

 

 

 

 

 

 

 

 

#################################

标签:node,31.33,redis,192.168,cluster,集群,master,slots,搭建
From: https://www.cnblogs.com/igoodful/p/17125481.html

相关文章

  • Kubeadm搭建K8S
    一、kubeadm部署K8S集群架构主机名IP地址安装组件master(2C/4G,cpu核心数要求大于2)192.168.160.20docker、kubeadm、kubelet、kubectl、flannelnode01(2C/2G......
  • 快速搭建一个网关服务,动态路由、鉴权,一网打尽!(含流程图)
    作者:热黄油啤酒链接:https://juejin.cn/post/7004756545741258765前言本文记录一下我是如何使用Gateway搭建网关服务及实现动态路由的,帮助大家学习如何快速搭建一个网......
  • lvs+keepalive 工作原理及搭建
    目录lvs+keepalive工作原理及搭建nginx应用场景keepalive介绍keepalived工作原理VRRP工作原理简述keepalive软件结构开始搭建环境准备工作:安装Nginx什么是高可用?解决的问......
  • 学习笔记Redis篇
    这篇仅仅为今日刷Redis课的一点小小总结,一点遗忘小细节罢了1.@Resource和@Autowire的区别CSDN地址:https://blog.csdn.net/u012102104/article/details/79481007二者都......
  • CICD流水线 Jenkins搭建 及构建后端SpringCloud项目
    一、CICD在CI/CD和DevOps领域中,持续交付和持续部署是一个老生常谈的话题。持续集成这个术语最早是在1994年由GradyBooch提出。微服务提出者MartinFlower在2014年发表的......
  • 使用Docker启动并运行Redis
    1.拉取redis镜像#拉取redis镜像dockerpullredis#查看镜像dockerimages2.Redis相关的配置创建挂载目录以及获取redis.conf配置文件1.创建挂载目录......
  • 在 Flask 中使用 Redis 来缓存数据
    (一)Redis简介Redis是一个高性能的key-value数据库,它是基于内存运行的数据库,因此有很高的性能,存取速度非常快,而且Redis还可以定期的将数据同步到磁盘中,实现数据的持......
  • hadoop集群配置
    进入hadoop的etc目录下找到配置文件cd /opt/module/hadoop-3.1.3/etc/hadoop   配置core-site.xml指定NameNode的地址指定hadoop数据的存储目录<configurati......
  • Flink On Yarn集群搭建
    一、环境准备:1.1jdk1.8、yarn集群环境 1.2下载Flink1.15.21.3解压到/opt/soft/1.4下载 flink-shaded-hadoop-2-uber-2.8.3-10.0.jar并放在/opt/soft/flink1.15......
  • 【保姆级】Python最新版3.11.1开发环境搭建,看这一篇就够了
    工欲善其事必先利其器,在使用Python开发程序之前,在计算机上搭建Python开发环境是必不可少的环节,目前Python最新稳定版本是3.11.1,且支持到2027年,如下图所示本文手把手带你......