Redis3.0 cluster Deployment (CentOS system)

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

(To make the cluster work at least 3 primary nodes, here we will create 6 Redis nodes, of which three are the primary node, three are slave nodes, the corresponding Redis node's IP and port correspondence is as follows) 192.168.1.160:7000
192.168.1.160:7001192.168.1.160:7002192.168.1.160:7003192.168.1.160:7004192.168.1.160:7005 1: Download Redis. Download 3.0.0 version, previous 2. Several versions do not support cluster mode: HTTP://DOWNLOAD.REDIS.IO/RELEASES/REDIS-3.0.0.TAR.GZ2: Upload Server, unzip, compile
TAR-ZXVF redis-3.0.0.tar.gz mv redis-3.0.0.tar.gz redis3.0 cd/usr/local/redis3.0 make make install
3: Create the directory required by the cluster
Mkdir-p/usr/local/cluster cd/usr/local/cluster mkdir 7000 mkdir 7001 mkdir 7002 mkdir 7003 mkdir 7004 mkdir 7005
4: Modify configuration file redis.conf
  cp/usr/local/redis3.0/redis.conf  /usr.local/cluster  vi redis.conf   # #修改配置文件中的下面选项   port 7000  daemonize yes  cluster-enabled yes   Cluster-config-file nodes.conf  cluster-node-timeout 5000  appendonly yes  ## After modifying these configuration items in the redis.conf configuration file, copy the configuration file to the 7000/7001/7002/7003/7004/7005 directory, respectively   cp/usr/local/cluster/ Redis.conf  /usr/local/cluster/7000  cp/usr/local/cluster/redis.conf  /usr/local /cluster/7001  cp/usr/local/cluster/redis.conf  /usr/local/cluster/7002  cp/usr/ local/cluster/redis.conf  /usr/local/cluster/7003  cp/usr/local/cluster/redis.conf   /usr/local/cluster/7004  cp/usr/local/cluster/redis.conf  /usr/local/cluster/7005      # #注意: To modify the port parameter in the redis.conf file under the 7001/7002/7003/7004/7005 directory after the copy is complete, change the name of the corresponding folder respectively     &nbSp
5: Start each of these 6 Redis instances separately
cd/usr/local/cluster/7000 redis-server redis.conf cd/usr/local/cluster/7001 redis-server redis.conf cd/usr/local/cl uster/7002 redis-server redis.conf cd/usr/local/cluster/7003 redis-server redis.conf cd/usr/local/cluster/7004 Redi S-server redis.conf cd/usr/local/cluster/7005 redis-server redis.conf # #启动之后使用命令查看redis的启动情况ps-ef|grep Redis The display indicates a successful start
6: Execute redis Create cluster command to create cluster
Cd/usr/local/redis3.0/src./REDIS-TRIB.RB Create--replicas 1 192.168.1.160:7000 192.168.1.160:7001 192.168.1.160:700 2 192.168.1.160:7003 192.168.1.160:7004 192.168.1.160:7005
6.1 You may get an error when executing the above command, because it is a ruby script that requires Ruby environment error content:/usr/bin/env:ruby:no such file or directory so you need to install Ruby's environment, it is recommended to use Yum Install Ruby Installation
Yum Install Ruby
6.2 Then perform the 6th step of the Create Cluster command, may also error, hint missing RubyGems component, use Yum install error content:./redis-trib.rb:24:in ' require ': no suchfile to load--rubygems (Loaderror) from./redis-trib.rb:24
Yum Install RubyGems
6.3 Execute the 6th step of the command again, may also error, prompted not to load Redis, because of the lack of Redis and Ruby interface, using GEM installation error content:/usr/lib/ruby/site_ruby/1.8/rubygems/custom_ Require.rb:31:in ' Gem_original_require ': No such file to load-Redis (loaderror) from/usr/lib/ruby/site_ruby/1.8/ru Bygems/custom_require.rb:31:in ' Require ' from./redis-trib.rb:25
Gem Install Redis
6.4 Perform the 6th step command again, perform the normal input yes, and then configure the completion. This is where the Redis cluster is built successfully! 7: Use the REDIS-CLI command to enter the cluster environment

Redis-cli-c-P 7000 More highlights: http://bbs.superwu.cn Focus on the two-dimensional code of Superman Academy:

Redis3.0 cluster Deployment (CentOS system)

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.