Actual Combat | Redis's master-slave server Setup

Source: Internet
Author: User
Tags download redis failover lua

Tag: string CTI ICA client fails read SRC compress mat

"actual combat record" introductory

The Guardian of the cloud "the actual combat record" column will regularly share some of the experience and skills in the development of operations to fan friends, hoping to pay attention to our friends benefit. This issue is shared by the Cloud Defender Security Platform engineer Tian, which will bring Redis's master-slave server Setup.

Redis is a simple and fast key-value storage System. It provides a rich data storage structure, including lists, sets, ordered sets and hashes, and, of course, memcached structures like strings. Redis also provides rich manipulation of these data structures.

Redis Sentinel Mode Introduction

The Sentinel feature of Redis is used to manage multiple Redis servers, which primarily provide monitoring, alerting, and automatic failover capabilities.

1. Monitoring (Monitoring): Sentinel will constantly check whether your primary server and slave server are functioning properly.

2. Reminder (Notification): When a problem occurs with a Redis server being monitored, Sentinel can send notifications to administrators or other applications through the API.

3. Automatic failover (Automatic failover): When a primary server fails, Sentinel starts an automatic failover operation that upgrades one of the failed primary servers from the server to the new primary server. And let the other server from the failed master to replicate the new primary server, when the client tries to connect to the failed primary server, the cluster will also return the address of the new primary server to the client, so that the cluster can use the new primary server instead of the failed server.

Installation

Download redis-2.8.19.tar.gz

Unzip the tar zxf redis-2.8.19.tar.gz

installation CD redis-2.8.19

Make && make install

Redis is also installed on each machine

Redis Master-Slave environment construction

One master: 192.168.24.147

Two from: 192.168.24.148,192.168.24.149

(1) Main 192.168.24.147 configuration

Catalog: conf/redis_6379.conf

Start command Src/redis-server conf/redis_6379.conf

Daemonize Yes

Pidfile/export/data/redis_pid/redis_6379.pid

Port 6379

# Tcp-backlog 511

Timeout 300

Tcp-keepalive 0

LogLevel Notice

Logfile/export/logs/redis/redis_6379.log

Databases 16

Stop-writes-on-bgsave-error Yes

Rdbcompression Yes

Dbfilename 6379.rdb

dir/export/data/redis_data/6379

Slave-serve-stale-data Yes

Slave-read-only Yes

Repl-disable-tcp-nodelay No

Repl-backlog-size 128MB

MaxMemory 2g

AppendOnly No

Appendfilename 6379.aof

Appendfsync everysec

No-appendfsync-on-rewrite No

Auto-aof-rewrite-percentage 100

Auto-aof-rewrite-min-size 64MB

Lua-time-limit 5000

Slowlog-log-slower-than 10000

Slowlog-max-len 1024

# notify-keyspace-events ""

Hash-max-ziplist-entries 512

Hash-max-ziplist-value 64

List-max-ziplist-entries 512

List-max-ziplist-value 64

Set-max-intset-entries 512

Zset-max-ziplist-entries 128

Zset-max-ziplist-value 64

# Hll-sparse-max-bytes 3000

activerehashing Yes

Client-output-buffer-limit Normal 0 0 0

Client-output-buffer-limit slave 512MB 256MB 60

Client-output-buffer-limit pubsub 32MB 8MB 60

Hz 10

Rename-command Keys Jkeys

(2) configuration from 192.168.24.148

Catalog: conf/redis_6379.conf

Start command Src/redis-server conf/redis_6379.conf

Daemonize Yes

Slaveof 192.168.24.147 6379

Pidfile/export/data/redis_pid/redis_6379.pid

Port 6379

# Tcp-backlog 511

Timeout 300

Tcp-keepalive 0

LogLevel Notice

Logfile/export/logs/redis/redis_6379.log

Databases 16

Stop-writes-on-bgsave-error Yes

Rdbcompression Yes

Dbfilename 6379.rdb

dir/export/data/redis_data/6379

Slave-serve-stale-data Yes

Slave-read-only Yes

Repl-disable-tcp-nodelay No

Repl-backlog-size 128MB

MaxMemory 2g

AppendOnly No

Appendfilename 6379.aof

Appendfsync everysec

No-appendfsync-on-rewrite No

Auto-aof-rewrite-percentage 100

Auto-aof-rewrite-min-size 64MB

Lua-time-limit 5000

Slowlog-log-slower-than 10000

Slowlog-max-len 1024

# notify-keyspace-events ""

Hash-max-ziplist-entries 512

Hash-max-ziplist-value 64

List-max-ziplist-entries 512

List-max-ziplist-value 64

Set-max-intset-entries 512

Zset-max-ziplist-entries 128

Zset-max-ziplist-value 64

# Hll-sparse-max-bytes 3000

activerehashing Yes

Client-output-buffer-limit Normal 0 0 0

Client-output-buffer-limit slave 512MB 256MB 60

Client-output-buffer-limit pubsub 32MB 8MB 60

Hz 10

Rename-command Keys Jkeys

(3) configuration from 192.168.24.149

Catalog: conf/redis_6379.conf

Start command Src/redis-server conf/redis_6379.conf

Daemonize Yes

Slaveof 192.168.24.147 6379

Pidfile/export/data/redis_pid/redis_6379.pid

Port 6379

# Tcp-backlog 511

Timeout 300

Tcp-keepalive 0

LogLevel Notice

Logfile/export/logs/redis/redis_6379.log

Databases 16

Stop-writes-on-bgsave-error Yes

Rdbcompression Yes

Dbfilename 6379.rdb

dir/export/data/redis_data/6379

Slave-serve-stale-data Yes

Slave-read-only Yes

Repl-disable-tcp-nodelay No

Repl-backlog-size 128MB

MaxMemory 2g

AppendOnly No

Appendfilename 6379.aof

Appendfsync everysec

No-appendfsync-on-rewrite No

Auto-aof-rewrite-percentage 100

Auto-aof-rewrite-min-size 64MB

Lua-time-limit 5000

Slowlog-log-slower-than 10000

Slowlog-max-len 1024

# notify-keyspace-events ""

Hash-max-ziplist-entries 512

Hash-max-ziplist-value 64

List-max-ziplist-entries 512

List-max-ziplist-value 64

Set-max-intset-entries 512

Zset-max-ziplist-entries 128

Zset-max-ziplist-value 64

# Hll-sparse-max-bytes 3000

activerehashing Yes

Client-output-buffer-limit Normal 0 0 0

Client-output-buffer-limit slave 512MB 256MB 60

Client-output-buffer-limit pubsub 32MB 8MB 60

Hz 10

Rename-command Keys Jkeys

Actual Combat | Redis's master-slave server Setup

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.