Redis Master-Slave Configuration (Windows edition)

Source: Internet
Author: User
Tags redis windows redis desktop manager install redis

Original: Redis master-slave Configuration (Windows edition)

Install from Library

1, copy a Redis file, as from the library.

2. Modify the port number redis.windows.conf from the library file.

3, installation Services, you need to reset the name. Then go to the service, turn on "redis6380"(you can now connect to the 6380 library)

Redis-server--service-install redis.windows.conf--service-name Redis6380

Configuring the master-Slave server

Redis slaveof Command

The Redis slaveof command transforms the current server into a subordinate server (slave server) for the specified server.

If the current server is already a secondary server for a primary server, executing slaveof host port will cause the current server to stop synchronizing the old primary server, discard the old data set, and start synchronizing the new primary server instead.

In addition, executing a command on a subordinate server slaveof no One will enable the secondary server to turn off replication and transition from the subordinate server back to the primary server, and the original synchronized data set will not be discarded.

Using the " slaveof no one does not discard the synchronous data Set" feature, you can use a secondary server as a new primary server when the primary server fails, enabling uninterrupted operation.

To turn on data synchronization by entering commands from library 6380 (format: slaveof host port)

127.0. 0.1 6379 6379

Turn off data synchronization by entering commands from the library

slaveof no          One //Cancel Sync

1, through the CD command into the extracted directory, using the redis-cli-p 6380 command to cut to 6380 from the library

2, slaveof 127.0.0.1 6379 set master-slave, 6379 is the main library, 6380 is from the library. ( when you set up synchronization, all the data for the main library is synchronized.) )

3. Testing

6379 Library set a 123, 6380 library get A, from the library by default is not allowed to write data .

4. Permanent preservation of master-Slave relations

Add the command slaveof 127.0.0.1 6379, as shown below, and when configured, the main library data is automatically synchronized each time the Redis service restarts.

Master-Slave synchronization process

The following is a study of how to establish a master-slave synchronization mechanism between slave server and master server.

1, slave service start, active connection master, and send Sync command, request initialization synchronization

2. After master receives sync, executes the bgsave command to generate the Rdb file and caches the write commands in that time period

3. After master completes the Rdb file, send it to all slave servers

4. After the slave server receives the Rdb file, delete the old cached data in memory and load the Rdb file

5. Master sends the cached write commands to all slave servers immediately after the RDB is sent

6, the initialization is complete, followed by incremental synchronization

Related articles: C # Redis Visualizer Redis Desktop Manager

C # Stackexchange.redis simple to use

C # Redis Windows edition download and installation

Reference article: 78816071

Redis Master-Slave Configuration (Windows edition)

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.