In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "what is the meaning of master-slave replication in Redis". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Master-slave replication:
1. Master can have multiple slave.
2. Multiple slave can connect not only to the same master, but also to other slave.
3. Master-slave replication will not block master, and master can continue to process client requests when synchronizing data.
4. Improve the scalability of the system.
Master-slave replication process:
1. Slave establishes a connection with master and sends sync synchronization commands.
2. Master will start a background process to save the database snapshot to a file, while the master main process will start collecting new write commands and caching them.
3. After the background has finished saving, send this file to slave.
4. Slave saves the secondary file to the hard disk.
Configure the master and slave servers:
You only need to add the following configuration to the configuration file of slave:
[root@D2-TRAIN15 redis-4.0.1] # egrep "slaveof | masterauth" redis.conf
# Master-Slave replication. Use slaveof to make a Redis instance a copy of
Slaveof # specifies the IP and port of the master.
Masterauth # specifies the password for master.
Modify the configuration file of the slave server:
[root@D2-TRAIN15 redis-4.0.1] # egrep "slaveof | masterauth" redis.conf
# Master-Slave replication. Use slaveof to make a Redis instance a copy of
Slaveof 10.163.89.245 6379
Masterauth 123456
[root@D2-TRAIN15 redis-4.0.1] # src/redis-server redis.conf
[root@D2-TRAIN15 redis-4.0.1] # src/redis-cli
127.0.0.1 purl 6379 > info replication
# Replication
Role:slave
Master_host:10.163.89.245
Master_port:6379
Master_link_status:up
Master_last_io_seconds_ago:1
View the main library:
127.0.0.1 purl 6379 > info replication
# Replication
Role:master
Connected_slaves:1
Slave0:ip=10.163.89.15,port=6379,state=online,offset=154,lag=1
Test:
Main library:
127.0.0.1 purl 6379 > set name master
OK
From the library:
127.0.0.1 purl 6379 > get name
"master"
This is the end of the content of "what is the meaning of master-slave replication in Redis"? thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.