Redis-cluster Research and use (turn)

Source: Internet
Author: User
Tags redis cluster install redis
Redis-cluster Research and use Blog Categories:Redis Redis Cluster Distributed storage Recent research Redis-cluster, just set up an environment, encountered a lot of pits, the system's summary, wait until REDIS3 release, replace Memcache cluster. Reprint please specify the source Kazakhstan: http://hot66hot.iteye.com/admin/blogs/2050676 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 latest version of the current see: https:// Raw.githubusercontent.com/antirez/redis/3.0/00-releasenotes

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

Current Redis supported cluster features (tested):

1): Automatic node discovery

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

3): Hot resharding: Online slicing

4): Cluster 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 architecture diagram

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 physical nodes to [0-16383]slot, cluster responsible for maintaining Node<->slot<->value 2) redis-cluster election: Fault tolerance

(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 is the entire cluster unavailable (Cluster_state:fail)?

A: If the cluster any master hangs, and the current master is not slave. The cluster enters the fail state, and it can be understood that the slot mapping of the cluster [0-16383] enters the fail state when it is not completed. Ps:redis-3.0.0.rc1 joins the Cluster-require-full-coverage parameter, closes by default, and fails to open the Cluster compatibility section.

B: If the cluster more than half of master hangs out, whether or not a slave cluster enters the fail state.

PS: When the cluster is not available, all operations to the cluster are not available, received ((error) Clusterdown the cluster is down) error two: Redis cluster use 1: Install Redis cluste R

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(2) 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(3) 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(4) 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(5) Installation Redis-clusterJava 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   #每秒一次aof写    appendfsync everysec   The new write operation when the  rewrite is #关闭在aof 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 

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.