Redis Configuration Master-slave replication

Source: Internet
Author: User

Redis Master-slave replication Configuration master-slave replication

The./redis-server command, if it is not appended to the parameter, starts the Redis service by default configuration, but it can also append a profile path parameter later. There is a redis.conf file under the Redis root directory that you can use to configure the startup server directly

./redis-server ./redis.conf

The correspondence of Windows is

    redis-server.exe redis.windows.conf

Start the server

Master

Slave-1

Slave-2

Start the client

Configure Master-Slave relationships

the address of Master is 127.0.0.1 port is 6379
Executed under two slave clients

     SLAVEOF127.0.0.16379

Some log information that can be seen
Master

Slave-01

slave-02

Test

Set some test values on master

    set weixuan hello    set testkey testvalue

At the slave end of the test, see if we can get the data

SLAVE-01 's Log

SLAVE-02 's Log

Principle
    1. When you set up a master-slave relationship, the slave will send a sync command to master the first time it connects or re-connects master slave;
    2. Master receives the instruction, starts to start the background save process to save the data, and then collects all the data modification instructions
    3. The background is saved, Master sent this data to Slave,slave first save the data to disk, and then load it into memory, master then the collected data modification instruction line to send Slave,slave received after the re-execution of the instruction, In this way, data synchronization is achieved.
    4. Slave automatically reconnect after losing contact with master. If master receives multiple slave synchronization requests, it performs a single background save for all slave services
Error

There was an insufficient disk space error while slave was getting the data, but no reason was found and no other information was available.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Redis Configuration Master-slave replication

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.