Redis Master-Slave environment configuration

Source: Internet
Author: User
Tags redis server

1.Redis Master-Slave synchronization principle

The Redis master server periodically writes the updated data to disk or writes the modification to the appended record file, synchronizes the data file to the slave server, loads the record file from the server, and updates the new data in the memory library.

2.VMWare Configuration 2 Servers

On the virtual machine where the Redis service is already installed, rename it to Redis-master (host), clone a virtual machine, rename the Redis-slave (slave)

View ip:192.168.74.128;

View IP and host the same network segment 192.168.74.129;

Open Putty (Session1), connect the host, (Session2), connect the slave.

Session1 Boot host Redis service, we can see that there is no key in the library now;

The host does not have to set up, Session2 from the machine to open the Redis.conf file settings as follows:

# Master-slave replication. Use slaveof to make a Redis instance a copy of# another Redis server. A few things to understand ASAP about Redis replication.## 1) Redis replication are asynchronous, but can configure a M Aster to#    Stop accepting writes if it appears to is not connected with at least#    a given number of slaves.# 2) Red is slaves be able to perform a partial resynchronization with the#    master if the replication link was lost for a Relat ively Small amount of# time    . Want to configure the replication backlog size (see the next# sections of this    file) with a sensible value DEP Ending on your needs.# 3) Replication are automatic and does not need user intervention. After a#    network partition slaves automatically try to reconnect to masters# and    resynchronize with them.## Slaveo F <masterip> <masterport>slaveof 192.168.74.128 6379

If the host has a password set, set the password for the connection host here

# If The master is password protected (using the "Requirepass" configuration# directive below) It's possible to tell the Slave to authenticate before# starting the replication synchronization process, otherwise the master will# refuse the Slav E request.## Masterauth <master-password>masterauth 123456

Start Session2 boot from the Redis service and connect with the client, and the same database is empty.

At this time, Session1 in the host to add a key, switch to Session2, from the machine immediately can get the host synchronization data, so that the master-slave data synchronization.

Redis Master-Slave environment configuration

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.