redis集群搭建

数量大致均等的将哈希槽映射到不同的节点。

接下来我们将redis安装到   redis01中,然后make编译一下,会发现在src文件中出现:

redis-trib.rb拷贝到redis-cluster目录下。

 

 

 

> ./redis-trib.rbcreate --replicas .: .: .: .:.: .:/span>

>>>> Creating cluster

>Connecting to node .:: OK

>Connecting to node .:: OK

>Connecting to node .:: OK

>Connecting to node .:: OK

>Connecting to node .:: OK

>Connecting to node .:: OK

>>>> Performing hash slotsallocation on nodes...

>Using masters:

>.:

>.:

>.:

>Adding replica .: to .:

>Adding replica .: to .:

>Adding replica .: to .:

>M: 5a8523db7e12ca600dc82901ced06741b3010076127..:

> slots:- ( slots) master

>M: bf6f0929044db485dea9b565bb51e0c917d20a53127..:

> slots:- ( slots) master

>M: c5e334dc4a53f655cb98fa3c3bdef8a808a693ca127..:

> slots:- ( slots) master

>S: 2a61b87b49e5b1c84092918fa2467dd70fec115f127..:

> replicates 5a8523db7e12ca600dc82901ced06741b3010076

>S: 14848b8c813766387cfd77229bd2d1ffd6ac8d65127..:

> replicates bf6f0929044db485dea9b565bb51e0c917d20a53

>S: 3192cbe437fe67bbde9062f59d5a77dabcd0d632127..:

> replicates c5e334dc4a53f655cb98fa3c3bdef8a808a693ca

>Can I the above configuration? (type to accept): >yes

>>>> Nodes configuration updated

>>>> Assign a different configepoch to each node

>>>> Sending CLUSTER MEET messagesto join the cluster

>Waiting the cluster to join.....

>>>> Performing Cluster Check( node .:)

>M: 5a8523db7e12ca600dc82901ced06741b3010076127..:

> slots:- ( slots) master

>M: bf6f0929044db485dea9b565bb51e0c917d20a53127..:

> slots:- ( slots) master

>M: c5e334dc4a53f655cb98fa3c3bdef8a808a693ca127..:

> slots:- ( slots) master

>M: 2a61b87b49e5b1c84092918fa2467dd70fec115f127..:

> slots: ( slots) master

> replicates 5a8523db7e12ca600dc82901ced06741b3010076

>M: 14848b8c813766387cfd77229bd2d1ffd6ac8d65127..:

> slots: ( slots) master

> replicates bf6f0929044db485dea9b565bb51e0c917d20a53

>M: 3192cbe437fe67bbde9062f59d5a77dabcd0d632127..:

> slots: ( slots) master

> replicates c5e334dc4a53f655cb98fa3c3bdef8a808a693ca

>[OK] All nodes agree about slotsconfiguration.

>>>> Check open slots...

>>>> Check slots coverage...

>[OK] All slots covered.

 

跳转,这就是因为他经过计算以后,要存储100的hash槽在7003 实例上。这样就表示我们的集群成功了!

关闭redis集群不能直接kill掉进程,或者关机,我们要通过命令redis01/redis-cli -p 7001 shutdown进行关闭,这样在关闭之前,数据才能够进行保存。

 

相关文章

一,安装: 1.1.将redis压缩包放到 /opt 下。 2.解压 3.进入目录执行 make 4.执行 make install 5.在 /...
1.我们使用缓存时的业务流程大概为: 当我们查询一条数据时,先去查询缓存,如果缓存有就直接返回,如果...
1、redis主从 1.1、redis主从复制过程 - Slave 与 master 建立连接,发送 sync 同步命令 - Master 会启...
1、集群的概念 集群是一组相互独立的、通过高速网络互联的计算机,它们构成了一个组,并以单一系统的模...
1、什么是 NoSQL? NoSQL(NoSQL = Not Only SQL ),意为反 SQL 运动,是一项全新的数据库革命性运动,2...
Redis 是一个支持持久化的内存数据库,也就是说需要经常将内存中的数据同步到硬盘来保证持久化。 1、RD...