CentOS7.1 configure a redis Cluster

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

CentOS7.1 configure a redis Cluster

Download the centos7.1

Http://www.centoscn.com/CentosSoft/iso/2015/0402/5070.html

Thunder: // timeout 1pa

1. Install the latest reids version ~

[Html] view plaincopy
  1. Wgethttp: // download. redis. io/releases/redis-3.2.8.tar.gz
  2. Tarxzfredis-3.2.8.tar.gz
  3. Cdredis-3.2.8
  4. Make

For single-node redis, it can be started directly after installation.

2. Install the ruby package

[Html] view plaincopy
  1. Yum-yinstallruby

3. Install the rubygams package

[Html] view plaincopy
  1. Https://rubygems.org/pages/download
  2. Tar-zxvfrubygems-2.2.2.tar
  3. Cdrubygems-2.2.2
  4. Rubysetup. rb

4. As expected, the following error occurs: 'require ': cannot load such file -- json/pure

Install json_pure

[Html] view plaincopy
  1. Geminstalljson_pure

5. Install redis (repeated installation)

[Html] view plaincopy
  1. Geminstallredis

6. Create Multiple folders 7000-7005

Copy redis. conf to various directories

Cp redis. conf 7000

.....

Cp redis. conf 7005

7. modify the content of the redis. conf configuration file

[Html] view plaincopy
  1. Port7000 // port 7003
  2. Bind local ip // The default ip address is 127.0.0.1, which needs to be changed to the ip address accessible to machines on other nodes. Otherwise, the corresponding port cannot be accessed during cluster creation and the cluster cannot be created.
  3. Daemonizeyes // run in redis background
  4. Pidfile/var/run/redis_7000.pid // pidfile corresponds to 7002
  5. Cluster-enabledyes // enable the cluster to remove the comment #
  6. Cluster-config-filenodes_7000.conf // cluster configuration profile automatically generated 7002
  7. Cluster-node-timeout15000 // request timeout default 15 seconds, configurable
  8. Appendonlyyes // aof log is enabled as needed. It records a log for each write operation.

Replace text content in linux

: G/str1/s // str2/g

7. Start each node

Redis-server 7000/redis. conf

... 7001

... 7005

8. Create a cluster

[Html] view plaincopy
  1. ./Redis-trib.rbcreate -- replicas1127.0.0.1: 7000127.0.0.1: 7001127.0.0.1: 7002127.0.0.1: 7003127.0.0.1: 7004127.0.0.1: 7005
  2. >>> Creatingcluster
  3. Connectingtonode127.0.0.1: 7000: OK
  4. Connectingtonode127.0.0.1: 7001: OK
  5. Connectingtonode127.0.0.1: 7002: OK
  6. Connectingtonode127.0.0.1: 7003: OK
  7. Connectingtonode127.0.0.1: 7004: OK
  8. Connectingtonode127.0.0.1: 7005: OK

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.