Redis Master-slave replication

Source: Internet
Author: User

The principle of Redis master-slave replication:

The 1.slave server connects to the master database #端口, password, the Ip2.slave server sends the SYCN command #异步请求备份 the 3.master server is backed up to an. rdb file (Local database) #就是类似于做个镜像, but the master operation can still be net Written in the buffer inside the new version of Redis can record the backlog in memory is the location of the backup, the next slave downtime does not have all the backup, if it is master down, from the beginning of the backup cycle these steps, the main process fork a child process to take a snapshot, The main process is not affected the 4.master server transmits the. rdb file to the slave server #发送数据文件5. Slave service Let's import the. Rdb into the database #从库导入数据文件
    1. Redis master server build reference previous article

      Redis Master server config file on appendaof Yes

    2. Build from the server and the primary server and start

      Modify the configuration file from the server

      Cd/opt/redis/conf

VI 6379.conf

SLAVEOF Primary server IP Port

Masterauth Authentication password for master server

3 OK verification

Primary server ip:192.168.56.17

From server ip:192.168.56.15

[[email protected] conf]# redis-cli-h 192.168.56.17192.168.56.17:6379> Auth 123456ok192.168.56.17:6379> set name Xiaomingok192.168.56.17:6379> Get Name "Xiaoming" 192.168.56.17:6379>

Verify from server

[[email protected] conf]# redis-cli-h 192.168.56.15192.168.56.15:6379> auth 123456ok192.168.56.15:6379> get Name "Xiaoming" 192.168.56.15:6379>

Ok no problem:

Description: From the server can not open AppendOnly Yes can also open to see the requirements

This article is from the "Brick Blog" blog, please be sure to keep this source http://wsxxsl.blog.51cto.com/9085838/1886004

Redis 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.