分享更有价值
被信任是一种快乐

Redis cluster集群需要至少多少个redis节点

文章页正文上

这篇文章主要介绍“Redis cluster集群需要至少多少个redis节点”,在日常操作中,相信很多人在Redis cluster集群需要至少多少个redis节点问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”Redis cluster集群需要至少多少个redis节点”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!##配置redis集群需要至少6个redis节点集群至少3主3从才可以搭建,防止错乱我们在redis 下建立一个文件夹cluster,里面复制6份配置文件,改名为redis1-redis6.conf把每个配置文件都修改以下共同点:bind 10.233.19.36 (根据实际情况配置)port 7001 (7001-7006)daemonize yes(以守护进程运行)pidfile /var/run/redis.pid (守护进程生成的文件,以实际情况配置)appendonly yes (开启AOF日志记录Redis操作的持久化)appendfilename “appendonly-7001.aof” (AOF文件名,配置端口为文件名便于查看)cluster-enabled yes (开启集群)cluster-config-file nodes-7001.conf (节点信息,已节点命名便于查看)cluster-node-timeout 15000 (节点响应超时时间)以上为共同点每个节点不论主从都需要配置。此外还需要注意,不要再为各个节点主动配置主从关系,否则启动时会报错。因为主从关系要给redis集群自己调节。##启动redis集群上面的配置完成之后,分别启动6个redis实例。配置正确的情况下,都可以启动成功。然后运行如下命令创建集群:注意,这里使用的是ip:port replicas1 表示我们希望为集群中的每个主节点创建一个从节点因为配置文件中设置了密码所以创建集群也需要加密码参数 -a[ERR] Node 10.233.19.36:6380 NOAUTH Authen免费主机域名tication required.[redis@weblogic-test bin]$ ./redis-cli –cluster create 10.233.19.36:6380 10.233.19.36:6381 10.233.19.36:6382 10.233.19.36:6383 10.233.19.36:6384 10.233.19.36:6385 –cluster-replicas 1 -a beijingWarning: Using a password with ‘-a’ or ‘-u’ option on the command line interface may not be safe.>>> Performing hash slots allocation on 6 nodes…Master[0] -> Slots 0 – 5460Master[1] -> Slots 5461 – 10922Master[2] -> Slots 10923 – 16383Adding replica 10.233.19.36:6383 to 10.233.19.36:6380Adding replica 10.233.19.36:6384 to 10.233.19.36:6381Adding replica 10.233.19.36:6385 to 10.233.19.36:6382>>> Trying to optimize slaves allocation for anti-affinity[WARNING] Some slaves are in the same host as their masterM: 369151e4f1bed1e3fcaf474025853bc72056542e 10.233.19.36:6380 slots:[0-5460] (5461 slots) masterM: 1f9314f13a22c2c68c609e98247bfe6d0714c75b 10.233.19.36:6381 slots:[5461-10922] (5462 slots) masterM: 41840a493fceef875b1a521d951090f9c99c7040 10.233.19.36:6382 slots:[10923-16383] (5461 slots) masterS: 438c5ecaf7501da25bfc0d2055445c036907ba61 10.233.19.36:6383 replicates 1f9314f13a22c2c68c609e98247bfe6d0714c75bS: 9598769e90155aeb130a33980ac1a1c27b1609cc 10.233.19.36:6384 replicates 41840a493fceef875b1a521d951090f9c99c7040S: b0d325e936ee5055648561302560d055d0bdb365 10.233.19.36:6385 replicates 369151e4f1bed1e3fcaf474025853bc72056542eCan I set the above configuration? (type ‘yes’ to accept): yes>>> Nodes configuration updated>>> Assign a different config epoch to each node>>> Sending CLUSTER MEET messages to join the clusterWaiting for the cluster to join..>>> Performing Cluster Check (using node 10.233.19.36:6380)M: 369151e4f1bed1e3fcaf474025853bc72056542e 10.233.19.36:6380 slots:[0-5460] (5461 slots) master 1 additional replica(s)M: 1f9314f13a22c2c68c609e98247bfe6d0714c75b 10.233.19.36:6381 slots:[5461-10922] (5462 slots) master 1 additional replica(s)S: 9598769e90155aeb130a33980ac1a1c27b1609cc 10.233.19.36:6384 slots: (0 slots) slave replicates 41840a493fceef875b1a521d951090f9c99c7040M: 41840a493fceef875b1a521d951090f9c99c7040 10.233.19.36:6382 slots:[10923-16383] (5461 slots) master 1 additional replica(s)S: b0d325e936ee5055648561302560d055d0bdb365 10.233.19.36:6385 slots: (0 slots) slave replicates 369151e4f1bed1e3fcaf474025853bc72056542eS: 438c5ecaf7501da25bfc0d2055445c036907ba61 10.233.19.36:6383 slots: (0 slots) slave replica免费主机域名tes 1f9314f13a22c2c68c609e98247bfe6d0714c75b[OK] All nodes agree about slots configuration.>>> Check for open slots…>>> Check slots coverage…[OK] All 16384 slots covered.执行成功之后,连接一台redis,执行 cluster info 会看到类似如下信息:127.0.0.1:6380> cluster infocluster_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_ping_sent:190cluster_stats_messages_pong_sent:181cluster_stats_messages_sent:371cluster_stats_messages_ping_received:176cluster_stats_messages_pong_received:190cluster_stats_messages_meet_received:5cluster_stats_messages_received:371我们可以看到cluster_state:ok,cluster_slots_ok:16384,cluster_size:3。到此,关于“Redis cluster集群需要至少多少个redis节点”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注云技术网站,小编会继续努力为大家带来更多实用的文章!

相关推荐: 怎么解决windows下oracle监听故障

这篇文章主要讲解了“怎么解决windows下oracle监听故障”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“怎么解决windows下oracle监听故障”吧!现象:数据库服务及监听运行正常,但打开功能模块非常…

文章页内容下
赞(0) 打赏
版权声明:本站采用知识共享、学习交流,不允许用于商业用途;文章由发布者自行承担一切责任,与本站无关。
文章页正文下
文章页评论上

云服务器、web空间可免费试用

宝塔面板主机、支持php,mysql等,SSL部署;安全高速企业专供99.999%稳定,另有高防主机、不限制内容等类型,具体可咨询QQ:360163164,Tel同微信:18905205712

主机选购导航云服务器试用

登录

找回密码

注册