Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the problems encountered in redis replication

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the redis replication problems encountered in what related knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that you will have some gains after reading this redis replication problems, let's take a look at it.

After using the salveof command, the data synchronization was not seen for a long time, thinking that the replication function had failed or was misconfigured. Don't worry, there are two ways to determine if a replication is being established.

When you create a redis replication, you may find that slave does not start to synchronize data for a long time. The amount of data may be too large, resulting in slow dump data in master. At this point, you can execute the command top-p ${pgrep-dmine redislifessever} on master to see the process of dump.

[root@img1_u] # top-p $(pgrep-d, redis-server) top-14:06:24 up 54 days, 6:13, 1 user, load average: 1.18,1.32, 1.20Tasks: 2 total, 1 running, 1 sleeping, 0 stopped, 0 zombieCpu (s): 15.2%us, 1.7%sy, 0.6%ni, 81.9%id, 0.2%wa, 0.0%hi, 0.4%si 0.0%stMem: 24542176k total, 22771848k used, 1770328k free, 2245720k buffersSwap: 524280k total, 0k used, 524280k free, 4369452k cached PID USER PR NI VIRT RES SHR S% MEM TIME+ COMMAND21619 root 2005654m 5.4g 388 R 99.9 23.0 0vv 23.70 redis-server 1663 root 2005654m 5.4g 1068S 15.323.0 5042purv 31 redis-server

Redis-server is a single process, and now check that there are two processes through the top command, because as mentioned earlier, when establishing replication, redis will execute the bgsave command on the main service, fork a child process, and dump out the RDB file. Master dump is finished, and then transfer the snapshot file to slave.

Method 2: identify by rdb_bgsave_in_progress

Enter the redis-cli of master

127.0.0.1 6381 > info Persistence# Persistenceloading:0current_cow_size:0current_cow_size_age:0current_fork_perc:0.00current_save_keys_processed:0current_save_keys_total:0rdb_changes_since_last_save:0rdb_bgsave_in_progress:0 # # this means there is no rdb_last_save_time:1648953406rdb_last_bgsave_status:okrdb_last_bgsave_time_sec:0rdb_current_bgsave_time_sec:-1rdb_last _ cow_size:311296aof_enabled:0aof_rewrite_in_progress:0aof_rewrite_scheduled:0aof_last_rewrite_time_sec:-1aof_current_rewrite_time_sec:-1aof_last_bgrewrite_status:okaof_last_write_status:okaof_last_cow_size:0module_fork_in_progress:0module_fork_last_cow_size:0

If rdb_bgsave_in_progress is 1, then master is doing the bgsave command. At the same time, rdb_current_bgsave_time_sec shows the time that the bgsave command has been executed. Since RDB and AOF logs are not enabled by default on the master server, if rdb_bgsave_in_progress is 1, you can be sure to send a bgsave instruction dump out of the RDB file for replication reasons.

This is the end of the article on "what are the problems encountered in redis replication?" Thank you for reading! I believe you all have a certain understanding of the knowledge of "what are the problems encountered in redis replication?" if you want to learn more knowledge, you are welcome to follow the industry information channel.

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report