REDIS3 Cluster Construction

Source: Internet
Author: User

installationRuby
    1. 1) sudo apt-get install ruby

    2. 2) sudo apt-get install ruby-full rubygems

    3. 3) sudo gem install Redis ( This command takes longer to wait )

Create a node folder
    1. 1. cd/usr/local/

    2. 2. sudo mkdir cluster

    3. 3. sudo mkdir 7000 7001 7002 7003 7004 7005

Modifying a configuration fileRedis.conf
  1. 1. cd/deploy/redis-3.0.0/-------------Redis installation Folder

  2. 2. sudo cp redis.conf/usr/local/cluster/

  3. 3. Cd/usr/local/cluster

  4. 4. sudo vim redis.conf

  5. 5. Modify the following items:

  6. a) Port 7000

  7. b) cluster-enabled Yes

  8. c) cluster-config-file nodes.conf

  9. d) cluster-node-timeout

  10. e) appendonly Yes

CopyRedis.confto the Node folder
  1. 1. sudo cp redis.conf 7000

  2. 2. sudo cp redis.conf 7001

  3. 3. sudo cp redis.conf 7002

  4. 4. sudo cp redis.conf 7003

  5. 5. sudo cp redis.conf 7004

  6. 6. sudo cp redis.conf 7005

  7. 7. Modify the ports in the configuration file under each node folder to correspond to folders

Start each node, be sure to go to each node folder to start
  1. 1. CD 7000

  2. 2. sudo redis-server redis.conf

  3. 3. CD.. /7001

  4. 4. sudo redis-server redis.conf

  5. 5. CD.. /7002

  6. 6. sudo redis-server redis.conf

  7. 7. CD.. /7003

  8. 8. sudo redis-server redis.conf

  9. 9. CD.. /7004

  10. Ten. sudo redis-server redis.conf

  11. One . CD. /7005

  12. sudo redis-server redis.conf

Build a cluster
    1. 1. cd/deploy/redis-3.0.0/src

    2. 2. ./REDIS-TRIB.RB Create--replicas 1 192.168.1.149:7000 192.168.1.149:7001 192.168.1.149:7002 192.168.1.149:7003 192.168.1.149:7004 192.168.1.149:7005

Add116one of the nodes
  1. 1. Create the one of the nodes Port 7000

  2. 2. cd/deploy/redis-3.0.0/src

  3. 3. ./redis-trib.rb add-node 192.168.1.116:7000 192.168.1.149:7000--------------- will be the the node is added to the 149 on the cluster

Test
  1. 1. Login Redis

  2. a) redis-cli–c–p 7000–h 192.168.1.149

  3. 2. Add Data

  4. a) set Key1 val1

  5. 3. Get Data

  6. a) get Key1

  7. 4. Exit

  8. a) quit

  9. 5. log in to other nodes, such as 192.168.1.116:700

  10. 6. Get Key1 data to see if it is correct

Note the point:
  1. 1. building a cluster at least 6 a node: 3 Master node, 3 a Slave node

  2. 2. This machine IP : 192.168.1.149

  3. 3. To View all nodes:

  4. a) redis-cli-p 7000-h 192.168.1.116 cluster nodes\


REDIS3 Cluster Construction

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.