Installing and configuring a Redis cluster

Source: Internet
Author: User
Tags redis cluster install redis

Installing and configuring a Redis cluster

Directory

Install, configure Redis cluster ... 1

1. Configure Yum ... 1

2. Install GCC. 1

3. Download the package ... 2

4. Installation (both master and slave need to install) 2

5. Configure Redis cluster ... 3

6. Start and close ... 4

7. Install Ruby RubyGems. 4

8. Initialize the cluster ... 4

Note: This example operating system is red Hat Enterprise Linux Server Release 6.4

1. Configure Yum

Unregistered Redhat does not support yum, adjustment steps:

Cd/etc/yum.repos.d

MV Rhel-source.repo RHEL-SOURCE.REPO.BK

wget Http://mirrors.163.com/.help/CentOS6-Base-163.repo

#163 Yum Source is better in China.

MV Centos6-base-163.repo Rhel-source.repo

Yum Makecache

2. Installing GCC

When installing Linux systems, System engineers tend to minimize the installation of appropriate Linux systems. Then, in such a Linux system to compile the source file installation, usually will appear cc:command not found, this indicates that the system does not have a C language environment installed, the C environment on the Linux system is GCC, so need to install GCC.

Gcc-v #查看版本

Yum-y Install GCC #安装

3. Download the package
cd/usr/local/src/

wget http://download.redis.io/releases/redis-3.0.7.tar.gz #下载


4. Installation (master and slave installation required)
TAR-XZVF redis-3.0.7.tar.gz #解压
MV redis-3.0.7/usr/local/
cd/usr/local/redis-3.0.7/
Make #安装

If error:

A ZMALLOC.H:50:31: Error: jemalloc/jemalloc.h: no file or directory

B Zmalloc.h:55:2: Error: #error "Newer version of Jemalloc required"

The reason is that Jemalloc overloads the malloc and free functions of ANSI C under Linux.

Workaround: Add parameters when make

Make MALLOC=LIBC

A hint is generally present

Hint:to run ' maketest ' is a good idea;)

But it is not tested and is usually available. If we run make test, we will have the following hints

You need TCL 8.5 ornewer on order to run the Redis test

Make: ***[test]error_1

The solution is to install tcl8.5

Yum install Tcl #安装

Run the make test hint again:

All Tests Passedwithout errors!

Indicates that the test passed without problems.

5. Configuring a Redis Cluster

cd/usr/local/

mkdir redis_cluster//Create cluster directory

Cdredis_cluster

mkdir 7000 7001//for 2 nodes and their corresponding ports 7000 7001

#以创建7000节点为例,

CD 7000

cp/usr/local/redis-3.0.7/redis.conf.///Copy to current 7000 directory

viredis.conf//Edit configuration

Daemonize Yes//redis background run
Pidfile/var/run/redis_7000.pid//pidfile file corresponds to 7000
Port 7000//Ports 7000
cluster-enabled Yes//turn on cluster to remove comment #
Cluster-config-file nodes.conf//cluster configuration profile first start auto-generated
Cluster-node-timeout 15000//Request timeout default 15 seconds
AppendOnly Yes//aof log on when needed to open, it will log each write operation logs

6. Start and close

Start

cd/usr/local/redis_cluster/7000

/usr/local/redis-3.0.7/src/redis-server redis.conf

Ps-ef | grep Redis to see if it started successfully

NETSTAT-TNLP | grep Redis can see the Redis listening port

Shut down

/usr/local/redis-3.0.7/src/redis-cli-p 7000 shutdown

7. Install Ruby RubyGems

Yum Install Ruby

Yum Install RubyGems

Gem Install Redis--version 3.0.7

8. Initializing the cluster

View firewall status

Service Iptablesstatus

Shutting down the firewall

Chkconfig iptables off

#初始化集群

/USR/LOCAL/REDIS-3.0.7/SRC/REDIS-TRIB.RB Create--replicas 1 192.168.1.10:7000 192.168.1.11:7000 192.168.1.12:7000 192.168.1.10:7001 192.168.1.11:7001 192.168.1.12:7001

#节点角色由顺序决定, first after Master is slave, in this article 7000 is master,7001 is slave

Installing and configuring a Redis cluster

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.