Linux/centos Redis cluster installation

Source: Internet
Author: User
Tags redis cluster

1. Installing the Redis Service
The packages involved in the article are added below for free access
#mkdir/usr/local/redis/data–p

#mkdir/usr/local/redis/log-p

#cd/USR/LOCAL/SRC

#tar-ZXF redis-3.0.6.tar.gz

#cd redis-2.8.9

#make && make Install

2. Copy the configuration file
#cp redis.conf/usr/local/bin/

#cd/usr/local/bin

#cp redis.conf redis-slave1

#cp redis.conf Redis-slave2

3. Modify the configuration file
#vi redis.conf

Daemonize Yes//turn on Background run mode

Pidfile/var/run/redis.pid

LogFile "/usr/local/redis/log/redis-log"

Bind 192.168.0.156

Dbfilenamedump.rdb

Dir/usr/local/redis/data

Port 6379

#vi redis-slave1

Daemonize Yes

Pidfile/var/run/redis-slave1.pid

LogFile "/usr/local/redis/log/redis-slave-log"

Port 63791

Bind 192.168.0.156

Dbfilename Dump-slave1.rdb

Dir/usr/local/redis/data

Slaveof 192.168.0.156 6379

Slave-read-only Yes

#vi Redis-slave2

Daemonize Yes

Pidfile/var/run/redis-slave2.pid

LogFile "/usr/local/redis/log/redis-slave2-log"

Port 63792

Bind 192.168.0.156

Dbfilename Dump-slave2.rdb

Dir/usr/local/redis/data

Slaveof 192.168.0.156 6379

4. Configuring the Redis-sentinel Service
cp/usr/local/src/redis-3.0.6/src/redis-sentinel/usr/bin/

cp/usr/local/src/redis-3.0.6/sentinel.conf/usr/local/bin/

Cd/usr/local/bin

5. Modify the configuration file
#egrep-V "^#|^$" sentinel.conf
Port 26379
Daemonize Yes
Dir/tmp
LogFile "/usr/local/redis/log/sentinel.log"
Sentinel Monitor MyMaster 192.168.0.156 6379 2
Sentinel Down-after-milliseconds MyMaster 30000
Sentinel Parallel-syncs MyMaster 1
Sentinel Failover-timeout MyMaster 180000
6. Start the service
6.1. Start the Redis service
[Email protected] bin]# Redis-server redis.conf

[Email protected] bin]# Redis-server redis-slave1

[Email protected] bin]# Redis-server redis-slave2

[Email protected] bin]# Ps-ef|grepredis

Root 2579 1 023:55? 00:00:00 Redis-server 10.0.0.3:6379

Root 2585 1 023:55? 00:00:00 Redis-server 10.0.0.3:63792

Root 2590 1 0 23:55? 00:00:00 Redis-server 10.0.0.3:63791

6.3. Start the Redis-sentinel service
[Email protected] bin]# Redis-sentinel sentinel.conf

[Email protected] bin]# Ps-ef|grepredis-sentinel

Root 2638 1 0 01:05? 00:00:04 redis-sentinel*:26379

See if the configuration file has changed

If you are interested in this, please scan the QR code below for free for more details

Linux/centos Redis cluster installation

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.