Practice of Redis cluster in Linux environment

Source: Internet
Author: User
Tags redis version redis cluster install redis

Environment: CentOS 7

First, compile and install Redis source code

Source Address: Redis version release list

CD Redis-3.2.8sudo make && make install

After the compilation and installation is successful, copy the Redis-trib.rb file from the source to the/usr/local/bin/directory

sudo cp./redis-trib.rb/usr/local/bin/
Second, create the node

Create a Redis-cluster folder and create a total of 7000-7005 6 folders

Copy the redis.conf file in the source code and modify the following contents into 7000-7005 folders respectively

Bind 192.168.1.105port 7000cluster-enabled yescluster-config-file/home/jabben/redis-cluster/7000/nodes-7000.conf
Pidfile/home/jabben/redis-cluster/7000/redis_7000.pidcluster-node-timeout 5000daemonize Yes

Start 6 Redis nodes separately:

Redis-server 7000/redis.confredis-server 7001/redis.confredis-server 7002/redis.confredis-server 7003/ Redis.confredis-server 7004/redis.confredis-server 7005/redis.conf

To see if the Redis process has started:

Ps-ef | grep Redis

Third, create the cluster

Copy the redis-trib.rb file to the bin directory

cd/home/jabben/redis-cluster/source/redis-3.2. 8/srcsudo CP Redis-trib.rb/usr/local/bin/

Installing the ruby Environment

Yum Install Ruby

Installing the RubyGems Component

Yum Install RubyGems

Installing Gem-redis

Gem Install Redis

Create a cluster

1 192.168. 1.105:7000192.168. 1.105:7001192.168. 1.105:7002192.168. 1.105:7003192.168. 1.105:7004192.168. 1.105:7005
>>>Creating Cluster>>> performing hash slots allocation on6nodes ... Using3Masters:192.168.1.105:7000192.168.1.105:7001192.168.1.105:7002Adding Replica192.168.1.105:7003To192.168.1.105:7000Adding Replica192.168.1.105:7004To192.168.1.105:7001Adding Replica192.168.1.105:7005To192.168.1.105:7002M:339AAFEDD6BD7F6BD5CD98407F7EBE8CB0C4EFBD192.168.1.105:7000Slots:0-5460(5461slots) Masterm:7bd0b20971d5fc929f8454c6ff388f780cc70e77192.168.1.105:7001Slots:5461-10922(5462slots) masterm:aaa4b5109c5bcf1aa868621f59b51fb4d6feef9c192.168.1.105:7002Slots:10923-16383(5461slots) Masters:e731c1918fad61f972fbca4ab6523da1d9f827af192.168.1.105:7003replicates 339aafedd6bd7f6bd5cd98407f7ebe8cb0c4efbds:c16b520a5075b0fee0840cc26cf1f7f27bad8e45192.168.1.105:7004replicates 7BD0B20971D5FC929F8454C6FF388F780CC70E77S:990A4E7A2831D8D9BA8F9835557BE6A394D393A4192.168.1.105:7005replicates Aaa4b5109c5bcf1aa868621f59b51fb4d6feef9ccan ISetThe 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 forThe cluster to join ...>>> Performing Cluster Check (usingNode192.168.1.105:7000) M:339AAFEDD6BD7F6BD5CD98407F7EBE8CB0C4EFBD192.168.1.105:7000Slots:0-5460(5461slots) Master1additional replica (s) s:990a4e7a2831d8d9ba8f9835557be6a394d393a4192.168.1.105:7005Slots: (0slots) Slave replicates AAA4B5109C5BCF1AA868621F59B51FB4D6FEEF9CS:E731C1918FAD61F972FBCA4AB6523DA1D9F827AF 192.168.1.105:7003Slots: (0slots) Slave replicates 339aafedd6bd7f6bd5cd98407f7ebe8cb0c4efbdm:aaa4b5109c5bcf1aa868621f59b51fb4d6feef9c 192.168.1.105:7002Slots:10923-16383(5461slots) Master1additional replica (s) s:c16b520a5075b0fee0840cc26cf1f7f27bad8e45192.168.1.105:7004Slots: (0slots) Slave replicates 7bd0b20971d5fc929f8454c6ff388f780cc70e77m:7bd0b20971d5fc929f8454c6ff388f780cc70e77 192.168.1.105:7001Slots:5461-10922(5462slots) Master1additional replica (s) [OK] All nodes agree about slots configuration.>>> Check forOpen Slots ...>>>Check Slots Coverage ... [OK] All16384Slots covered.

The cluster is now complete.

Practice of Redis cluster in Linux environment

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.