CENTOS7 Installation Configuration redis-3.0.0

Source: Internet
Author: User
Tags redis cluster

I. Installing the necessary packages

Yum Install GCC

Two. Install under Linux

#下载wget Http://download.redis.io/releases/redis-3.0.0.tar.gztar zxvf redis-3.0.0.tar.gzcd redis-3.0.0# If no parameters are added, Error make MALLOC=LIBC under Linux

After installation, start the file

#启动redissrc/redis-server & #关闭redissrc/redis-cli shutdown

Test Redis

Test success

3.redis Cluster cluster construction

Setting up a native test environment

Create a run Directory

#建立redis运行目录mkdir-P redis-server/7000/#复制默认的配置文档cp redis-3.0.0/redis.conf redis-server/redis.default.conf# Copy the compiled server to the running directory CP redis-3.0.0/src/redis-server Redis-server/7000/

To create a standalone configuration file

#在7000目录下建立redis的配置文档vim redis-server/7000/redis.conf

File contents

#redis-server/7000/redis.confinclude/root/redis-server/redis.default.confpidfile/var/run/redis-7000.pidport 7000cluster-enabled yescluster-config-file redis-node-7000.confcluster-node-timeout 5000appendonly Yes

Copy run directory (simulate cluster environment)

#复制目录cp-R 7000/7001/cp-r 7000/7002/cp-r 7000/7003/cp-r 7000/7004/cp-r 7000/7005/

Modify the port and file name of the appropriate profile

Create a startup script redis-server/redis-start.sh

#!/bin/sh/root/redis-server/7000/redis-server/root/redis-server/7000/redis.conf &/root/redis-server/7001/ Redis-server/root/redis-server/7001/redis.conf &/root/redis-server/7002/redis-server/root/redis-server/7002 /redis.conf &/root/redis-server/7003/redis-server/root/redis-server/7003/redis.conf &/root/redis-server/ 7004/redis-server/root/redis-server/7004/redis.conf &/root/redis-server/7005/redis-server/root/redis-server /7005/redis.conf &

Configuring the Cluster

Install Ruby

Yum Install ruby-devel.x86_64

Installing the Redis Gem

# Gem install Redisfetching:redis-3.2.1.gem (100%) successfully installed redis-3.2.1parsing documentation for redis-3.2 .1Installing RI documentation for redis-3.2.11 gem installed

Using scripts to create a cluster mechanism

When create, the parameter--replicas 1 means that each master is assigned a salve, such as an example, 3 Master 3 Salve

#./REDIS-TRIB.RB Create 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> >> Creating clusterconnecting to Node 127.0.0.1:7000:okconnecting to node 127.0.0.1:7001:okconnecting to node 127.  0.0.1:7002:okconnecting to node 127.0.0.1:7003:okconnecting to node 127.0.0.1:7004:okconnecting to node 127.0.0.1:7005: Ok>>> performing hash slots allocation on 6 nodes ... Using 6 masters:127.0.0.1:7000127.0.0.1:7001127.0.0.1:7002127.0.0.1:7003127.0.0.1:7004127.0.0.1:7005m: F3dd250e4bc145c8b9f864e82f65e00d1ba627be 127.0.0.1:7000 slots:0-2730 (2731 slots) Masterm: 1ba602ade59e0770a15128b193f2ac29c251ab5e 127.0.0.1:7001 slots:2731-5460 (2730 slots) Masterm: 4F840A70520563C8EF0D7D1CC9D5EAFF6A1547A2 127.0.0.1:7002 slots:5461-8191 (2731 slots) Masterm: 702adc7ae9caf1f6702987604548c6fc1d22e813 127.0.0.1:7003 slots:8192-10922 (2731 slots) Masterm: 4F87A11D2EA6EBE9CAF02C9DBD827A3DBA8A53CF 127.0.0.1:7004 slots:10923-13652 (2730 slots) maSterm:216bbb7da50bd130da16a327c76dc6d285f731b3 127.0.0.1:7005 slots:13653-16383 (2731 slots) MasterCan I set the above Configuration? (Type ' yes ' to accept): yes>>> Nodes configuration updated>>> Assign a different config epoch to each no De>>> sending CLUSTER MEET messages to join the clusterwaiting for the CLUSTER to Join...>>> performing Cluster Check (using node 127.0.0.1:7000) m:f3dd250e4bc145c8b9f864e82f65e00d1ba627be 127.0.0.1:7000 slots:0-2730 (2731 Slots) masterm:1ba602ade59e0770a15128b193f2ac29c251ab5e 127.0.0.1:7001 slots:2731-5460 (2730 slots) MasterM: 4F840A70520563C8EF0D7D1CC9D5EAFF6A1547A2 127.0.0.1:7002 slots:5461-8191 (2731 slots) Masterm: 702adc7ae9caf1f6702987604548c6fc1d22e813 127.0.0.1:7003 slots:8192-10922 (2731 slots) Masterm: 4F87A11D2EA6EBE9CAF02C9DBD827A3DBA8A53CF 127.0.0.1:7004 slots:10923-13652 (2730 slots) MasterM: 216bbb7da50bd130da16a327c76dc6d285f731b3 127.0.0.1:7005 slots:13653-16383 (2731 slots) Master[OK] All nodes agree about slots configuration.>>> Check for open slots...>>> Check slots coverage ... [OK] All 16384 slots covered.

CentOS7 installation Configuration redis-3.0.0

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.