Redis cluster creation and deployment documentation

Source: Internet
Author: User
Tags redis cluster install redis

Redis cluster creation and deployment documentation

Redis cluster creation and deployment documentation

1. Install dependencies (not always install so many dependencies. I have installed mysql and php in my environment, so I didn't need to test the dependencies. I have to install them all)
Yum-y install make apr * autoconf automake curl-devel gcc-c ++ zlib-devel openssl-devel pcre-devel gd kernel keyutils patch perl kernel-headers compat * mpfr cpp glibc libgomp libstdc ++-devel ppl cloog-ppl keyutils-libs-devel libcom_err-devel libsepol-devel libselinux-devel krb5-devel zlib-devel libXpm * freetype libstjpeg * libpng * php-common php-gd ncurses * libtool * libxml2 libxml2-devel patch freetype-devel cmake zlib ncurses * openssl * cmake gcc * autoconf bison libevent *

2. We have prepared redis nodes for cluster building. Next we will connect these nodes to build a cluster. Official offers a tool: redis-trib.rb (/usr/local/redis/src/redis-trib.rb) Look at the suffix to know that this bird cannot be executed directly, it is a program written in ruby, so we have to install ruby.
Yum-y install ruby-devel rubygems rpm-build

3. Unzip and install redis:
Tar-zxvf redis-3.0.6.tar
Mv redis-3.0.6 redis-3
Cd redis
Make & make install
Note:
The redis cluster must have at least three master nodes or three master nodes and three slave nodes (each folder corresponds to one port)
Mkdir-p/opt/redis/cluster/7000
Mkdir-p/opt/redis/cluster/7001
Mkdir-p/opt/redis/cluster/7002
Mkdir-p/opt/redis/cluster/7003
Mkdir-p/opt/redis/cluster/7004
Mkdir-p/opt/redis/cluster/7005
Cp/opt/soft/redis. conf/opt/redis/cluster/7000
Vi/opt/redis/cluster/7000/redis. conf
Modify the following items:
Daemonize yes // redis running in the background
Pidfile/var/run/redis_7000.pid // pidfile corresponds to 7000
Port 7000 // port 7000
Cluster-enabled yes // enable the cluster to remove the comment #
Cluster-config-file nodes. conf // automatically generated when the configuration file of the cluster is started for the first time
Cluster-node-timeout 5000 // The request timeout value is set to 5 seconds.
Appendonly yes // aof log is enabled as needed. It records a log for each write operation.
After the configuration is complete, copy the modified configuration file to the 7001 7002 directory. Be sure to modify the listening port and pidfile.

4. Start redis in each folder
Redis-server redis. conf

5. Create a cluster
We have prepared the redis nodes for building the cluster. Next we will connect these nodes to build the cluster. Official offers a tool: redis-trib.rb (/usr/local/redis/src/redis-trib.rb) Look at the suffix to know that this bird cannot be executed directly, it is a program written in ruby, so we have to install ruby.
Yum-y install ruby-devel rubygems rpm-build // I don't know how powerful it is on the Internet. I just installed it like this. Let's play with it.
Using the gem command to install the redis interface gem seems to be a ruby toolkit.
Gem install redis // wait a moment.

6. confirm that all nodes are started, and then create with the create Parameter
/Opt/soft/redis/src/redis-trib.rb create -- replicas 1 127.0.0.1: 7000 127.0.0.1: 7001 127.0.0.1: 7002 127.0.0.1: 7003 127.0.0.1: 7004 127.0.0.1: 7005 127.0.0.1:

-- Replicas 1 indicates that each master node is automatically allocated with six nodes on the slave node. The program will generate three master nodes and three slave nodes according to certain rules)
The firewall that has been warned earlier must open the listening port; otherwise, the creation will fail.
The redis cluster has been installed.

You may also like the following articles about Redis. For details, refer:

Install and test Redis in Ubuntu 14.04

Basic configuration of Redis master-slave Replication

Redis cluster details

Install Redis in Ubuntu 12.10 (graphic explanation) + Jedis to connect to Redis

Redis series-installation, deployment, and maintenance

Install Redis in CentOS 6.3

Learning notes on Redis installation and deployment

Redis. conf

Redis details: click here
Redis: click here

This article permanently updates the link address:

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.