In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 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 "how to achieve Redis master-slave replication". In the operation of actual cases, many people will encounter such a dilemma. Next, 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!
Architecture
Master 192.168.2.222
From 192.168.2.187
From 192.168.2.188
Add from the library profile:
From 192.168.2.187
From 192.168.2.188
[root@rac1 config] # pwd
/ usr/local/redis/config
[root@rac1 config] # vim redis.conf
# add
Slaveof 192.168.2.222 6379
Restart the database
[root@rac1 config] # redis-cli-p 6379 shutdown
[root@rac1 config] # redis-server redis.conf
Verify data synchronization
Main library 2.222
[root@cjcos src] # redis-cli
127.0.0.1 purl 6379 > set station dba
OK
127.0.0.1 purl 6379 > get station
"dba"
From library 2.187
[root@rac1 config] # redis-cli
127.0.0.1 purl 6379 > get station
"dba"
From library 2.188
[root@rac2 config] # redis-cli
127.0.0.1 purl 6379 > get station
"dba"
The main library 2.222 views synchronization information
127.0.0.1 purl 6379 > info replication
# Replication
Role:master
Connected_slaves:2
Slave0:ip=192.168.2.187,port=6379,state=online,offset=11208,lag=1
Slave1:ip=192.168.2.188,port=6379,state=online,offset=11208,lag=1
Master_replid:231ff9d15411b50038a43bb0726580f4dd788f80
Master_replid2:0000000000000000000000000000000000000000
Master_repl_offset:11208
Second_repl_offset:-1
Repl_backlog_active:1
Repl_backlog_size:1048576
Repl_backlog_first_byte_offset:1
Repl_backlog_histlen:11208
Synchronization log
Main library 2.222
-redis.log
8511 M 23 Mar 2020 1415 53 51.841 * Background saving terminated with success
8511 Mar M 23 Mar 2020 1415 53 succeeded 51.842 * Synchronization with replica 192.168.2.187 succeeded
8511 Mar M 23 asks for synchronization 2020 1415 53 asks for synchronization * Replica 192.168.2.188 asks for synchronization
8511Viru M 23 Mar 2020 14purl 53 Mar 57.272 * Full resync requested by replica 192.168.2.188 Vol 6379
8511disk M 23 Mar 2020 1415 53 Mar 57.272 * disk
8511 M 23 Mar 2020 1415 53 57.272 * Background saving started by pid 8528
8528 C 23 Mar 2020 1415 53 57.326 * DB saved on disk
8528 Mar C 23 Mar 2020 1415 53 MB of memory used by copy-on-write 57.327 * RDB: 0
Frequently asked questions:
Synchronization failed. The log is as follows:
-redis.log
29884 S 23 Mar 2020 141450 29.152 * Connecting to MASTER 192.168.2.222
29884VOV S 23 Mar 2020 1450VOV 29.152 * MASTER REPLICA sync started
29884 S 23 Mar 2020 1450 29.152 *.
29884DENIED Redis is running in protected mode because protected mode is enabled S 23 Mar 2020 1450 DENIED Redis is running in protected mode because protected mode is enabled no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect'
Solution:
-profile redis.conf add:
Bind 0.0.0.0
"how to achieve Redis master-slave replication" content is introduced here, thank you for 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.