Cluster Deployment for Redis 3.0

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

Article reproduced from: http://hot66hot.iteye.com/blog/2050676

Reprint Please indicate the source: http://hot66hot.iteye.com/admin/blogs/2050676

Recently studied Redis-cluster, just built an environment, encountered a lot of pits, the system's summary, wait until REDIS3 release, replace Memcache cluster. one: About Redis cluster the present situation of 1:redis cluster

Reids-cluster plans to launch in redis3.0, can be regarded as a Antirez statement: HTTP://ANTIREZ.COM/NEWS/49 (PS: Skip the ticket for a long time, this year seems to speed up), the current version of the latest is Redis3 Beta2 (2.9.51).

Author's goal: Redis Cluster would support up to ~1000 nodes. Praise...

Current Redis supported cluster characteristics (have been tested):

1): Automatic node discovery

2): Slave->master election, cluster fault-tolerant

3): Hot resharding: Online slicing

4): Into the group management: Cluster XXX

5): Cluster management based on configuration (nodes-port.conf)

6): Ask to turn/moved steering mechanism. 2:redis Cluster Architecture

1) Redis-cluster Frame composition

Schema details:

(1) All Redis nodes are interconnected (ping-pong mechanisms), and internal binary protocols are used to optimize transmission speed and bandwidth.

(2) The fail of a node is not effective until more than half of the nodes in the cluster detect failure.

(3) The client is directly connected with the Redis node and does not need the intermediate proxy layer. The client does not need to connect all nodes of the cluster to connect any of the available nodes in the cluster

(4) Redis-cluster maps all the physical nodes to [0-16383]slot, cluster responsible for maintaining Node<->slot<->value

2) Redis-cluster elections: fault-tolerant

(1) The election process is the participation of all master in the cluster, if more than half of the master node communicates with the master node (cluster-node-timeout), the current master node is considered dead.

(2): When the entire cluster is not available (Cluster_state:fail), when the cluster is not available, all operations to the cluster are not available, received ((error) Clusterdown the cluster is down) error

A: If the cluster any master hangs, and the current master has no slave. The cluster enters the fail state, and it can also be understood that the slot mapping of the group [0-16383] enters the fail state when it is not completed.

B: If more than half of the incoming group master hangs out, whether or not a slave cluster enters the fail state. Second: The use of Redis cluster 1: Install Redis cluster

1): Install Redis-cluster dependency: Redis-cluster's dependent libraries have compatibility issues when they are in use, and when reshard encounter various errors, install them in the specified version.

(1) Ensure system installation zlib, otherwise gem install will report (no such file to load-zlib)

Java code #download: Zlib-1.2.6.tar./configure make make Install

(1) Installation ruby:version (1.9.2)

Java code # ruby1.9.2 Cd/path/ruby./configure-prefix=/usr/local/ruby make to install sudo cp Ruby/usr/loca L/bin

(2) Installation Rubygem:version (1.8.16)

Java code # rubygems-1.8.16.tgz cd/path/gem sudo ruby setup.rb sudo cp bin/gem/usr/local/bin

(3) Installation Gem-redis:version (3.0.0)

Java Code gem install Redis--version 3.0.0 #由于源的原因, may download failed, download it manually to install #download地址: http://rubygems.org/gems/redis/version s/3.0.0 Gem Install-l/data/soft/redis-3.0.0.gem

2) Installation Redis-cluster

Java code cd/path/redis make sudo cp/opt/redis/src/redis-server/usr/local/bin sudo cp/opt/redis/src/redis-cli/us R/local/bin sudo cp/opt/redis/src/redis-trib.rb/usr/local/bin

2: Configure Redis Cluster

1) Redis configuration file structure:


Use include (include) to separate common configuration and special configuration for easy maintenance.

2) Redis general configuration.

  Java code    #GENERAL    daemonize no   tcp-backlog 511   timeout 0   tcp-keepalive 0   loglevel notice   databases 16    dir /opt/redis/data   slave-serve-stale-data yes   #slave只读     slave-read-only yes   #not  use default   repl-disable-tcp-nodelay  yes   slave-priority 100   #打开aof持久化    appendonly yes   # Write a new write operation once per second aof    appendfsync everysec   #关闭在aof  rewrite fsync   no-appendfsync-on-rewrite yes   auto-aof-rewrite-min-size 64mb   Lua-time-limit  5000   #打开redis集群    cluster-enabled yes   #节点互连超时的阀值    cluster-node-timeout 15000   cluster-migration-barrier 1   Slowlog-log-slower-than  10000   slowlog-max-len 128

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.