Redis 3.0.2 Cluster construction

Source: Internet
Author: User
Tags redis cluster

First, the environment

Ubuntu 14.04 LTS, Redis 3.0.2

Second, Redis cluster construction (single-machine test)

1, the installation of Redis

wget http://download.redis.io/releases/redis-3.0.2.tar.gztar zxvf redis-  3.0. 2. Tar . GZCD Redis-3.0. 2/make makeinstall

2. Install Ruby

sudo Install Ruby sudo Install Redis  #ruby的redis驱动

3, in the single-machine test, we use Redis-server to start a number of files can be, I am using 6 ports, in the Redis cluster is three main, three from ....  At that time can also be in accordance with their own situation to set up master and slave ....  It is important to note that the redis.conf to develop the cluster option. I have simply written a script that modifies redis.conf in bulk.

 forIinch`seq-W 0 5`; Do    CPRedis.conf the$i. confsed-I."s/6379/700$i/g"  the$i. confsed-I.'s/daemonize no/daemonize yes/g'  the$i. confsed-I.'s/# cluster-enabled yes/cluster-enabled yes/g'  the$i. confsed-I.'s/# cluster-node-timeout 15000/cluster-node-timeout 15000/g'  the$i. confsed-I."s/# cluster-config-file nodes-700*/cluster-config-file nodes-700$i.conf/g"  the$i. conf Redis-server the$i. conf Done

4. Detection process

[Email protected]:/etc/redis$PSAux |grepRedisroot8913  0.1  1.0  38508 10948? SslTen: -   0: GenevaRedis-server *:7000[Cluster]root8923  0.1  1.0  38508 10972? SslTen: -   0: GenevaRedis-server *:7001[Cluster]root8933  0.1  1.0  38508 11016? SslTen: -   0: GenevaRedis-server *:7002[Cluster]root8943  0.1  0.8  38508  8868? SslTen: -   0: GenevaRedis-server *:7003[Cluster]root8953  0.1  0.9  38508  9196? SslTen: -   0: GenevaRedis-server *:7004[Cluster]root8963  0.1  0.8  38508  8972? SslTen: -   0: GenevaRedis-server *:7005[Cluster]

5, use REDIS-TRIB.RB to create Redis cluster cluster, the following is a successful prompt.

[Email protected]:/tmp/soft/redis-3.0.2/src#./REDIS-TRIB.RB Create--replicas1 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005>>>Creating clusterconnecting to Node127.0.0.1:7000: okconnecting to Node127.0.0.1:7001: okconnecting to Node127.0.0.1:7002: okconnecting to Node127.0.0.1:7003: okconnecting to Node127.0.0.1:7004: okconnecting to Node127.0.0.1:7005: OK>>> performing hash slots allocation on6nodes ... Using3Masters:127.0.0.1:7000127.0.0.1:7001127.0.0.1:7002Adding Replica127.0.0.1:7003To127.0.0.1:7000Adding Replica127.0.0.1:7004To127.0.0.1:7001Adding Replica127.0.0.1:7005To127.0.0.1:7002m:d3784c3de3546438f2661716fead057836c23339127.0.0.1:7000Slots:0-5460(5461slots) masterm:c0c222727190c4199025b4b93a23efc0f616923c127.0.0.1:7001Slots:5461-10922(5462slots) Masterm:fa23538ba7566bdc3694629978fc370c9f3610e7127.0.0.1:7002Slots:10923-16383(5461slots) Masters:5f619a08a6302431909a54938b4f1d92538ea1a7127.0.0.1:7003replicates D3784c3de3546438f2661716fead057836c23339s:8203207d38d5a073dbd1cb339ea6e07f218579f4127.0.0.1:7004replicates c0c222727190c4199025b4b93a23efc0f616923cs:7b623f983f578f0bdda7d994a34c879f799aaf75127.0.0.1:7005replicates Fa23538ba7566bdc3694629978fc370c9f3610e7can 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 toJoinThe clusterwaiting forThe cluster toJoin.....>>> performing Cluster Check (using node127.0.0.1:7000) m:d3784c3de3546438f2661716fead057836c23339127.0.0.1:7000Slots:0-5460(5461slots) masterm:c0c222727190c4199025b4b93a23efc0f616923c127.0.0.1:7001Slots:5461-10922(5462slots) Masterm:fa23538ba7566bdc3694629978fc370c9f3610e7127.0.0.1:7002Slots:10923-16383(5461slots) Masterm:5f619a08a6302431909a54938b4f1d92538ea1a7127.0.0.1:7003Slots: (0slots) Master replicates D3784C3DE3546438F2661716FEAD057836C23339M:8203207D38D5A073DBD1CB339EA6E07F218579F4 /c11>127.0.0.1:7004Slots: (0slots) Master replicates c0c222727190c4199025b4b93a23efc0f616923cm:7b623f983f578f0bdda7d994a34c879f799aaf75 127.0.0.1:7005Slots: (0slots) Master replicates Fa23538ba7566bdc3694629978fc370c9f3610e7[ok] All nodes agree about slots configuration.
     >>> Check forOpen Slots ...>>>Check Slots Coverage ... [OK] All16384Slots covered.

6. Turn on cluster mode

[Email protected]:/tmp/soft/redis-3.0. 2 7001 127.0. 0.1

Redis 3.0.2 Cluster construction

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.