Redis master-slave structure deployment

Source: Internet
Author: User
Tags strong password

Redis master-slave Construction

Structure:

1). the same master can synchronize multiple slaves.
2). Server Load balancer can also accept connections and synchronization requests from other Server Load balancer instances. This effectively distributes the synchronization pressure of the master node. Therefore, we can regard redis's replication architecture as a graph structure.
3) The master server provides services for slaves in a non-blocking manner. Therefore, during master-slave synchronization, the client can still submit query or modify requests.
4). The slave server also completes Data Synchronization in a non-blocking manner. During synchronization, if a client submits a query request, redis returns the data before synchronization.
5). In order to load the read operation pressure of the master, the slave server can provide the read-only operation service for the client, and the write service must still be completed by the master. Even so, the scalability of the system has been greatly improved.
6) The master can save the data to slaves, thus avoiding the need for an independent process in the master to complete this operation.


Principle:
1) After slave is started and connected to the master, it will send a sync command.

2) the master will start the background storage process and collect all the commands received for modifying the dataset. After the background process is executed, the master will transmit the entire database file to the slave, to complete a full synchronization.

3) The slave server saves the database file data and loads it into the memory.

4) The master continues to send all the collected modification commands and the new modification commands to slaves in sequence. slave will execute these data modification commands this time to achieve the final data synchronization.
5) if the connection between the master and slave is disconnected, slave can automatically reconnect to the master, but after the connection is successful, a full synchronization will be automatically executed.

MASTER: 192.168.122.51

From: 192.168.122.61

Redis service construction see: http://8824130.blog.51cto.com/8814130/1439607

 

Deployment process (you only need to configure it immediately, and the master server does not need any configuration ):

Configure on the slave server:

[[Email protected] SRC] # Vim/usr/local/redis/etc/redis. conf

197 slaveof 192.168.122.51 6379 // specify the IP address and port of the master server

205 masterauth 123 // specify the password used to log on to the master service. If not, no password is required.

Warning because redis runs fast in the memory early, external users can perform a K password test in one second, this means you need to specify a very powerful password to prevent brute force cracking. We recommend that you set a strong password.

[[Email protected] SRC] #/usr/local/redis/bin/redis-cli

127.0.0.1: 6379> info // you can use info to view the IP port and master of your role and master service.

Service connection normal?

Role: slave

Master_host: 192.168.122.51

Master_port: 6379

Master_link_status: Up


This article is from the "Linux Network Service Building" blog!

Redis master-slave structure deployment

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.